1cmake_minimum_required(VERSION 3.1) 2 3project(DummyImport CXX) 4 5set(JSON_BuildTests OFF CACHE INTERNAL "") 6add_subdirectory(${nlohmann_json_source} 7 ${CMAKE_CURRENT_BINARY_DIR}/nlohmann_json) 8 9add_executable(with_namespace_target main.cpp) 10target_link_libraries(with_namespace_target nlohmann_json::nlohmann_json) 11 12add_executable(without_namespace_target main.cpp) 13target_link_libraries(without_namespace_target nlohmann_json) 14 15if(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) 20endif() 21