CMakeLists.txt 588 B

123456789101112131415161718192021
  1. cmake_minimum_required(VERSION 3.11)
  2. project(DummyImport CXX)
  3. include(FetchContent)
  4. FetchContent_Declare(json
  5. GIT_REPOSITORY ${CMAKE_CURRENT_SOURCE_DIR}/../../..
  6. GIT_TAG HEAD)
  7. FetchContent_GetProperties(json)
  8. if(NOT json_POPULATED)
  9. FetchContent_Populate(json)
  10. add_subdirectory(${json_SOURCE_DIR} ${json_BINARY_DIR} EXCLUDE_FROM_ALL)
  11. endif()
  12. add_executable(with_namespace_target main.cpp)
  13. target_link_libraries(with_namespace_target nlohmann_json::nlohmann_json)
  14. add_executable(without_namespace_target main.cpp)
  15. target_link_libraries(without_namespace_target nlohmann_json)