| 1 |
cmake_minimum_required(VERSION 3.1...3.14) |
| 2 |
|
| 3 |
project(DummyImport CXX) |
| 4 |
|
| 5 |
set(JSON_BuildTests OFF CACHE INTERNAL "") |
| 6 |
add_subdirectory(${nlohmann_json_source} |
| 7 |
${CMAKE_CURRENT_BINARY_DIR}/nlohmann_json) |
| 8 |
|
| 9 |
add_executable(with_namespace_target main.cpp) |
| 10 |
target_link_libraries(with_namespace_target nlohmann_json::nlohmann_json) |
| 11 |
|
| 12 |
add_executable(without_namespace_target main.cpp) |
| 13 |
target_link_libraries(without_namespace_target nlohmann_json) |
| 14 |
|
| 15 |
if(NOT MSVC) |
| 16 |
add_executable(without_exceptions main.cpp) |
| 17 |
target_link_libraries(without_exceptions nlohmann_json::nlohmann_json) |
| 18 |
target_compile_definitions(without_exceptions PRIVATE JSON_NOEXCEPTION) |
| 19 |
target_compile_options(without_exceptions PRIVATE -fno-exceptions) |
| 20 |
endif() |