diff options
Diffstat (limited to 'Tests/CMakeCommands/target_link_libraries')
4 files changed, 51 insertions, 4 deletions
diff --git a/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt b/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt index 1d0e342..cd0fe11 100644 --- a/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt +++ b/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt @@ -62,10 +62,6 @@ assert_property(targetA LINK_INTERFACE_LIBRARIES "") add_subdirectory(subdir) target_link_libraries(targetA subdirlib) -set_property(TARGET targetA APPEND PROPERTY - INCLUDE_DIRECTORIES - $<TARGET_PROPERTY:subdirlib,INTERFACE_INCLUDE_DIRECTORIES> -) target_link_libraries(targetA depB depC) @@ -87,3 +83,24 @@ set_property(TARGET depD APPEND PROPERTY add_executable(targetB targetB.cpp) target_link_libraries(targetB depD) + +macro(create_header _name) + file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${_name}") + file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/${_name}/${_name}.h" "//${_name}.h\n") +endmacro() + +create_header(foo) +create_header(bar) + +add_library(depG SHARED depG.cpp) +generate_export_header(depG) +target_include_directories(depG INTERFACE + "${CMAKE_CURRENT_BINARY_DIR}/foo" + "${CMAKE_CURRENT_BINARY_DIR}/bar" +) +target_compile_definitions(depG INTERFACE + TEST_DEF +) + +add_executable(targetC targetC.cpp) +target_link_libraries(targetC depG) diff --git a/Tests/CMakeCommands/target_link_libraries/depG.cpp b/Tests/CMakeCommands/target_link_libraries/depG.cpp new file mode 100644 index 0000000..65b9655 --- /dev/null +++ b/Tests/CMakeCommands/target_link_libraries/depG.cpp @@ -0,0 +1,7 @@ + +#include "depG.h" + +int DepG::foo() +{ + return 0; +} diff --git a/Tests/CMakeCommands/target_link_libraries/depG.h b/Tests/CMakeCommands/target_link_libraries/depG.h new file mode 100644 index 0000000..1a36589 --- /dev/null +++ b/Tests/CMakeCommands/target_link_libraries/depG.h @@ -0,0 +1,7 @@ + +#include "depg_export.h" + +struct DEPG_EXPORT DepG +{ + int foo(); +}; diff --git a/Tests/CMakeCommands/target_link_libraries/targetC.cpp b/Tests/CMakeCommands/target_link_libraries/targetC.cpp new file mode 100644 index 0000000..ff6ba66 --- /dev/null +++ b/Tests/CMakeCommands/target_link_libraries/targetC.cpp @@ -0,0 +1,16 @@ + +#include "depG.h" + +#include "foo.h" +#include "bar.h" + +#ifndef TEST_DEF +#error Expected TEST_DEF definition +#endif + +int main(int argc, char **argv) +{ + DepG g; + + return g.foo(); +} |