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