diff options
author | Stephen Kelly <steveire@gmail.com> | 2013-06-04 14:21:33 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2013-07-08 20:39:58 (GMT) |
commit | 3e30d9ed67f963af15b8d57d24a5fa377299e43a (patch) | |
tree | 236bab91fe19846f4eedba92f93c09a1b920909c /Tests/CMakeCommands | |
parent | 574fec97fd011ea2899abdd05d97ea66f0faa063 (diff) | |
download | CMake-3e30d9ed67f963af15b8d57d24a5fa377299e43a.zip CMake-3e30d9ed67f963af15b8d57d24a5fa377299e43a.tar.gz CMake-3e30d9ed67f963af15b8d57d24a5fa377299e43a.tar.bz2 |
TLL: Don't populate old link interface if CMP0022 is NEW.
Always populate the INTERFACE_LINK_LIBRARIES for interface
entries. Don't populate the old interface properties
matching (IMPORTED_)?LINK_INTERFACE_LIBRARIES(_<CONFIG>)?
if CMP0022 is NEW.
Because the INTERFACE_LINK_LIBRARIES property is now populated by
the target_link_libraries when operating on a static library,
make an equivalent change which populates the property with
the same value when the old link_libraries() command is used. This
silences the policy warning in that case.
Diffstat (limited to 'Tests/CMakeCommands')
7 files changed, 58 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(); |