summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/install/TARGETS-Defaults-Cache.cmake
diff options
context:
space:
mode:
authorKyle Edwards <kyle.edwards@kitware.com>2018-11-02 16:42:41 (GMT)
committerKyle Edwards <kyle.edwards@kitware.com>2018-11-07 19:08:48 (GMT)
commit9fc20a4f3e1865e409d960c87e2e4a366775b72b (patch)
tree5ea698da30b881b7ad4db2e3770e27727f93fcb9 /Tests/RunCMake/install/TARGETS-Defaults-Cache.cmake
parent71db32660eed1f70c06b624e661f8f5c2b938907 (diff)
downloadCMake-9fc20a4f3e1865e409d960c87e2e4a366775b72b.zip
CMake-9fc20a4f3e1865e409d960c87e2e4a366775b72b.tar.gz
CMake-9fc20a4f3e1865e409d960c87e2e4a366775b72b.tar.bz2
install: Add sane set of defaults for DESTINATION and file type parameters
If the user does not specify a DESTINATION for a target type, the install() command checks to see if the appropriate variable from GNUInstallDirs is set. If it is not, then it uses an appropriate hard-coded guess. In addition, for FILES and DIRECTORY, the user can specify a file type instead of a DESTINATION, and the command will use the appropriate variable from GNUInstallDirs, or a hard-coded guess if it is not set.
Diffstat (limited to 'Tests/RunCMake/install/TARGETS-Defaults-Cache.cmake')
-rw-r--r--Tests/RunCMake/install/TARGETS-Defaults-Cache.cmake19
1 files changed, 19 insertions, 0 deletions
diff --git a/Tests/RunCMake/install/TARGETS-Defaults-Cache.cmake b/Tests/RunCMake/install/TARGETS-Defaults-Cache.cmake
new file mode 100644
index 0000000..bfd8c2c
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-Defaults-Cache.cmake
@@ -0,0 +1,19 @@
+enable_language(C)
+
+add_executable(exe main.c)
+add_library(lib1 SHARED obj1.c)
+add_library(lib2 STATIC obj3.c)
+add_library(lib3 SHARED obj4.c)
+set_property(TARGET lib3 PROPERTY PRIVATE_HEADER ${CMAKE_CURRENT_SOURCE_DIR}/obj4.h)
+add_library(lib4 SHARED obj5.c)
+set_property(TARGET lib4 PROPERTY PUBLIC_HEADER ${CMAKE_CURRENT_SOURCE_DIR}/obj5.h)
+
+install(TARGETS exe lib1 lib2)
+install(TARGETS lib3
+ LIBRARY DESTINATION lib3
+ ARCHIVE DESTINATION lib3
+ )
+install(TARGETS lib4
+ LIBRARY DESTINATION lib4
+ RUNTIME DESTINATION lib4
+ )