diff options
author | Brad King <brad.king@kitware.com> | 2013-07-15 13:33:42 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2013-07-15 13:33:42 (GMT) |
commit | b6e0972262241b287fa4048b29dd920fecf22ea1 (patch) | |
tree | bd40298d5fc53e33478e566cc8e937dae40a0a93 /Tests | |
parent | f6024ef420103c4cb393d7752f7e110c5e0d5dfe (diff) | |
parent | 3e30d9ed67f963af15b8d57d24a5fa377299e43a (diff) | |
download | CMake-b6e0972262241b287fa4048b29dd920fecf22ea1.zip CMake-b6e0972262241b287fa4048b29dd920fecf22ea1.tar.gz CMake-b6e0972262241b287fa4048b29dd920fecf22ea1.tar.bz2 |
Merge topic 'INTERFACE_LINK_LIBRARIES-prop'
3e30d9e TLL: Don't populate old link interface if CMP0022 is NEW.
574fec9 Export: Generate INTERFACE_LINK_LIBRARIES property on targets.
d0a76ea Introduce the INTERFACE_LINK_LIBRARIES property.
ddde61c Introduce the LINK_ONLY generator expression.
5aa9731 GenexEval: Add abstracted access to link interface for a target.
Diffstat (limited to 'Tests')
70 files changed, 446 insertions, 0 deletions
diff --git a/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt b/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt index b003a1b..2240539 100644 --- a/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt +++ b/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt @@ -122,3 +122,5 @@ add_library(libConsumer empty.cpp) # evaluates to the empty string in non-Debug cases, ensure that that causes # no problems. target_link_libraries(libConsumer debug depA) + +add_subdirectory(cmp0022) diff --git a/Tests/CMakeCommands/target_link_libraries/cmp0022/CMakeLists.txt b/Tests/CMakeCommands/target_link_libraries/cmp0022/CMakeLists.txt new file mode 100644 index 0000000..dd6ab41 --- /dev/null +++ b/Tests/CMakeCommands/target_link_libraries/cmp0022/CMakeLists.txt @@ -0,0 +1,18 @@ + +include(GenerateExportHeader) +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +cmake_policy(SET CMP0022 NEW) +add_library(cmp0022lib SHARED cmp0022lib.cpp) +generate_export_header(cmp0022lib) +add_library(cmp0022ifacelib SHARED cmp0022ifacelib.cpp) +generate_export_header(cmp0022ifacelib) +target_link_libraries(cmp0022lib LINK_PUBLIC cmp0022ifacelib) + +assert_property(cmp0022lib LINK_INTERFACE_LIBRARIES "") +assert_property(cmp0022ifacelib LINK_INTERFACE_LIBRARIES "") +assert_property(cmp0022lib INTERFACE_LINK_LIBRARIES "cmp0022ifacelib") +assert_property(cmp0022ifacelib INTERFACE_LINK_LIBRARIES "") + +add_executable(cmp0022exe cmp0022exe.cpp) +target_link_libraries(cmp0022exe cmp0022lib) diff --git a/Tests/CMakeCommands/target_link_libraries/cmp0022/cmp0022exe.cpp b/Tests/CMakeCommands/target_link_libraries/cmp0022/cmp0022exe.cpp new file mode 100644 index 0000000..008bb74 --- /dev/null +++ b/Tests/CMakeCommands/target_link_libraries/cmp0022/cmp0022exe.cpp @@ -0,0 +1,7 @@ + +#include "cmp0022lib.h" + +int main(void) +{ + return cmp0022().Value; +} diff --git a/Tests/CMakeCommands/target_link_libraries/cmp0022/cmp0022ifacelib.cpp b/Tests/CMakeCommands/target_link_libraries/cmp0022/cmp0022ifacelib.cpp new file mode 100644 index 0000000..b285be0 --- /dev/null +++ b/Tests/CMakeCommands/target_link_libraries/cmp0022/cmp0022ifacelib.cpp @@ -0,0 +1,9 @@ + +#include "cmp0022ifacelib.h" + +CMP0022Iface cmp0022iface() +{ + CMP0022Iface iface; + iface.Value = 0; + return iface; +} diff --git a/Tests/CMakeCommands/target_link_libraries/cmp0022/cmp0022ifacelib.h b/Tests/CMakeCommands/target_link_libraries/cmp0022/cmp0022ifacelib.h new file mode 100644 index 0000000..616dbf6 --- /dev/null +++ b/Tests/CMakeCommands/target_link_libraries/cmp0022/cmp0022ifacelib.h @@ -0,0 +1,9 @@ + +#include "cmp0022ifacelib_export.h" + +struct CMP0022Iface +{ + int Value; +}; + +CMP0022Iface CMP0022IFACELIB_EXPORT cmp0022iface(); diff --git a/Tests/CMakeCommands/target_link_libraries/cmp0022/cmp0022lib.cpp b/Tests/CMakeCommands/target_link_libraries/cmp0022/cmp0022lib.cpp new file mode 100644 index 0000000..381d463 --- /dev/null +++ b/Tests/CMakeCommands/target_link_libraries/cmp0022/cmp0022lib.cpp @@ -0,0 +1,7 @@ + +#include "cmp0022lib.h" + +CMP0022Iface cmp0022() +{ + return cmp0022iface(); +} diff --git a/Tests/CMakeCommands/target_link_libraries/cmp0022/cmp0022lib.h b/Tests/CMakeCommands/target_link_libraries/cmp0022/cmp0022lib.h new file mode 100644 index 0000000..3235b9b --- /dev/null +++ b/Tests/CMakeCommands/target_link_libraries/cmp0022/cmp0022lib.h @@ -0,0 +1,6 @@ + +#include "cmp0022lib_export.h" + +#include "cmp0022ifacelib.h" + +CMP0022Iface CMP0022LIB_EXPORT cmp0022(); diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 36cd7fd..fcefaf9 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -2528,6 +2528,16 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ --test-command IncludeDirectories) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/IncludeDirectories") + add_test(InterfaceLinkLibraries ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/InterfaceLinkLibraries" + "${CMake_BINARY_DIR}/Tests/InterfaceLinkLibraries" + --build-two-config + ${build_generator_args} + --build-project InterfaceLinkLibraries + --test-command InterfaceLinkLibraries) + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/InterfaceLinkLibraries") + if(CMAKE_USE_KWSTYLE AND KWSTYLE_EXECUTABLE) # The "make StyleCheck" command line as a test. If the test fails, look # for lines like "Error #0 (624) Line length exceed 88 (max=79)" in the diff --git a/Tests/ExportImport/Export/CMakeLists.txt b/Tests/ExportImport/Export/CMakeLists.txt index 73a4b9b..370dffe 100644 --- a/Tests/ExportImport/Export/CMakeLists.txt +++ b/Tests/ExportImport/Export/CMakeLists.txt @@ -235,6 +235,33 @@ target_link_libraries(testSharedLibDepends LINK_PUBLIC renamed_on_export) target_link_libraries(testSharedLibDepends LINK_INTERFACE_LIBRARIES $<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,EXECUTABLE>:$<TARGET_NAME:testSharedLibRequired>>) +add_library(cmp0022OLD SHARED cmp0022_vs6_1.cpp) +generate_export_header(cmp0022OLD BASE_NAME cmp0022) +target_include_directories(cmp0022OLD PUBLIC + "$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR};${CMAKE_CURRENT_SOURCE_DIR}>" + "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include/cmp0022>" +) +cmake_policy(SET CMP0022 NEW) +add_library(cmp0022NEW SHARED cmp0022_vs6_1.cpp) +target_include_directories(cmp0022NEW PUBLIC + "$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR};${CMAKE_CURRENT_SOURCE_DIR}>" + "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include/cmp0022>" +) +cmake_policy(SET CMP0022 OLD) +install(FILES + "${CMAKE_CURRENT_SOURCE_DIR}/cmp0022.h" + "${CMAKE_CURRENT_BINARY_DIR}/cmp0022_export.h" + DESTINATION include/cmp0022 +) + +set_property(TARGET testLib2 APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS USING_TESTLIB2) +set_property(TARGET testLib3 APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS USING_TESTLIB3) + +set_property(TARGET cmp0022NEW APPEND PROPERTY INTERFACE_LINK_LIBRARIES testLib2) +# set_property(TARGET cmp0022NEW APPEND PROPERTY LINK_INTERFACE_LIBRARIES testLibIncludeRequired2) # TODO: Test for error +set_property(TARGET cmp0022OLD APPEND PROPERTY INTERFACE_LINK_LIBRARIES testLib2) +set_property(TARGET cmp0022OLD APPEND PROPERTY LINK_INTERFACE_LIBRARIES testLib3) + install(TARGETS testLibRequired testLibIncludeRequired1 testLibIncludeRequired2 @@ -276,6 +303,7 @@ install( testExe2lib testLib4lib testLib4libdbg testLib4libopt testLib6 testLibCycleA testLibCycleB + cmp0022NEW cmp0022OLD EXPORT exp RUNTIME DESTINATION bin LIBRARY DESTINATION lib NAMELINK_SKIP @@ -319,6 +347,7 @@ add_subdirectory(sublib) # For CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE test. export(TARGETS testExe1 testLib1 testLib2 testLib3 testExe2libImp testLib3Imp testLib3ImpDep subdirlib testSharedLibRequired testSharedLibDepends renamed_on_export + cmp0022NEW cmp0022OLD NAMESPACE bld_ FILE ExportBuildTree.cmake ) diff --git a/Tests/ExportImport/Export/cmp0022.cpp b/Tests/ExportImport/Export/cmp0022.cpp new file mode 100644 index 0000000..bef8e61 --- /dev/null +++ b/Tests/ExportImport/Export/cmp0022.cpp @@ -0,0 +1,7 @@ + +#include "cmp0022.h" + +int cmp0022() +{ + return 0; +} diff --git a/Tests/ExportImport/Export/cmp0022.h b/Tests/ExportImport/Export/cmp0022.h new file mode 100644 index 0000000..32bf71a --- /dev/null +++ b/Tests/ExportImport/Export/cmp0022.h @@ -0,0 +1,4 @@ + +#include "cmp0022_export.h" + +int CMP0022_EXPORT cmp0022(); diff --git a/Tests/ExportImport/Export/cmp0022_vs6_1.cpp b/Tests/ExportImport/Export/cmp0022_vs6_1.cpp new file mode 100644 index 0000000..a6ec838 --- /dev/null +++ b/Tests/ExportImport/Export/cmp0022_vs6_1.cpp @@ -0,0 +1 @@ +#include "cmp0022.cpp" diff --git a/Tests/ExportImport/Export/cmp0022_vs6_2.cpp b/Tests/ExportImport/Export/cmp0022_vs6_2.cpp new file mode 100644 index 0000000..a6ec838 --- /dev/null +++ b/Tests/ExportImport/Export/cmp0022_vs6_2.cpp @@ -0,0 +1 @@ +#include "cmp0022.cpp" diff --git a/Tests/ExportImport/Import/A/CMakeLists.txt b/Tests/ExportImport/Import/A/CMakeLists.txt index 0aa47e8..aa8847b 100644 --- a/Tests/ExportImport/Import/A/CMakeLists.txt +++ b/Tests/ExportImport/Import/A/CMakeLists.txt @@ -68,6 +68,16 @@ target_link_libraries(imp_testExe1b bld_testLibCycleA ) +add_executable(cmp0022OLD_test cmp0022OLD_test_vs6_1.cpp) +target_link_libraries(cmp0022OLD_test bld_cmp0022OLD) +add_executable(cmp0022NEW_test cmp0022NEW_test_vs6_1.cpp) +target_link_libraries(cmp0022NEW_test bld_cmp0022NEW) + +add_executable(cmp0022OLD_exp_test cmp0022OLD_test_vs6_2.cpp) +target_link_libraries(cmp0022OLD_exp_test exp_cmp0022OLD) +add_executable(cmp0022NEW_exp_test cmp0022NEW_test_vs6_2.cpp) +target_link_libraries(cmp0022NEW_exp_test exp_cmp0022NEW) + # Try building a plugin to an executable imported from the build tree. add_library(imp_mod1b MODULE imp_mod1.c) target_link_libraries(imp_mod1b bld_testExe2) diff --git a/Tests/ExportImport/Import/A/cmp0022NEW_test.cpp b/Tests/ExportImport/Import/A/cmp0022NEW_test.cpp new file mode 100644 index 0000000..5878349 --- /dev/null +++ b/Tests/ExportImport/Import/A/cmp0022NEW_test.cpp @@ -0,0 +1,12 @@ + +#ifndef USING_TESTLIB2 +#error Expected USING_TESTLIB2 +#endif +#ifdef USING_TESTLIB3 +#error Unexpected USING_TESTLIB3 +#endif + +int main(void) +{ + return 0; +} diff --git a/Tests/ExportImport/Import/A/cmp0022NEW_test_vs6_1.cpp b/Tests/ExportImport/Import/A/cmp0022NEW_test_vs6_1.cpp new file mode 100644 index 0000000..033b746 --- /dev/null +++ b/Tests/ExportImport/Import/A/cmp0022NEW_test_vs6_1.cpp @@ -0,0 +1 @@ +#include "cmp0022NEW_test.cpp" diff --git a/Tests/ExportImport/Import/A/cmp0022NEW_test_vs6_2.cpp b/Tests/ExportImport/Import/A/cmp0022NEW_test_vs6_2.cpp new file mode 100644 index 0000000..033b746 --- /dev/null +++ b/Tests/ExportImport/Import/A/cmp0022NEW_test_vs6_2.cpp @@ -0,0 +1 @@ +#include "cmp0022NEW_test.cpp" diff --git a/Tests/ExportImport/Import/A/cmp0022OLD_test.cpp b/Tests/ExportImport/Import/A/cmp0022OLD_test.cpp new file mode 100644 index 0000000..e50158b --- /dev/null +++ b/Tests/ExportImport/Import/A/cmp0022OLD_test.cpp @@ -0,0 +1,12 @@ + +#ifdef USING_TESTLIB2 +#error Unexpected USING_TESTLIB2 +#endif +#ifndef USING_TESTLIB3 +#error Expected USING_TESTLIB3 +#endif + +int main(void) +{ + return 0; +} diff --git a/Tests/ExportImport/Import/A/cmp0022OLD_test_vs6_1.cpp b/Tests/ExportImport/Import/A/cmp0022OLD_test_vs6_1.cpp new file mode 100644 index 0000000..90d804c --- /dev/null +++ b/Tests/ExportImport/Import/A/cmp0022OLD_test_vs6_1.cpp @@ -0,0 +1 @@ +#include "cmp0022OLD_test.cpp" diff --git a/Tests/ExportImport/Import/A/cmp0022OLD_test_vs6_2.cpp b/Tests/ExportImport/Import/A/cmp0022OLD_test_vs6_2.cpp new file mode 100644 index 0000000..90d804c --- /dev/null +++ b/Tests/ExportImport/Import/A/cmp0022OLD_test_vs6_2.cpp @@ -0,0 +1 @@ +#include "cmp0022OLD_test.cpp" diff --git a/Tests/InterfaceLinkLibraries/CMakeLists.txt b/Tests/InterfaceLinkLibraries/CMakeLists.txt new file mode 100644 index 0000000..bd0cf74 --- /dev/null +++ b/Tests/InterfaceLinkLibraries/CMakeLists.txt @@ -0,0 +1,49 @@ +cmake_minimum_required (VERSION 2.8) + +cmake_policy(SET CMP0022 NEW) + +project(InterfaceLinkLibraries) + +add_library(foo_shared SHARED foo_vs6_1.cpp) +target_compile_definitions(foo_shared INTERFACE FOO_LIBRARY) +add_library(bar_shared SHARED bar_vs6_1.cpp) +target_compile_definitions(bar_shared INTERFACE BAR_LIBRARY) +set_property(TARGET bar_shared APPEND PROPERTY INTERFACE_LINK_LIBRARIES foo_shared) + +add_executable(shared_test main_vs6_1.cpp) +set_property(TARGET shared_test APPEND PROPERTY LINK_LIBRARIES bar_shared) + +add_library(foo_static STATIC foo_vs6_2.cpp) +target_compile_definitions(foo_static INTERFACE FOO_LIBRARY) +add_library(bar_static STATIC bar_vs6_2.cpp) +target_compile_definitions(bar_static INTERFACE BAR_LIBRARY) +set_property(TARGET bar_static APPEND PROPERTY INTERFACE_LINK_LIBRARIES foo_static) + +add_executable(static_test main_vs6_2.cpp) +set_property(TARGET static_test APPEND PROPERTY LINK_LIBRARIES bar_static) + +add_library(foo_shared_private SHARED foo_vs6_3.cpp) +target_compile_definitions(foo_shared_private INTERFACE FOO_LIBRARY) +add_library(bang_shared_private SHARED bang_vs6_1.cpp) +target_compile_definitions(bang_shared_private INTERFACE BANG_LIBRARY) +add_library(bar_shared_private SHARED bar_vs6_3.cpp) +target_compile_definitions(bar_shared_private INTERFACE BAR_LIBRARY) +target_compile_definitions(bar_shared_private PRIVATE BAR_USE_BANG) +set_property(TARGET bar_shared_private APPEND PROPERTY LINK_LIBRARIES bang_shared_private) +set_property(TARGET bar_shared_private APPEND PROPERTY INTERFACE_LINK_LIBRARIES foo_shared_private) + +add_executable(shared_private_test main_vs6_3.cpp) +set_property(TARGET shared_private_test APPEND PROPERTY LINK_LIBRARIES bar_shared_private) + +add_library(foo_static_private STATIC foo_vs6_4.cpp) +target_compile_definitions(foo_static_private INTERFACE FOO_LIBRARY) +add_library(bang_static_private STATIC bang_vs6_2.cpp) +target_compile_definitions(bang_static_private INTERFACE BANG_LIBRARY) +add_library(bar_static_private STATIC bar_vs6_4.cpp) +target_compile_definitions(bar_static_private INTERFACE BAR_LIBRARY) +target_compile_definitions(bar_static_private PRIVATE BAR_USE_BANG) +set_property(TARGET bar_static_private APPEND PROPERTY LINK_LIBRARIES bang_static_private) +set_property(TARGET bar_static_private APPEND PROPERTY INTERFACE_LINK_LIBRARIES $<LINK_ONLY:bang_static_private> foo_static_private) + +add_executable(InterfaceLinkLibraries main_vs6_4.cpp) +set_property(TARGET InterfaceLinkLibraries APPEND PROPERTY LINK_LIBRARIES bar_static_private) diff --git a/Tests/InterfaceLinkLibraries/bang.cpp b/Tests/InterfaceLinkLibraries/bang.cpp new file mode 100644 index 0000000..2e95098 --- /dev/null +++ b/Tests/InterfaceLinkLibraries/bang.cpp @@ -0,0 +1,15 @@ + +#ifdef FOO_LIBRARY +#error Unexpected FOO_LIBRARY +#endif + +#ifdef BAR_LIBRARY +#error Unexpected BAR_LIBRARY +#endif + +#include "bang.h" + +int bang() +{ + return 0; +} diff --git a/Tests/InterfaceLinkLibraries/bang.h b/Tests/InterfaceLinkLibraries/bang.h new file mode 100644 index 0000000..acffb39 --- /dev/null +++ b/Tests/InterfaceLinkLibraries/bang.h @@ -0,0 +1,4 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif +int bang(); diff --git a/Tests/InterfaceLinkLibraries/bang_vs6_1.cpp b/Tests/InterfaceLinkLibraries/bang_vs6_1.cpp new file mode 100644 index 0000000..4886861 --- /dev/null +++ b/Tests/InterfaceLinkLibraries/bang_vs6_1.cpp @@ -0,0 +1 @@ +#include "bang.cpp" diff --git a/Tests/InterfaceLinkLibraries/bang_vs6_2.cpp b/Tests/InterfaceLinkLibraries/bang_vs6_2.cpp new file mode 100644 index 0000000..4886861 --- /dev/null +++ b/Tests/InterfaceLinkLibraries/bang_vs6_2.cpp @@ -0,0 +1 @@ +#include "bang.cpp" diff --git a/Tests/InterfaceLinkLibraries/bar.cpp b/Tests/InterfaceLinkLibraries/bar.cpp new file mode 100644 index 0000000..f39bfa5 --- /dev/null +++ b/Tests/InterfaceLinkLibraries/bar.cpp @@ -0,0 +1,26 @@ + +#ifdef FOO_LIBRARY +#error Unexpected FOO_LIBRARY +#endif + +#ifdef BAR_USE_BANG +# ifndef BANG_LIBRARY +# error Expected BANG_LIBRARY +# endif +# include "bang.h" +#else +# ifdef BANG_LIBRARY +# error Unexpected BANG_LIBRARY +# endif +#endif + +#include "bar.h" + +int bar() +{ +#ifdef BAR_USE_BANG + return bang(); +#else + return 0; +#endif +} diff --git a/Tests/InterfaceLinkLibraries/bar.h b/Tests/InterfaceLinkLibraries/bar.h new file mode 100644 index 0000000..f83b37e --- /dev/null +++ b/Tests/InterfaceLinkLibraries/bar.h @@ -0,0 +1,7 @@ + +#include "foo.h" + +#ifdef _WIN32 +__declspec(dllexport) +#endif +int bar(); diff --git a/Tests/InterfaceLinkLibraries/bar_vs6_1.cpp b/Tests/InterfaceLinkLibraries/bar_vs6_1.cpp new file mode 100644 index 0000000..58a04c4 --- /dev/null +++ b/Tests/InterfaceLinkLibraries/bar_vs6_1.cpp @@ -0,0 +1 @@ +#include "bar.cpp" diff --git a/Tests/InterfaceLinkLibraries/bar_vs6_2.cpp b/Tests/InterfaceLinkLibraries/bar_vs6_2.cpp new file mode 100644 index 0000000..58a04c4 --- /dev/null +++ b/Tests/InterfaceLinkLibraries/bar_vs6_2.cpp @@ -0,0 +1 @@ +#include "bar.cpp" diff --git a/Tests/InterfaceLinkLibraries/bar_vs6_3.cpp b/Tests/InterfaceLinkLibraries/bar_vs6_3.cpp new file mode 100644 index 0000000..58a04c4 --- /dev/null +++ b/Tests/InterfaceLinkLibraries/bar_vs6_3.cpp @@ -0,0 +1 @@ +#include "bar.cpp" diff --git a/Tests/InterfaceLinkLibraries/bar_vs6_4.cpp b/Tests/InterfaceLinkLibraries/bar_vs6_4.cpp new file mode 100644 index 0000000..58a04c4 --- /dev/null +++ b/Tests/InterfaceLinkLibraries/bar_vs6_4.cpp @@ -0,0 +1 @@ +#include "bar.cpp" diff --git a/Tests/InterfaceLinkLibraries/foo.cpp b/Tests/InterfaceLinkLibraries/foo.cpp new file mode 100644 index 0000000..5295707 --- /dev/null +++ b/Tests/InterfaceLinkLibraries/foo.cpp @@ -0,0 +1,15 @@ + +#ifdef BAR_LIBRARY +#error Unexpected BAR_LIBRARY +#endif + +#ifdef BANG_LIBRARY +#error Unexpected BANG_LIBRARY +#endif + +#include "foo.h" + +int foo() +{ + return 0; +} diff --git a/Tests/InterfaceLinkLibraries/foo.h b/Tests/InterfaceLinkLibraries/foo.h new file mode 100644 index 0000000..e12e23c --- /dev/null +++ b/Tests/InterfaceLinkLibraries/foo.h @@ -0,0 +1,4 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif +int foo(); diff --git a/Tests/InterfaceLinkLibraries/foo_vs6_1.cpp b/Tests/InterfaceLinkLibraries/foo_vs6_1.cpp new file mode 100644 index 0000000..d2e5e52 --- /dev/null +++ b/Tests/InterfaceLinkLibraries/foo_vs6_1.cpp @@ -0,0 +1 @@ +#include "foo.cpp" diff --git a/Tests/InterfaceLinkLibraries/foo_vs6_2.cpp b/Tests/InterfaceLinkLibraries/foo_vs6_2.cpp new file mode 100644 index 0000000..d2e5e52 --- /dev/null +++ b/Tests/InterfaceLinkLibraries/foo_vs6_2.cpp @@ -0,0 +1 @@ +#include "foo.cpp" diff --git a/Tests/InterfaceLinkLibraries/foo_vs6_3.cpp b/Tests/InterfaceLinkLibraries/foo_vs6_3.cpp new file mode 100644 index 0000000..d2e5e52 --- /dev/null +++ b/Tests/InterfaceLinkLibraries/foo_vs6_3.cpp @@ -0,0 +1 @@ +#include "foo.cpp" diff --git a/Tests/InterfaceLinkLibraries/foo_vs6_4.cpp b/Tests/InterfaceLinkLibraries/foo_vs6_4.cpp new file mode 100644 index 0000000..d2e5e52 --- /dev/null +++ b/Tests/InterfaceLinkLibraries/foo_vs6_4.cpp @@ -0,0 +1 @@ +#include "foo.cpp" diff --git a/Tests/InterfaceLinkLibraries/main.cpp b/Tests/InterfaceLinkLibraries/main.cpp new file mode 100644 index 0000000..a54076a --- /dev/null +++ b/Tests/InterfaceLinkLibraries/main.cpp @@ -0,0 +1,19 @@ + +#ifndef FOO_LIBRARY +#error Expected FOO_LIBRARY +#endif + +#ifndef BAR_LIBRARY +#error Expected BAR_LIBRARY +#endif + +#ifdef BANG_LIBRARY +#error Unexpected BANG_LIBRARY +#endif + +#include "bar.h" + +int main(void) +{ + return foo() + bar(); +} diff --git a/Tests/InterfaceLinkLibraries/main_vs6_1.cpp b/Tests/InterfaceLinkLibraries/main_vs6_1.cpp new file mode 100644 index 0000000..9b10ef2 --- /dev/null +++ b/Tests/InterfaceLinkLibraries/main_vs6_1.cpp @@ -0,0 +1 @@ +#include "main.cpp" diff --git a/Tests/InterfaceLinkLibraries/main_vs6_2.cpp b/Tests/InterfaceLinkLibraries/main_vs6_2.cpp new file mode 100644 index 0000000..9b10ef2 --- /dev/null +++ b/Tests/InterfaceLinkLibraries/main_vs6_2.cpp @@ -0,0 +1 @@ +#include "main.cpp" diff --git a/Tests/InterfaceLinkLibraries/main_vs6_3.cpp b/Tests/InterfaceLinkLibraries/main_vs6_3.cpp new file mode 100644 index 0000000..9b10ef2 --- /dev/null +++ b/Tests/InterfaceLinkLibraries/main_vs6_3.cpp @@ -0,0 +1 @@ +#include "main.cpp" diff --git a/Tests/InterfaceLinkLibraries/main_vs6_4.cpp b/Tests/InterfaceLinkLibraries/main_vs6_4.cpp new file mode 100644 index 0000000..9b10ef2 --- /dev/null +++ b/Tests/InterfaceLinkLibraries/main_vs6_4.cpp @@ -0,0 +1 @@ +#include "main.cpp" diff --git a/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-link_libraries-stderr.txt b/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-link_libraries-stderr.txt new file mode 100644 index 0000000..10f3293 --- /dev/null +++ b/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-link_libraries-stderr.txt @@ -0,0 +1 @@ +^$ diff --git a/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-link_libraries.cmake b/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-link_libraries.cmake new file mode 100644 index 0000000..42c4084 --- /dev/null +++ b/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-link_libraries.cmake @@ -0,0 +1,9 @@ + +enable_language(CXX) + +add_subdirectory(dep1) +add_subdirectory(dep2) +add_subdirectory(dep3) + +add_library(somelib empty.cpp) +target_link_libraries(somelib dep3) diff --git a/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-stderr.txt b/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-stderr.txt new file mode 100644 index 0000000..10f3293 --- /dev/null +++ b/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-stderr.txt @@ -0,0 +1 @@ +^$ diff --git a/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static.cmake b/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static.cmake new file mode 100644 index 0000000..3e4144f --- /dev/null +++ b/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static.cmake @@ -0,0 +1,8 @@ + +project(CMP0022-NOWARN-static) + +add_library(foo STATIC empty_vs6_1.cpp) +add_library(bar STATIC empty_vs6_2.cpp) +add_library(bat STATIC empty_vs6_3.cpp) +target_link_libraries(foo bar) +target_link_libraries(bar bat) diff --git a/Tests/RunCMake/CMP0022/CMP0022-WARN-static-result.txt b/Tests/RunCMake/CMP0022/CMP0022-WARN-static-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CMP0022/CMP0022-WARN-static-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CMP0022/CMP0022-WARN-static-stderr.txt b/Tests/RunCMake/CMP0022/CMP0022-WARN-static-stderr.txt new file mode 100644 index 0000000..41d132c --- /dev/null +++ b/Tests/RunCMake/CMP0022/CMP0022-WARN-static-stderr.txt @@ -0,0 +1,10 @@ +CMake Warning \(dev\) in CMakeLists.txt: + Policy CMP0022 is not set: INTERFACE_LINK_LIBRARIES defines the link + interface. Run "cmake --help-policy CMP0022" for policy details. Use the + cmake_policy command to set the policy and suppress this warning. + + Static library target "bar" has a INTERFACE_LINK_LIBRARIES property. This + should be preferred as the source of the link interface for this library. + Ignoring the property and using the link implementation as the link + interface instead. +This warning is for project developers. Use -Wno-dev to suppress it.$ diff --git a/Tests/RunCMake/CMP0022/CMP0022-WARN-static.cmake b/Tests/RunCMake/CMP0022/CMP0022-WARN-static.cmake new file mode 100644 index 0000000..b3cb131 --- /dev/null +++ b/Tests/RunCMake/CMP0022/CMP0022-WARN-static.cmake @@ -0,0 +1,11 @@ + +project(CMP0022-WARN) + +add_library(foo STATIC empty_vs6_1.cpp) +add_library(bar STATIC empty_vs6_2.cpp) +add_library(bat STATIC empty_vs6_3.cpp) +set_property(TARGET bar PROPERTY INTERFACE_LINK_LIBRARIES foo) +set_property(TARGET bar PROPERTY LINK_LIBRARIES bat) + +add_library(user empty.cpp) +target_link_libraries(user bar) diff --git a/Tests/RunCMake/CMP0022/CMP0022-WARN-stderr.txt b/Tests/RunCMake/CMP0022/CMP0022-WARN-stderr.txt new file mode 100644 index 0000000..29103c9 --- /dev/null +++ b/Tests/RunCMake/CMP0022/CMP0022-WARN-stderr.txt @@ -0,0 +1,8 @@ +CMake Warning \(dev\) in CMakeLists.txt: + Policy CMP0022 is not set: INTERFACE_LINK_LIBRARIES defines the link + interface. Run "cmake --help-policy CMP0022" for policy details. Use the + cmake_policy command to set the policy and suppress this warning. + + Target "bar" has a INTERFACE_LINK_LIBRARIES property which differs from its + LINK_INTERFACE_LIBRARIES properties. +This warning is for project developers. Use -Wno-dev to suppress it.$ diff --git a/Tests/RunCMake/CMP0022/CMP0022-WARN-tll-result.txt b/Tests/RunCMake/CMP0022/CMP0022-WARN-tll-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CMP0022/CMP0022-WARN-tll-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CMP0022/CMP0022-WARN-tll-stderr.txt b/Tests/RunCMake/CMP0022/CMP0022-WARN-tll-stderr.txt new file mode 100644 index 0000000..5a5ad27 --- /dev/null +++ b/Tests/RunCMake/CMP0022/CMP0022-WARN-tll-stderr.txt @@ -0,0 +1,8 @@ +CMake Warning \(dev\) in CMakeLists.txt: + Policy CMP0022 is not set: INTERFACE_LINK_LIBRARIES defines the link + interface. Run "cmake --help-policy CMP0022" for policy details. Use the + cmake_policy command to set the policy and suppress this warning. + + Target "bar" has a INTERFACE_LINK_LIBRARIES property which differs from its + LINK_INTERFACE_LIBRARIES properties. +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CMP0022/CMP0022-WARN-tll.cmake b/Tests/RunCMake/CMP0022/CMP0022-WARN-tll.cmake new file mode 100644 index 0000000..11b4e22 --- /dev/null +++ b/Tests/RunCMake/CMP0022/CMP0022-WARN-tll.cmake @@ -0,0 +1,11 @@ + +project(CMP0022-WARN-tll) + +add_library(foo SHARED empty_vs6_1.cpp) +add_library(bar SHARED empty_vs6_2.cpp) +add_library(bat SHARED empty_vs6_3.cpp) +target_link_libraries(bar LINK_PUBLIC foo) +set_property(TARGET bar PROPERTY LINK_INTERFACE_LIBRARIES bat) + +add_library(user SHARED empty.cpp) +target_link_libraries(user bar) diff --git a/Tests/RunCMake/CMP0022/CMP0022-WARN.cmake b/Tests/RunCMake/CMP0022/CMP0022-WARN.cmake new file mode 100644 index 0000000..24b7f45 --- /dev/null +++ b/Tests/RunCMake/CMP0022/CMP0022-WARN.cmake @@ -0,0 +1,11 @@ + +project(CMP0022-WARN) + +add_library(foo SHARED empty_vs6_1.cpp) +add_library(bar SHARED empty_vs6_2.cpp) +add_library(bat SHARED empty_vs6_3.cpp) +set_property(TARGET bar PROPERTY INTERFACE_LINK_LIBRARIES foo) +set_property(TARGET bar PROPERTY LINK_INTERFACE_LIBRARIES bat) + +add_library(user empty.cpp) +target_link_libraries(user bar) diff --git a/Tests/RunCMake/CMP0022/CMP0022-export-result.txt b/Tests/RunCMake/CMP0022/CMP0022-export-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMP0022/CMP0022-export-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0022/CMP0022-export-stderr.txt b/Tests/RunCMake/CMP0022/CMP0022-export-stderr.txt new file mode 100644 index 0000000..6c29057 --- /dev/null +++ b/Tests/RunCMake/CMP0022/CMP0022-export-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at CMP0022-export.cmake:11 \(export\): + Target "cmp0022NEW" has policy CMP0022 enabled, but also has old-style + INTERFACE_LINK_LIBRARIES properties populated, but it was exported without + the EXPORT_LINK_INTERFACE_LIBRARIES to export the old-style properties diff --git a/Tests/RunCMake/CMP0022/CMP0022-export.cmake b/Tests/RunCMake/CMP0022/CMP0022-export.cmake new file mode 100644 index 0000000..06147f3 --- /dev/null +++ b/Tests/RunCMake/CMP0022/CMP0022-export.cmake @@ -0,0 +1,11 @@ + +project(cmp0022NEW) + +cmake_policy(SET CMP0022 NEW) + +add_library(cmp0022NEW SHARED empty_vs6_1.cpp) +add_library(testLib SHARED empty_vs6_2.cpp) + +set_property(TARGET cmp0022NEW APPEND PROPERTY LINK_INTERFACE_LIBRARIES testLib) + +export(TARGETS cmp0022NEW testLib FILE "${CMAKE_CURRENT_BINARY_DIR}/cmp0022NEW.cmake") diff --git a/Tests/RunCMake/CMP0022/CMP0022-install-export-result.txt b/Tests/RunCMake/CMP0022/CMP0022-install-export-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMP0022/CMP0022-install-export-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0022/CMP0022-install-export-stderr.txt b/Tests/RunCMake/CMP0022/CMP0022-install-export-stderr.txt new file mode 100644 index 0000000..3425e8e --- /dev/null +++ b/Tests/RunCMake/CMP0022/CMP0022-install-export-stderr.txt @@ -0,0 +1,4 @@ +CMake Error in CMakeLists.txt: + Target "cmp0022NEW" has policy CMP0022 enabled, but also has old-style + INTERFACE_LINK_LIBRARIES properties populated, but it was exported without + the EXPORT_LINK_INTERFACE_LIBRARIES to export the old-style properties diff --git a/Tests/RunCMake/CMP0022/CMP0022-install-export.cmake b/Tests/RunCMake/CMP0022/CMP0022-install-export.cmake new file mode 100644 index 0000000..171febe --- /dev/null +++ b/Tests/RunCMake/CMP0022/CMP0022-install-export.cmake @@ -0,0 +1,12 @@ + +project(cmp0022NEW) + +cmake_policy(SET CMP0022 NEW) + +add_library(cmp0022NEW SHARED empty_vs6_1.cpp) +add_library(testLib SHARED empty_vs6_2.cpp) + +set_property(TARGET cmp0022NEW APPEND PROPERTY LINK_INTERFACE_LIBRARIES testLib) + +install(TARGETS cmp0022NEW testLib EXPORT exp DESTINATION lib) +install(EXPORT exp FILE expTargets.cmake DESTINATION lib/cmake/exp) diff --git a/Tests/RunCMake/CMP0022/CMakeLists.txt b/Tests/RunCMake/CMP0022/CMakeLists.txt new file mode 100644 index 0000000..72abfc8 --- /dev/null +++ b/Tests/RunCMake/CMP0022/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8.11) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CMP0022/RunCMakeTest.cmake b/Tests/RunCMake/CMP0022/RunCMakeTest.cmake new file mode 100644 index 0000000..dcef0f5 --- /dev/null +++ b/Tests/RunCMake/CMP0022/RunCMakeTest.cmake @@ -0,0 +1,9 @@ +include(RunCMake) + +run_cmake(CMP0022-WARN) +run_cmake(CMP0022-WARN-tll) +run_cmake(CMP0022-WARN-static) +run_cmake(CMP0022-NOWARN-static) +run_cmake(CMP0022-NOWARN-static-link_libraries) +run_cmake(CMP0022-export) +run_cmake(CMP0022-install-export) diff --git a/Tests/RunCMake/CMP0022/dep1/CMakeLists.txt b/Tests/RunCMake/CMP0022/dep1/CMakeLists.txt new file mode 100644 index 0000000..f0a8179 --- /dev/null +++ b/Tests/RunCMake/CMP0022/dep1/CMakeLists.txt @@ -0,0 +1,2 @@ + +add_library(dep1 ../empty_vs6_1.cpp) diff --git a/Tests/RunCMake/CMP0022/dep2/CMakeLists.txt b/Tests/RunCMake/CMP0022/dep2/CMakeLists.txt new file mode 100644 index 0000000..4f90162 --- /dev/null +++ b/Tests/RunCMake/CMP0022/dep2/CMakeLists.txt @@ -0,0 +1,2 @@ + +add_library(dep2 ../empty_vs6_2.cpp) diff --git a/Tests/RunCMake/CMP0022/dep3/CMakeLists.txt b/Tests/RunCMake/CMP0022/dep3/CMakeLists.txt new file mode 100644 index 0000000..e85cb54 --- /dev/null +++ b/Tests/RunCMake/CMP0022/dep3/CMakeLists.txt @@ -0,0 +1,5 @@ + +link_libraries(dep1) + +add_library(dep3 ../empty_vs6_3.cpp) +target_link_libraries(dep3 dep2) diff --git a/Tests/RunCMake/CMP0022/empty.cpp b/Tests/RunCMake/CMP0022/empty.cpp new file mode 100644 index 0000000..bfbbdde --- /dev/null +++ b/Tests/RunCMake/CMP0022/empty.cpp @@ -0,0 +1,7 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif +int empty() +{ + return 0; +} diff --git a/Tests/RunCMake/CMP0022/empty_vs6_1.cpp b/Tests/RunCMake/CMP0022/empty_vs6_1.cpp new file mode 100644 index 0000000..7efedab --- /dev/null +++ b/Tests/RunCMake/CMP0022/empty_vs6_1.cpp @@ -0,0 +1 @@ +#include "empty.cpp" diff --git a/Tests/RunCMake/CMP0022/empty_vs6_2.cpp b/Tests/RunCMake/CMP0022/empty_vs6_2.cpp new file mode 100644 index 0000000..7efedab --- /dev/null +++ b/Tests/RunCMake/CMP0022/empty_vs6_2.cpp @@ -0,0 +1 @@ +#include "empty.cpp" diff --git a/Tests/RunCMake/CMP0022/empty_vs6_3.cpp b/Tests/RunCMake/CMP0022/empty_vs6_3.cpp new file mode 100644 index 0000000..7efedab --- /dev/null +++ b/Tests/RunCMake/CMP0022/empty_vs6_3.cpp @@ -0,0 +1 @@ +#include "empty.cpp" diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index e049854..75e0e28 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -52,6 +52,7 @@ if(XCODE_VERSION AND "${XCODE_VERSION}" VERSION_LESS 3) endif() add_RunCMake_test(CMP0019) +add_RunCMake_test(CMP0022) add_RunCMake_test(CTest) if(UNIX AND "${CMAKE_TEST_GENERATOR}" MATCHES "Unix Makefiles") add_RunCMake_test(CompilerChange) |