Skip to content

Commit

Permalink
Merge pull request #2780 from mwtoews/nlohmann_json_interface_lib
Browse files Browse the repository at this point in the history
CMake: remove external nlohmann_json from INTERFACE_LINK_LIBRARIES target
  • Loading branch information
rouault authored and github-actions[bot] committed Jul 14, 2021
1 parent 66f595e commit 1cb0b80
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 13 deletions.
4 changes: 0 additions & 4 deletions src/bin_projsync.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ set_target_properties(bin_projsync
OUTPUT_NAME projsync)
target_link_libraries(bin_projsync PRIVATE ${PROJ_LIBRARIES})
target_compile_options(bin_projsync PRIVATE ${PROJ_CXX_WARN_FLAGS})
if(NLOHMANN_JSON STREQUAL "external")
target_compile_definitions(bin_projsync PRIVATE EXTERNAL_NLOHMANN_JSON)
target_link_libraries(bin_projsync PRIVATE nlohmann_json::nlohmann_json)
endif()

install(TARGETS bin_projsync
DESTINATION ${BINDIR})
Expand Down
3 changes: 2 additions & 1 deletion src/lib_proj.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,8 @@ target_link_libraries(proj PRIVATE ${SQLITE3_LIBRARY})

if(NLOHMANN_JSON STREQUAL "external")
target_compile_definitions(proj PRIVATE EXTERNAL_NLOHMANN_JSON)
target_link_libraries(proj PRIVATE nlohmann_json::nlohmann_json)
target_link_libraries(proj
PRIVATE $<BUILD_INTERFACE:nlohmann_json::nlohmann_json>)
endif()

if(TIFF_ENABLED)
Expand Down
8 changes: 0 additions & 8 deletions test/unit/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,6 @@ add_executable(test_defmodel
target_link_libraries(test_defmodel
PRIVATE GTest::gtest
PRIVATE ${PROJ_LIBRARIES})
if(NLOHMANN_JSON STREQUAL "external")
target_compile_definitions(test_defmodel PRIVATE EXTERNAL_NLOHMANN_JSON)
target_link_libraries(test_defmodel PRIVATE nlohmann_json::nlohmann_json)
endif()
add_test(NAME test_defmodel COMMAND test_defmodel)
set_property(TEST test_defmodel
PROPERTY ENVIRONMENT ${PROJ_TEST_ENVIRONMENT})
Expand All @@ -180,10 +176,6 @@ add_executable(test_tinshift
target_link_libraries(test_tinshift
PRIVATE GTest::gtest
PRIVATE ${PROJ_LIBRARIES})
if(NLOHMANN_JSON STREQUAL "external")
target_compile_definitions(test_tinshift PRIVATE EXTERNAL_NLOHMANN_JSON)
target_link_libraries(test_tinshift PRIVATE nlohmann_json::nlohmann_json)
endif()
add_test(NAME test_tinshift COMMAND test_tinshift)
set_property(TEST test_tinshift
PROPERTY ENVIRONMENT ${PROJ_TEST_ENVIRONMENT})
Expand Down

0 comments on commit 1cb0b80

Please sign in to comment.