diff options
author | Avraham Shukron <avraham.shukron@gmail.com> | 2019-04-05 21:27:04 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-04-11 15:09:42 (GMT) |
commit | a40f9083dd17d1cccf89ccdf290c3f494cab3aac (patch) | |
tree | 2170e1aeba12956f710761a7facc5286b7936dc0 /Tests | |
parent | 4f07fdde26f1de59e2e8c2a32f0af7a2caff422d (diff) | |
download | CMake-a40f9083dd17d1cccf89ccdf290c3f494cab3aac.zip CMake-a40f9083dd17d1cccf89ccdf290c3f494cab3aac.tar.gz CMake-a40f9083dd17d1cccf89ccdf290c3f494cab3aac.tar.bz2 |
INTERFACE Target: allow (PUBLIC/PRIVATE)_HEADER properties
Also support installing headers on an INTERFACE library.
Signed-off-by: Avraham Shukron <avraham.shukron@gmail.com>
Fixes: #15234
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/RunCMake/install/TARGETS-Defaults-all-check.cmake | 6 | ||||
-rw-r--r-- | Tests/RunCMake/install/TARGETS-Defaults.cmake | 8 | ||||
-rw-r--r-- | Tests/RunCMake/install/obj2.h | 6 | ||||
-rw-r--r-- | Tests/RunCMake/interface_library/whitelist.cmake | 9 |
4 files changed, 29 insertions, 0 deletions
diff --git a/Tests/RunCMake/install/TARGETS-Defaults-all-check.cmake b/Tests/RunCMake/install/TARGETS-Defaults-all-check.cmake index c41cb2a..15335b2 100644 --- a/Tests/RunCMake/install/TARGETS-Defaults-all-check.cmake +++ b/Tests/RunCMake/install/TARGETS-Defaults-all-check.cmake @@ -4,6 +4,8 @@ if(WIN32) [[bin/exe\.exe]] [[bin/(lib)?lib1\.dll]] [[include]] + [[include/obj1\.h]] + [[include/obj2\.h]] [[include/obj4\.h]] [[include/obj5\.h]] [[lib]] @@ -20,6 +22,8 @@ elseif(CYGWIN) [[bin/cyglib1\.dll]] [[bin/exe\.exe]] [[include]] + [[include/obj1\.h]] + [[include/obj2\.h]] [[include/obj4\.h]] [[include/obj5\.h]] [[lib]] @@ -35,6 +39,8 @@ else() [[bin]] [[bin/exe]] [[include]] + [[include/obj1\.h]] + [[include/obj2\.h]] [[include/obj4\.h]] [[include/obj5\.h]] [[lib]] diff --git a/Tests/RunCMake/install/TARGETS-Defaults.cmake b/Tests/RunCMake/install/TARGETS-Defaults.cmake index bfd8c2c..324aa11 100644 --- a/Tests/RunCMake/install/TARGETS-Defaults.cmake +++ b/Tests/RunCMake/install/TARGETS-Defaults.cmake @@ -8,6 +8,11 @@ set_property(TARGET lib3 PROPERTY PRIVATE_HEADER ${CMAKE_CURRENT_SOURCE_DIR}/obj add_library(lib4 SHARED obj5.c) set_property(TARGET lib4 PROPERTY PUBLIC_HEADER ${CMAKE_CURRENT_SOURCE_DIR}/obj5.h) +add_library(iface INTERFACE) +set_target_properties(iface PROPERTIES + PUBLIC_HEADER ${CMAKE_CURRENT_SOURCE_DIR}/obj1.h + PRIVATE_HEADER ${CMAKE_CURRENT_SOURCE_DIR}/obj2.h) + install(TARGETS exe lib1 lib2) install(TARGETS lib3 LIBRARY DESTINATION lib3 @@ -17,3 +22,6 @@ install(TARGETS lib4 LIBRARY DESTINATION lib4 RUNTIME DESTINATION lib4 ) +install(TARGETS iface + PUBLIC_HEADER DESTINATION include + PRIVATE_HEADER DESTINATION include) diff --git a/Tests/RunCMake/install/obj2.h b/Tests/RunCMake/install/obj2.h new file mode 100644 index 0000000..90bcd34 --- /dev/null +++ b/Tests/RunCMake/install/obj2.h @@ -0,0 +1,6 @@ +#ifndef OBJ2_H +#define OBJ2_H + +int obj2(void); + +#endif /* OBJ2_H */ diff --git a/Tests/RunCMake/interface_library/whitelist.cmake b/Tests/RunCMake/interface_library/whitelist.cmake index bf64f01..0db6375 100644 --- a/Tests/RunCMake/interface_library/whitelist.cmake +++ b/Tests/RunCMake/interface_library/whitelist.cmake @@ -14,3 +14,12 @@ get_target_property(outname iface "_custom_property") set_property(TARGET iface PROPERTY "custom_property" output) set_property(TARGET iface APPEND PROPERTY "custom_property" append) get_target_property(outname iface "custom_property") + +# PUBLIC_HEADER / PRIVATE_HEADER properties are allowed +set_property(TARGET iface PROPERTY PUBLIC_HEADER foo.h) +set_property(TARGET iface APPEND PROPERTY PUBLIC_HEADER bar.h) +get_target_property(outname iface PUBLIC_HEADER) + +set_property(TARGET iface PROPERTY PRIVATE_HEADER foo.h) +set_property(TARGET iface APPEND PROPERTY PRIVATE_HEADER bar.h) +get_target_property(outname iface PRIVATE_HEADER) |