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