From 558886e7e059afccfdca8da2fb4e820c04c8afe2 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 23 Mar 2023 13:56:22 -0400 Subject: [PATCH] cmake: Avoid exposing implementation dependencies publicly (#102) The `CPPDAP_JSON_{NLOHMANN,RAPID}` compile definition is used only in cppdap's implementation sources, and does not need to be defined by dependents including our headers. Also avoid exposing `nlohmann_json::nlohmann_json` as a public link dependency of our installed package. It is used only when compiling cppdap. --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 486aab6..5ff8a59 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -136,7 +136,7 @@ endif() function(cppdap_set_json_links target) if (CPPDAP_USE_EXTERNAL_NLOHMANN_JSON_PACKAGE) - target_link_libraries(${target} PRIVATE nlohmann_json nlohmann_json::nlohmann_json) + target_link_libraries(${target} PRIVATE "$") elseif(CPPDAP_USE_EXTERNAL_RAPIDJSON_PACKAGE) target_link_libraries(${target} PRIVATE rapidjson) else() @@ -164,7 +164,7 @@ function(cppdap_set_target_options target) # Add define for JSON library in use target_compile_definitions(${target} - PUBLIC "CPPDAP_JSON_${CPPDAP_JSON_LIBRARY_UPPER}=1" + PRIVATE "CPPDAP_JSON_${CPPDAP_JSON_LIBRARY_UPPER}=1" ) # Treat all warnings as errors