add regression test for #2281

This commit is contained in:
Niels Lohmann 2020-07-22 12:38:39 +02:00
parent 4d63252c6c
commit c4356c68e0
No known key found for this signature in database
GPG key ID: 7F3CEA63AE251B69
2 changed files with 2 additions and 5 deletions

View file

@ -2,7 +2,6 @@ add_test(NAME cmake_target_include_directories_configure
COMMAND ${CMAKE_COMMAND} COMMAND ${CMAKE_COMMAND}
-G "${CMAKE_GENERATOR}" -G "${CMAKE_GENERATOR}"
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_BUILD_TYPE=Debug
-Dnlohmann_json_source=${PROJECT_SOURCE_DIR} -Dnlohmann_json_source=${PROJECT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/project ${CMAKE_CURRENT_SOURCE_DIR}/project
) )

View file

@ -11,13 +11,11 @@ target_include_directories(with_private_system_target PRIVATE SYSTEM ${nlohmann_
set_target_properties(with_private_system_target PROPERTIES CXX_STANDARD 11) set_target_properties(with_private_system_target PROPERTIES CXX_STANDARD 11)
# regression from https://github.com/nlohmann/json/discussions/2281 # regression from https://github.com/nlohmann/json/discussions/2281
add_library(Foo SHARED) add_library(Foo SHARED Foo.cpp Bar.cpp)
target_sources(Foo PRIVATE Foo.cpp Bar.cpp)
target_include_directories(Foo PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${nlohmann_json_source}/include) target_include_directories(Foo PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${nlohmann_json_source}/include)
set_target_properties(Foo PROPERTIES CXX_STANDARD 11) set_target_properties(Foo PROPERTIES CXX_STANDARD 11)
add_library(Bar SHARED) add_library(Bar SHARED PRIVATE Bar.cpp)
target_sources(Bar PRIVATE Bar.cpp)
target_link_libraries(Bar PRIVATE Foo) target_link_libraries(Bar PRIVATE Foo)
target_include_directories(Bar PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${nlohmann_json_source}/include) target_include_directories(Bar PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${nlohmann_json_source}/include)
set_target_properties(Bar PROPERTIES CXX_STANDARD 11) set_target_properties(Bar PROPERTIES CXX_STANDARD 11)