Guest User

Untitled

a guest
Sep 19th, 2019
105
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. cmake_minimum_required(VERSION 3.2)
  2.  
  3. project(json_test)
  4.  
  5. include(ExternalProject)
  6.  
  7. set(JSON_BUILD_DIR "${PROJECT_BINARY_DIR}/jsoncpp/build")
  8. set(JSON_INSTALL_DIR "${JSON_BUILD_DIR}/install")
  9. ExternalProject_Add(
  10.     jsoncpp_proj
  11.     GIT_REPOSITORY https://github.com/open-source-parsers/jsoncpp.git
  12.     SOURCE_DIR  "${PROJECT_BINARY_DIR}/jsoncpp/src"
  13.     BINARY_DIR  "${JSON_BUILD_DIR}"
  14.     INSTALL_DIR "${JSON_INSTALL_DIR}"
  15.     CMAKE_ARGS
  16.         -DCMAKE_INSTALL_PREFIX=install
  17. )
  18.  
  19. add_library(jsoncpp STATIC IMPORTED)
  20. set_target_properties(jsoncpp PROPERTIES
  21.     IMPORTED_LOCATION "${JSON_INSTALL_DIR}/lib/jsoncpp.lib"
  22.     INTERFACE_INCLUDE_DIRECTORIES "${JSON_INSTALL_DIR}/include"
  23. )
  24.  
  25. add_executable(test
  26.     main.cpp
  27. )
  28.  
  29. target_link_libraries(test PUBLIC jsoncpp)
RAW Paste Data