summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-10-15 17:03:31 (GMT)
committerBrad King <brad.king@kitware.com>2021-10-15 17:04:19 (GMT)
commit14d98bcfe6fa1dd2f4220e50e99ec099939496d5 (patch)
tree98137c1b2c2d5b92caca0dff5d03a67e5998e5e1 /Tests
parent7df0541055167d556d866000f8da4b0e7f186b92 (diff)
downloadCMake-14d98bcfe6fa1dd2f4220e50e99ec099939496d5.zip
CMake-14d98bcfe6fa1dd2f4220e50e99ec099939496d5.tar.gz
CMake-14d98bcfe6fa1dd2f4220e50e99ec099939496d5.tar.bz2
export: Propagate IMPORTED_NO_SYSTEM target property to consumers
Enabling `IMPORTED_NO_SYSTEM` on a target built within the project has no effect on the build system, but it is still a useful way to set the property on imported targets generated by `install(EXPORT)` and `export()`. Issue: #17364
Diffstat (limited to 'Tests')
-rw-r--r--Tests/ExportImport/Export/CMakeLists.txt15
-rw-r--r--Tests/ExportImport/Export/include/testInterfaceIncludeUser/testInterfaceInclude.h1
-rw-r--r--Tests/ExportImport/Import/A/CMakeLists.txt8
-rw-r--r--Tests/ExportImport/Import/A/imp_testInterfaceInclude1.c6
-rw-r--r--Tests/ExportImport/Import/A/testInterfaceIncludeSystem/testInterfaceInclude.h1
5 files changed, 31 insertions, 0 deletions
diff --git a/Tests/ExportImport/Export/CMakeLists.txt b/Tests/ExportImport/Export/CMakeLists.txt
index a2968d4..7b33277 100644
--- a/Tests/ExportImport/Export/CMakeLists.txt
+++ b/Tests/ExportImport/Export/CMakeLists.txt
@@ -145,6 +145,19 @@ set_property(TARGET testLibCycleA PROPERTY LINK_INTERFACE_MULTIPLICITY 3)
add_library(testLibNoSONAME SHARED testLibNoSONAME.c)
set_property(TARGET testLibNoSONAME PROPERTY NO_SONAME 1)
+add_library(testInterfaceIncludeUser INTERFACE)
+target_include_directories(testInterfaceIncludeUser
+ INTERFACE
+ "$<INSTALL_INTERFACE:include/testInterfaceIncludeUser>"
+ "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/testInterfaceIncludeUser>"
+)
+set_property(TARGET testInterfaceIncludeUser PROPERTY IMPORTED_NO_SYSTEM 1)
+install(
+ FILES
+ "${CMAKE_CURRENT_SOURCE_DIR}/include/testInterfaceIncludeUser/testInterfaceInclude.h"
+ DESTINATION include/testInterfaceIncludeUser
+)
+
cmake_policy(PUSH)
cmake_policy(SET CMP0022 NEW)
# Test exporting dependent libraries into different exports
@@ -531,6 +544,7 @@ install(
cmp0022NEW cmp0022OLD
TopDirLib SubDirLinkA
systemlib
+ testInterfaceIncludeUser
EXPORT exp
RUNTIME DESTINATION $<1:bin>$<0:/wrong>
LIBRARY DESTINATION $<1:lib>$<0:/wrong> NAMELINK_SKIP
@@ -590,6 +604,7 @@ export(TARGETS testExe1 testLib1 testLib2 testLib3
cmp0022NEW cmp0022OLD
TopDirLib SubDirLinkA
systemlib
+ testInterfaceIncludeUser
NAMESPACE bld_
FILE ExportBuildTree.cmake
)
diff --git a/Tests/ExportImport/Export/include/testInterfaceIncludeUser/testInterfaceInclude.h b/Tests/ExportImport/Export/include/testInterfaceIncludeUser/testInterfaceInclude.h
new file mode 100644
index 0000000..fa882cb
--- /dev/null
+++ b/Tests/ExportImport/Export/include/testInterfaceIncludeUser/testInterfaceInclude.h
@@ -0,0 +1 @@
+/* empty file */
diff --git a/Tests/ExportImport/Import/A/CMakeLists.txt b/Tests/ExportImport/Import/A/CMakeLists.txt
index 3cb3833..0cd703f 100644
--- a/Tests/ExportImport/Import/A/CMakeLists.txt
+++ b/Tests/ExportImport/Import/A/CMakeLists.txt
@@ -70,6 +70,10 @@ target_link_libraries(imp_testExe1
exp_testLibPerConfigDest
)
+add_library(imp_testInterfaceInclude1 STATIC imp_testInterfaceInclude1.c)
+target_include_directories(imp_testInterfaceInclude1 SYSTEM PRIVATE testInterfaceIncludeSystem)
+target_link_libraries(imp_testInterfaceInclude1 PRIVATE exp_testInterfaceIncludeUser)
+
# Try building a plugin to an executable imported from the install tree.
add_library(imp_mod1 MODULE imp_mod1.c)
target_link_libraries(imp_mod1 exp_testExe2)
@@ -110,6 +114,10 @@ target_link_libraries(imp_testExe1b
bld_testLibPerConfigDest
)
+add_library(imp_testInterfaceInclude1b STATIC imp_testInterfaceInclude1.c)
+target_include_directories(imp_testInterfaceInclude1b SYSTEM PRIVATE testInterfaceIncludeSystem)
+target_link_libraries(imp_testInterfaceInclude1b PRIVATE bld_testInterfaceIncludeUser)
+
add_custom_target(check_testLib1_genex ALL
COMMAND ${CMAKE_COMMAND} -DtestLib1=$<TARGET_FILE:exp_testLib1>
-Dprefix=${CMAKE_INSTALL_PREFIX}
diff --git a/Tests/ExportImport/Import/A/imp_testInterfaceInclude1.c b/Tests/ExportImport/Import/A/imp_testInterfaceInclude1.c
new file mode 100644
index 0000000..88a49b5
--- /dev/null
+++ b/Tests/ExportImport/Import/A/imp_testInterfaceInclude1.c
@@ -0,0 +1,6 @@
+#include "testInterfaceInclude.h"
+
+int imp_testInterfaceInclude1(void)
+{
+ return 0;
+}
diff --git a/Tests/ExportImport/Import/A/testInterfaceIncludeSystem/testInterfaceInclude.h b/Tests/ExportImport/Import/A/testInterfaceIncludeSystem/testInterfaceInclude.h
new file mode 100644
index 0000000..2beeb8b
--- /dev/null
+++ b/Tests/ExportImport/Import/A/testInterfaceIncludeSystem/testInterfaceInclude.h
@@ -0,0 +1 @@
+#error testInterfaceInclude.h included from testInterfaceIncludeSystem