|
|
@@ -1,5 +1,5 @@
|
|
|
set(CMAKE_EXPERIMENTAL_EXPORT_PACKAGE_DEPENDENCIES "1942b4fa-b2c5-4546-9385-83f254070067")
|
|
|
-cmake_minimum_required(VERSION 2.8.11) # old enough to not set CMP0022
|
|
|
+cmake_minimum_required(VERSION 3.10)
|
|
|
if(POLICY CMP0129)
|
|
|
cmake_policy(SET CMP0129 NEW)
|
|
|
endif()
|
|
|
@@ -22,10 +22,9 @@ add_library(testExe2libImp SHARED testExe2libImp.c)
|
|
|
set_property(TARGET testExe2libImp PROPERTY LIBRARY_OUTPUT_DIRECTORY impl)
|
|
|
add_library(testExe2lib SHARED testExe2lib.c)
|
|
|
target_link_libraries(testExe2lib testExe2libImp)
|
|
|
-set_property(TARGET testExe2lib PROPERTY LINK_INTERFACE_LIBRARIES "")
|
|
|
add_executable(testExe2 testExe2.c)
|
|
|
set_property(TARGET testExe2 PROPERTY ENABLE_EXPORTS 1)
|
|
|
-set_property(TARGET testExe2 PROPERTY LINK_INTERFACE_LIBRARIES testExe2lib)
|
|
|
+set_property(TARGET testExe2 PROPERTY INTERFACE_LINK_LIBRARIES testExe2lib)
|
|
|
|
|
|
add_library(compileOnly INTERFACE)
|
|
|
target_compile_definitions(compileOnly INTERFACE FROM_compileOnly)
|
|
|
@@ -36,7 +35,6 @@ target_link_libraries(noUses INTERFACE this::target_does_not_exist)
|
|
|
|
|
|
add_library(testLib1 STATIC testLib1.c)
|
|
|
add_library(testLib2 STATIC testLib2.c)
|
|
|
-target_link_libraries(testLib2 testLib1)
|
|
|
target_link_libraries(testLib2
|
|
|
PRIVATE
|
|
|
testLib1
|
|
|
@@ -68,7 +66,6 @@ set_property(TARGET testLib3Imp PROPERTY LIBRARY_OUTPUT_DIRECTORY impl)
|
|
|
target_link_libraries(testLib3Imp testLib3ImpDep)
|
|
|
add_library(testLib3 SHARED testLib3.c)
|
|
|
target_link_libraries(testLib3 testLib3Imp)
|
|
|
-set_property(TARGET testLib3 PROPERTY LINK_INTERFACE_LIBRARIES "")
|
|
|
set_property(TARGET testLib3 PROPERTY VERSION 1.2)
|
|
|
set_property(TARGET testLib3 PROPERTY SOVERSION 3)
|
|
|
|
|
|
@@ -108,8 +105,6 @@ else()
|
|
|
set(maybe_OBJECTS_DESTINATION "")
|
|
|
endif()
|
|
|
|
|
|
-cmake_policy(PUSH)
|
|
|
-cmake_policy(SET CMP0022 NEW)
|
|
|
add_library(testLib9ObjPub OBJECT testLib9ObjPub.c)
|
|
|
target_compile_definitions(testLib9ObjPub INTERFACE testLib9ObjPub_USED)
|
|
|
add_library(testLib9ObjPriv OBJECT testLib9ObjPriv.c)
|
|
|
@@ -119,41 +114,37 @@ target_compile_definitions(testLib9ObjIface INTERFACE testLib9ObjIface_USED)
|
|
|
add_library(testLib9 STATIC testLib9.c)
|
|
|
target_link_libraries(testLib9 INTERFACE testLib9ObjIface PUBLIC testLib9ObjPub PRIVATE testLib9ObjPriv)
|
|
|
target_link_libraries(testLib9 PUBLIC Foo::Foo)
|
|
|
-cmake_policy(POP)
|
|
|
|
|
|
-block()
|
|
|
- cmake_policy(SET CMP0022 NEW)
|
|
|
- add_library(testLib10 STATIC testLib10.c)
|
|
|
- set_target_properties(testLib10 PROPERTIES
|
|
|
- TRANSITIVE_COMPILE_PROPERTIES "CUSTOM_C"
|
|
|
- TRANSITIVE_LINK_PROPERTIES "CUSTOM_L"
|
|
|
- INTERFACE_CUSTOM_C "TESTLIB10_INTERFACE_CUSTOM_C"
|
|
|
- INTERFACE_CUSTOM_L "TESTLIB10_INTERFACE_CUSTOM_L"
|
|
|
- )
|
|
|
- target_compile_definitions(testLib10 INTERFACE
|
|
|
- "$<TARGET_PROPERTY:CUSTOM_C>"
|
|
|
- "$<TARGET_PROPERTY:CUSTOM_L>"
|
|
|
- )
|
|
|
- add_library(testLib11 STATIC testLib11.c)
|
|
|
- target_link_libraries(testLib11 PRIVATE testLib10)
|
|
|
- set_target_properties(testLib11 PROPERTIES
|
|
|
- INTERFACE_CUSTOM_C "TESTLIB11_INTERFACE_CUSTOM_C"
|
|
|
- INTERFACE_CUSTOM_L "TESTLIB11_INTERFACE_CUSTOM_L"
|
|
|
- TRANSITIVE_COMPILE_PROPERTIES "CUSTOM_D"
|
|
|
- TRANSITIVE_LINK_PROPERTIES "CUSTOM_M"
|
|
|
- INTERFACE_CUSTOM_D "TESTLIB11_INTERFACE_CUSTOM_D"
|
|
|
- INTERFACE_CUSTOM_M "TESTLIB11_INTERFACE_CUSTOM_M"
|
|
|
- )
|
|
|
- target_compile_definitions(testLib11 INTERFACE
|
|
|
- "$<TARGET_PROPERTY:CUSTOM_C>"
|
|
|
- "$<TARGET_PROPERTY:CUSTOM_D>"
|
|
|
- "$<TARGET_PROPERTY:CUSTOM_L>"
|
|
|
- "$<TARGET_PROPERTY:CUSTOM_M>"
|
|
|
- )
|
|
|
-endblock()
|
|
|
+add_library(testLib10 STATIC testLib10.c)
|
|
|
+set_target_properties(testLib10 PROPERTIES
|
|
|
+ TRANSITIVE_COMPILE_PROPERTIES "CUSTOM_C"
|
|
|
+ TRANSITIVE_LINK_PROPERTIES "CUSTOM_L"
|
|
|
+ INTERFACE_CUSTOM_C "TESTLIB10_INTERFACE_CUSTOM_C"
|
|
|
+ INTERFACE_CUSTOM_L "TESTLIB10_INTERFACE_CUSTOM_L"
|
|
|
+ )
|
|
|
+target_compile_definitions(testLib10 INTERFACE
|
|
|
+ "$<TARGET_PROPERTY:CUSTOM_C>"
|
|
|
+ "$<TARGET_PROPERTY:CUSTOM_L>"
|
|
|
+ )
|
|
|
+add_library(testLib11 STATIC testLib11.c)
|
|
|
+target_link_libraries(testLib11 PRIVATE testLib10)
|
|
|
+set_target_properties(testLib11 PROPERTIES
|
|
|
+ INTERFACE_CUSTOM_C "TESTLIB11_INTERFACE_CUSTOM_C"
|
|
|
+ INTERFACE_CUSTOM_L "TESTLIB11_INTERFACE_CUSTOM_L"
|
|
|
+ TRANSITIVE_COMPILE_PROPERTIES "CUSTOM_D"
|
|
|
+ TRANSITIVE_LINK_PROPERTIES "CUSTOM_M"
|
|
|
+ INTERFACE_CUSTOM_D "TESTLIB11_INTERFACE_CUSTOM_D"
|
|
|
+ INTERFACE_CUSTOM_M "TESTLIB11_INTERFACE_CUSTOM_M"
|
|
|
+ )
|
|
|
+target_compile_definitions(testLib11 INTERFACE
|
|
|
+ "$<TARGET_PROPERTY:CUSTOM_C>"
|
|
|
+ "$<TARGET_PROPERTY:CUSTOM_D>"
|
|
|
+ "$<TARGET_PROPERTY:CUSTOM_L>"
|
|
|
+ "$<TARGET_PROPERTY:CUSTOM_M>"
|
|
|
+ )
|
|
|
|
|
|
# Test using the target_link_libraries command to set the
|
|
|
-# LINK_INTERFACE_LIBRARIES* properties. We construct two libraries
|
|
|
+# INTERFACE_LINK_LIBRARIES properties. We construct two libraries
|
|
|
# providing the same two symbols. In each library one of the symbols
|
|
|
# will work and the other one will fail to link. The import part of
|
|
|
# this test will try to use the symbol corresponding to the
|
|
|
@@ -166,7 +157,7 @@ set_property(TARGET testLib4libdbg PROPERTY COMPILE_DEFINITIONS LIB_DBG)
|
|
|
set_property(TARGET testLib4libopt PROPERTY COMPILE_DEFINITIONS LIB_OPT)
|
|
|
target_link_libraries(testLib4
|
|
|
LINK_INTERFACE_LIBRARIES
|
|
|
- testLib4lib debug testLib4libdbg optimized testLib4libopt
|
|
|
+ testLib4lib debug $<TARGET_NAME:testLib4libdbg> optimized $<TARGET_NAME:testLib4libopt>
|
|
|
)
|
|
|
|
|
|
add_executable(testExe3 testExe3.c)
|
|
|
@@ -219,9 +210,6 @@ install(
|
|
|
DESTINATION include/testInterfaceIncludeUser
|
|
|
)
|
|
|
|
|
|
-cmake_policy(PUSH)
|
|
|
-cmake_policy(SET CMP0022 NEW)
|
|
|
-
|
|
|
# Test control over direct linking.
|
|
|
include(../../InterfaceLinkLibrariesDirect/testStaticLibPlugin.cmake)
|
|
|
include(../../InterfaceLinkLibrariesDirect/testSharedLibWithHelper.cmake)
|
|
|
@@ -237,10 +225,8 @@ add_library(testLibDepends testLibDepends.c)
|
|
|
target_link_libraries(testLibDepends LINK_PUBLIC testLibRequired)
|
|
|
add_library(testStaticLibRequiredPrivate testStaticLibRequiredPrivate.c)
|
|
|
target_link_libraries(testLibDepends PRIVATE testStaticLibRequiredPrivate)
|
|
|
-cmake_policy(POP)
|
|
|
|
|
|
cmake_policy(PUSH)
|
|
|
-cmake_policy(SET CMP0022 NEW)
|
|
|
cmake_policy(SET CMP0079 NEW)
|
|
|
add_library(TopDirLib STATIC testTopDirLib.c)
|
|
|
add_subdirectory(SubDirLinkA)
|
|
|
@@ -387,8 +373,6 @@ install(FILES
|
|
|
DESTINATION include/testSharedLibRequiredUser
|
|
|
)
|
|
|
|
|
|
-cmake_policy(PUSH)
|
|
|
-cmake_policy(SET CMP0022 NEW)
|
|
|
add_library(testSharedLibRequiredUser2 SHARED testSharedLibRequiredUser2.cpp)
|
|
|
generate_export_header(testSharedLibRequiredUser2)
|
|
|
set_property(TARGET testSharedLibRequiredUser2 APPEND PROPERTY
|
|
|
@@ -401,7 +385,6 @@ install(FILES
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/testsharedlibrequireduser2_export.h"
|
|
|
DESTINATION include/testSharedLibRequiredUser2
|
|
|
)
|
|
|
-cmake_policy(POP)
|
|
|
|
|
|
cmake_policy(PUSH)
|
|
|
cmake_policy(SET CMP0041 NEW)
|
|
|
@@ -426,28 +409,17 @@ set_property(TARGET testSharedLibDepends APPEND PROPERTY
|
|
|
)
|
|
|
cmake_policy(POP)
|
|
|
|
|
|
-# LINK_PRIVATE because the LINK_INTERFACE_LIBRARIES is specified above.
|
|
|
target_link_libraries(testSharedLibDepends LINK_PRIVATE testSharedLibRequired)
|
|
|
target_link_libraries(testSharedLibDepends LINK_PUBLIC renamed_on_export)
|
|
|
-target_link_libraries(testSharedLibDepends LINK_INTERFACE_LIBRARIES
|
|
|
+target_link_libraries(testSharedLibDepends INTERFACE
|
|
|
$<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,EXECUTABLE>:$<TARGET_NAME:testSharedLibRequired>>)
|
|
|
|
|
|
-cmake_policy(PUSH)
|
|
|
-cmake_policy(SET CMP0022 OLD)
|
|
|
-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)
|
|
|
-set_property(TARGET cmp0022NEW PROPERTY DEFINE_SYMBOL cmp0022OLD_EXPORTS)
|
|
|
+generate_export_header(cmp0022NEW BASE_NAME cmp0022)
|
|
|
target_include_directories(cmp0022NEW PUBLIC
|
|
|
"$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR};${CMAKE_CURRENT_SOURCE_DIR}>"
|
|
|
"$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include/cmp0022>"
|
|
|
)
|
|
|
-cmake_policy(POP)
|
|
|
install(FILES
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/cmp0022.h"
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/cmp0022_export.h"
|
|
|
@@ -466,9 +438,6 @@ set_property(TARGET testLib4 PROPERTY
|
|
|
EXPORT_PROPERTIES EXPORTED_PROPERTY2 EXPORTED_PROPERTY3)
|
|
|
|
|
|
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)
|
|
|
|
|
|
add_library(noIncludesInterface empty.cpp)
|
|
|
|
|
|
@@ -622,7 +591,7 @@ install(
|
|
|
testSharedLibWithHelper testSharedLibHelperObj
|
|
|
testExeWithPluginHelper testExePluginHelperObj
|
|
|
testMod1 testMod2
|
|
|
- cmp0022NEW cmp0022OLD
|
|
|
+ cmp0022NEW
|
|
|
TopDirLib SubDirLinkA
|
|
|
systemlib
|
|
|
testInterfaceIncludeUser
|
|
|
@@ -684,7 +653,7 @@ export(TARGETS testExe1 testLib1 testLib2 testLib3
|
|
|
testExe2libImp testLib3Imp testLib3ImpDep subdirlib
|
|
|
testSharedLibRequired testSharedLibRequiredUser testSharedLibRequiredUser2
|
|
|
testSharedLibDepends renamed_on_export
|
|
|
- cmp0022NEW cmp0022OLD
|
|
|
+ cmp0022NEW
|
|
|
TopDirLib SubDirLinkA
|
|
|
systemlib noUses
|
|
|
testInterfaceIncludeUser
|