diff options
author | Kyle Edwards <kyle.edwards@kitware.com> | 2018-11-02 16:42:41 (GMT) |
---|---|---|
committer | Kyle Edwards <kyle.edwards@kitware.com> | 2018-11-07 19:08:48 (GMT) |
commit | 9fc20a4f3e1865e409d960c87e2e4a366775b72b (patch) | |
tree | 5ea698da30b881b7ad4db2e3770e27727f93fcb9 /Tests/RunCMake/install | |
parent | 71db32660eed1f70c06b624e661f8f5c2b938907 (diff) | |
download | CMake-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')
32 files changed, 505 insertions, 0 deletions
diff --git a/Tests/RunCMake/install/DIRECTORY-DESTINATION-TYPE-result.txt b/Tests/RunCMake/install/DIRECTORY-DESTINATION-TYPE-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/install/DIRECTORY-DESTINATION-TYPE-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/install/DIRECTORY-DESTINATION-TYPE-stderr.txt b/Tests/RunCMake/install/DIRECTORY-DESTINATION-TYPE-stderr.txt new file mode 100644 index 0000000..c847c43 --- /dev/null +++ b/Tests/RunCMake/install/DIRECTORY-DESTINATION-TYPE-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error at DIRECTORY-DESTINATION-TYPE\.cmake:[0-9]+ \(install\): + install DIRECTORY given both TYPE and DESTINATION arguments\. You may only + specify one\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/install/DIRECTORY-DESTINATION-TYPE.cmake b/Tests/RunCMake/install/DIRECTORY-DESTINATION-TYPE.cmake new file mode 100644 index 0000000..4404d6b --- /dev/null +++ b/Tests/RunCMake/install/DIRECTORY-DESTINATION-TYPE.cmake @@ -0,0 +1 @@ +install(DIRECTORY dir TYPE BIN DESTINATION mybin) diff --git a/Tests/RunCMake/install/DIRECTORY-TYPE-Cache-all-check.cmake b/Tests/RunCMake/install/DIRECTORY-TYPE-Cache-all-check.cmake new file mode 100644 index 0000000..fb393e3 --- /dev/null +++ b/Tests/RunCMake/install/DIRECTORY-TYPE-Cache-all-check.cmake @@ -0,0 +1,42 @@ +set(_check_files + [[mybin]] + [[mybin/dir]] + [[mybin/dir/empty\.txt]] + [[mycom]] + [[mycom/dir]] + [[mycom/dir/empty\.txt]] + [[mydoc]] + [[mydoc/dir]] + [[mydoc/dir/empty\.txt]] + [[myetc]] + [[myetc/dir]] + [[myetc/dir/empty\.txt]] + [[myinclude]] + [[myinclude/dir]] + [[myinclude/dir/empty\.txt]] + [[myinfo]] + [[myinfo/dir]] + [[myinfo/dir/empty\.txt]] + [[mylib]] + [[mylib/dir]] + [[mylib/dir/empty\.txt]] + [[mylocale]] + [[mylocale/dir]] + [[mylocale/dir/empty\.txt]] + [[myman]] + [[myman/dir]] + [[myman/dir/empty\.txt]] + [[myrun]] + [[myrun/dir]] + [[myrun/dir/empty\.txt]] + [[mysbin]] + [[mysbin/dir]] + [[mysbin/dir/empty\.txt]] + [[myshare]] + [[myshare/dir]] + [[myshare/dir/empty\.txt]] + [[myvar]] + [[myvar/dir]] + [[myvar/dir/empty\.txt]] + ) +check_installed("^${_check_files}$") diff --git a/Tests/RunCMake/install/DIRECTORY-TYPE-Cache.cmake b/Tests/RunCMake/install/DIRECTORY-TYPE-Cache.cmake new file mode 100644 index 0000000..53e95f8 --- /dev/null +++ b/Tests/RunCMake/install/DIRECTORY-TYPE-Cache.cmake @@ -0,0 +1,13 @@ +install(DIRECTORY dir TYPE BIN) +install(DIRECTORY dir TYPE SBIN) +install(DIRECTORY dir TYPE LIB) +install(DIRECTORY dir TYPE INCLUDE) +install(DIRECTORY dir TYPE SYSCONF) +install(DIRECTORY dir TYPE SHAREDSTATE) +install(DIRECTORY dir TYPE LOCALSTATE) +install(DIRECTORY dir TYPE RUNSTATE) +install(DIRECTORY dir TYPE DATA) +install(DIRECTORY dir TYPE INFO) +install(DIRECTORY dir TYPE LOCALE) +install(DIRECTORY dir TYPE MAN) +install(DIRECTORY dir TYPE DOC) diff --git a/Tests/RunCMake/install/DIRECTORY-TYPE-CacheDependent-all-check.cmake b/Tests/RunCMake/install/DIRECTORY-TYPE-CacheDependent-all-check.cmake new file mode 100644 index 0000000..03f7bd6 --- /dev/null +++ b/Tests/RunCMake/install/DIRECTORY-TYPE-CacheDependent-all-check.cmake @@ -0,0 +1,24 @@ +set(_check_files + [[myshare]] + [[myshare/dir]] + [[myshare/dir/empty\.txt]] + [[myshare/doc]] + [[myshare/doc/dir]] + [[myshare/doc/dir/empty\.txt]] + [[myshare/info]] + [[myshare/info/dir]] + [[myshare/info/dir/empty\.txt]] + [[myshare/locale]] + [[myshare/locale/dir]] + [[myshare/locale/dir/empty\.txt]] + [[myshare/man]] + [[myshare/man/dir]] + [[myshare/man/dir/empty.txt]] + [[myvar]] + [[myvar/dir]] + [[myvar/dir/empty\.txt]] + [[myvar/run]] + [[myvar/run/dir]] + [[myvar/run/dir/empty\.txt]] + ) +check_installed("^${_check_files}$") diff --git a/Tests/RunCMake/install/DIRECTORY-TYPE-CacheDependent.cmake b/Tests/RunCMake/install/DIRECTORY-TYPE-CacheDependent.cmake new file mode 100644 index 0000000..e797abb --- /dev/null +++ b/Tests/RunCMake/install/DIRECTORY-TYPE-CacheDependent.cmake @@ -0,0 +1,7 @@ +install(DIRECTORY dir TYPE LOCALSTATE) +install(DIRECTORY dir TYPE RUNSTATE) +install(DIRECTORY dir TYPE DATA) +install(DIRECTORY dir TYPE INFO) +install(DIRECTORY dir TYPE LOCALE) +install(DIRECTORY dir TYPE MAN) +install(DIRECTORY dir TYPE DOC) diff --git a/Tests/RunCMake/install/DIRECTORY-TYPE-all-check.cmake b/Tests/RunCMake/install/DIRECTORY-TYPE-all-check.cmake new file mode 100644 index 0000000..03fa3c8 --- /dev/null +++ b/Tests/RunCMake/install/DIRECTORY-TYPE-all-check.cmake @@ -0,0 +1,42 @@ +set(_check_files + [[bin]] + [[bin/dir]] + [[bin/dir/empty\.txt]] + [[com]] + [[com/dir]] + [[com/dir/empty\.txt]] + [[etc]] + [[etc/dir]] + [[etc/dir/empty\.txt]] + [[include]] + [[include/dir]] + [[include/dir/empty\.txt]] + [[lib]] + [[lib/dir]] + [[lib/dir/empty\.txt]] + [[sbin]] + [[sbin/dir]] + [[sbin/dir/empty\.txt]] + [[share]] + [[share/dir]] + [[share/dir/empty\.txt]] + [[share/doc]] + [[share/doc/dir]] + [[share/doc/dir/empty\.txt]] + [[share/info]] + [[share/info/dir]] + [[share/info/dir/empty\.txt]] + [[share/locale]] + [[share/locale/dir]] + [[share/locale/dir/empty\.txt]] + [[share/man]] + [[share/man/dir]] + [[share/man/dir/empty\.txt]] + [[var]] + [[var/dir]] + [[var/dir/empty\.txt]] + [[var/run]] + [[var/run/dir]] + [[var/run/dir/empty\.txt]] + ) +check_installed("^${_check_files}$") diff --git a/Tests/RunCMake/install/DIRECTORY-TYPE.cmake b/Tests/RunCMake/install/DIRECTORY-TYPE.cmake new file mode 100644 index 0000000..53e95f8 --- /dev/null +++ b/Tests/RunCMake/install/DIRECTORY-TYPE.cmake @@ -0,0 +1,13 @@ +install(DIRECTORY dir TYPE BIN) +install(DIRECTORY dir TYPE SBIN) +install(DIRECTORY dir TYPE LIB) +install(DIRECTORY dir TYPE INCLUDE) +install(DIRECTORY dir TYPE SYSCONF) +install(DIRECTORY dir TYPE SHAREDSTATE) +install(DIRECTORY dir TYPE LOCALSTATE) +install(DIRECTORY dir TYPE RUNSTATE) +install(DIRECTORY dir TYPE DATA) +install(DIRECTORY dir TYPE INFO) +install(DIRECTORY dir TYPE LOCALE) +install(DIRECTORY dir TYPE MAN) +install(DIRECTORY dir TYPE DOC) diff --git a/Tests/RunCMake/install/FILES-DESTINATION-TYPE-result.txt b/Tests/RunCMake/install/FILES-DESTINATION-TYPE-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/install/FILES-DESTINATION-TYPE-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/install/FILES-DESTINATION-TYPE-stderr.txt b/Tests/RunCMake/install/FILES-DESTINATION-TYPE-stderr.txt new file mode 100644 index 0000000..ce8fc23 --- /dev/null +++ b/Tests/RunCMake/install/FILES-DESTINATION-TYPE-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error at FILES-DESTINATION-TYPE\.cmake:[0-9]+ \(install\): + install FILES given both TYPE and DESTINATION arguments\. You may only + specify one\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/install/FILES-DESTINATION-TYPE.cmake b/Tests/RunCMake/install/FILES-DESTINATION-TYPE.cmake new file mode 100644 index 0000000..576c98f --- /dev/null +++ b/Tests/RunCMake/install/FILES-DESTINATION-TYPE.cmake @@ -0,0 +1 @@ +install(FILES main.c TYPE BIN DESTINATION mybin) diff --git a/Tests/RunCMake/install/FILES-TYPE-Cache-all-check.cmake b/Tests/RunCMake/install/FILES-TYPE-Cache-all-check.cmake new file mode 100644 index 0000000..dfb90cf --- /dev/null +++ b/Tests/RunCMake/install/FILES-TYPE-Cache-all-check.cmake @@ -0,0 +1,29 @@ +set(_check_files + [[mybin]] + [[mybin/main\.c]] + [[mycom]] + [[mycom/main\.c]] + [[mydoc]] + [[mydoc/main\.c]] + [[myetc]] + [[myetc/main\.c]] + [[myinclude]] + [[myinclude/main\.c]] + [[myinfo]] + [[myinfo/main\.c]] + [[mylib]] + [[mylib/main\.c]] + [[mylocale]] + [[mylocale/main\.c]] + [[myman]] + [[myman/main\.c]] + [[myrun]] + [[myrun/main\.c]] + [[mysbin]] + [[mysbin/main\.c]] + [[myshare]] + [[myshare/main\.c]] + [[myvar]] + [[myvar/main\.c]] + ) +check_installed("^${_check_files}$") diff --git a/Tests/RunCMake/install/FILES-TYPE-Cache.cmake b/Tests/RunCMake/install/FILES-TYPE-Cache.cmake new file mode 100644 index 0000000..2e2bfc7 --- /dev/null +++ b/Tests/RunCMake/install/FILES-TYPE-Cache.cmake @@ -0,0 +1,13 @@ +install(FILES main.c TYPE BIN) +install(FILES main.c TYPE SBIN) +install(FILES main.c TYPE LIB) +install(FILES main.c TYPE INCLUDE) +install(FILES main.c TYPE SYSCONF) +install(FILES main.c TYPE SHAREDSTATE) +install(FILES main.c TYPE LOCALSTATE) +install(FILES main.c TYPE RUNSTATE) +install(FILES main.c TYPE DATA) +install(FILES main.c TYPE INFO) +install(FILES main.c TYPE LOCALE) +install(FILES main.c TYPE MAN) +install(FILES main.c TYPE DOC) diff --git a/Tests/RunCMake/install/FILES-TYPE-CacheDependent-all-check.cmake b/Tests/RunCMake/install/FILES-TYPE-CacheDependent-all-check.cmake new file mode 100644 index 0000000..e58c80a --- /dev/null +++ b/Tests/RunCMake/install/FILES-TYPE-CacheDependent-all-check.cmake @@ -0,0 +1,17 @@ +set(_check_files + [[myshare]] + [[myshare/doc]] + [[myshare/doc/main\.c]] + [[myshare/info]] + [[myshare/info/main\.c]] + [[myshare/locale]] + [[myshare/locale/main\.c]] + [[myshare/main\.c]] + [[myshare/man]] + [[myshare/man/main\.c]] + [[myvar]] + [[myvar/main\.c]] + [[myvar/run]] + [[myvar/run/main\.c]] + ) +check_installed("^${_check_files}$") diff --git a/Tests/RunCMake/install/FILES-TYPE-CacheDependent.cmake b/Tests/RunCMake/install/FILES-TYPE-CacheDependent.cmake new file mode 100644 index 0000000..d7d5aaa --- /dev/null +++ b/Tests/RunCMake/install/FILES-TYPE-CacheDependent.cmake @@ -0,0 +1,7 @@ +install(FILES main.c TYPE LOCALSTATE) +install(FILES main.c TYPE RUNSTATE) +install(FILES main.c TYPE DATA) +install(FILES main.c TYPE INFO) +install(FILES main.c TYPE LOCALE) +install(FILES main.c TYPE MAN) +install(FILES main.c TYPE DOC) diff --git a/Tests/RunCMake/install/FILES-TYPE-all-check.cmake b/Tests/RunCMake/install/FILES-TYPE-all-check.cmake new file mode 100644 index 0000000..c4ec661 --- /dev/null +++ b/Tests/RunCMake/install/FILES-TYPE-all-check.cmake @@ -0,0 +1,29 @@ +set(_check_files + [[bin]] + [[bin/main\.c]] + [[com]] + [[com/main\.c]] + [[etc]] + [[etc/main\.c]] + [[include]] + [[include/main\.c]] + [[lib]] + [[lib/main\.c]] + [[sbin]] + [[sbin/main\.c]] + [[share]] + [[share/doc]] + [[share/doc/main\.c]] + [[share/info]] + [[share/info/main\.c]] + [[share/locale]] + [[share/locale/main\.c]] + [[share/main\.c]] + [[share/man]] + [[share/man/main\.c]] + [[var]] + [[var/main\.c]] + [[var/run]] + [[var/run/main\.c]] + ) +check_installed("^${_check_files}$") diff --git a/Tests/RunCMake/install/FILES-TYPE.cmake b/Tests/RunCMake/install/FILES-TYPE.cmake new file mode 100644 index 0000000..2e2bfc7 --- /dev/null +++ b/Tests/RunCMake/install/FILES-TYPE.cmake @@ -0,0 +1,13 @@ +install(FILES main.c TYPE BIN) +install(FILES main.c TYPE SBIN) +install(FILES main.c TYPE LIB) +install(FILES main.c TYPE INCLUDE) +install(FILES main.c TYPE SYSCONF) +install(FILES main.c TYPE SHAREDSTATE) +install(FILES main.c TYPE LOCALSTATE) +install(FILES main.c TYPE RUNSTATE) +install(FILES main.c TYPE DATA) +install(FILES main.c TYPE INFO) +install(FILES main.c TYPE LOCALE) +install(FILES main.c TYPE MAN) +install(FILES main.c TYPE DOC) diff --git a/Tests/RunCMake/install/RunCMakeTest.cmake b/Tests/RunCMake/install/RunCMakeTest.cmake index ec022ca..f7e1dee 100644 --- a/Tests/RunCMake/install/RunCMakeTest.cmake +++ b/Tests/RunCMake/install/RunCMakeTest.cmake @@ -65,6 +65,12 @@ run_cmake(CMP0062-NEW) run_cmake(CMP0062-WARN) run_cmake(TARGETS-NAMELINK_COMPONENT-bad-all) run_cmake(TARGETS-NAMELINK_COMPONENT-bad-exc) +run_cmake(FILES-DESTINATION-TYPE) +run_cmake(DIRECTORY-DESTINATION-TYPE) + +if(APPLE) + run_cmake(TARGETS-Apple-Defaults) +endif() if(NOT RunCMake_GENERATOR STREQUAL "Xcode" OR NOT "$ENV{CMAKE_OSX_ARCHITECTURES}" MATCHES "[;$]") run_install_test(FILES-TARGET_OBJECTS) @@ -74,6 +80,46 @@ run_install_test(TARGETS-InstallFromSubDir) run_install_test(TARGETS-OPTIONAL) run_install_test(FILES-OPTIONAL) run_install_test(DIRECTORY-OPTIONAL) +run_install_test(TARGETS-Defaults) + +set(RunCMake_TEST_OPTIONS + "-DCMAKE_INSTALL_BINDIR:PATH=mybin" + "-DCMAKE_INSTALL_LIBDIR:PATH=mylib" + "-DCMAKE_INSTALL_INCLUDEDIR:PATH=myinclude" + ) +run_install_test(TARGETS-Defaults-Cache) +unset(RunCMake_TEST_OPTIONS) + +run_install_test(FILES-TYPE) +run_install_test(DIRECTORY-TYPE) + +set(RunCMake_TEST_OPTIONS + "-DCMAKE_INSTALL_BINDIR:PATH=mybin" + "-DCMAKE_INSTALL_SBINDIR:PATH=mysbin" + "-DCMAKE_INSTALL_LIBEXECDIR:PATH=mylibexec" + "-DCMAKE_INSTALL_LIBDIR:PATH=mylib" + "-DCMAKE_INSTALL_INCLUDEDIR:PATH=myinclude" + "-DCMAKE_INSTALL_SYSCONFDIR:PATH=myetc" + "-DCMAKE_INSTALL_SHAREDSTATEDIR:PATH=mycom" + "-DCMAKE_INSTALL_LOCALSTATEDIR:PATH=myvar" + "-DCMAKE_INSTALL_RUNSTATEDIR:PATH=myrun" + "-DCMAKE_INSTALL_DATADIR:PATH=myshare" + "-DCMAKE_INSTALL_INFODIR:PATH=myinfo" + "-DCMAKE_INSTALL_LOCALEDIR:PATH=mylocale" + "-DCMAKE_INSTALL_MANDIR:PATH=myman" + "-DCMAKE_INSTALL_DOCDIR:PATH=mydoc" + ) +run_install_test(FILES-TYPE-Cache) +run_install_test(DIRECTORY-TYPE-Cache) +unset(RunCMake_TEST_OPTIONS) + +set(RunCMake_TEST_OPTIONS + "-DCMAKE_INSTALL_LOCALSTATEDIR:PATH=myvar" + "-DCMAKE_INSTALL_DATAROOTDIR:PATH=myshare" + ) +run_install_test(FILES-TYPE-CacheDependent) +run_install_test(DIRECTORY-TYPE-CacheDependent) +unset(RunCMake_TEST_OPTIONS) set(RunCMake_TEST_OPTIONS "-DCMAKE_BUILD_TYPE:STRING=Debug") run_install_test(TARGETS-OUTPUT_NAME) diff --git a/Tests/RunCMake/install/TARGETS-Apple-Defaults-result.txt b/Tests/RunCMake/install/TARGETS-Apple-Defaults-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-Apple-Defaults-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/install/TARGETS-Apple-Defaults-stderr.txt b/Tests/RunCMake/install/TARGETS-Apple-Defaults-stderr.txt new file mode 100644 index 0000000..645882f --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-Apple-Defaults-stderr.txt @@ -0,0 +1,12 @@ +^CMake Error at TARGETS-Apple-Defaults\.cmake:[0-9]+ \(install\): + install TARGETS given no BUNDLE DESTINATION for MACOSX_BUNDLE executable + target "exe"\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) + + +CMake Error at TARGETS-Apple-Defaults\.cmake:[0-9]+ \(install\): + install TARGETS given no FRAMEWORK DESTINATION for shared library FRAMEWORK + target "lib1"\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/install/TARGETS-Apple-Defaults.cmake b/Tests/RunCMake/install/TARGETS-Apple-Defaults.cmake new file mode 100644 index 0000000..b60c318 --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-Apple-Defaults.cmake @@ -0,0 +1,8 @@ +enable_language(C) + +add_executable(exe MACOSX_BUNDLE main.c) +add_library(lib1 SHARED obj1.c) +set_property(TARGET lib1 PROPERTY FRAMEWORK ON) + +install(TARGETS exe) +install(TARGETS lib1) diff --git a/Tests/RunCMake/install/TARGETS-Defaults-Cache-all-check.cmake b/Tests/RunCMake/install/TARGETS-Defaults-Cache-all-check.cmake new file mode 100644 index 0000000..6fc735c --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-Defaults-Cache-all-check.cmake @@ -0,0 +1,49 @@ +if(WIN32) + set(_check_files + [[lib3]] + [[lib3/(lib)?lib3\.(dll\.a|lib)]] + [[lib4]] + [[lib4/(lib)?lib4\.dll]] + [[mybin]] + [[mybin/exe\.exe]] + [[mybin/(lib)?lib1\.dll]] + [[myinclude]] + [[myinclude/obj4\.h]] + [[myinclude/obj5\.h]] + [[mylib]] + [[mylib/(lib)?lib1\.(dll\.a|lib)]] + [[mylib/(lib)?lib2\.(a|lib)]] + ) +elseif(CYGWIN) + set(_check_files + [[lib3]] + [[lib3/liblib3\.dll\.a]] + [[lib4]] + [[lib4/cyglib4\.dll]] + [[mybin]] + [[mybin/exe\.exe]] + [[mybin/cyglib1\.dll]] + [[myinclude]] + [[myinclude/obj4\.h]] + [[myinclude/obj5\.h]] + [[mylib]] + [[mylib/liblib1\.dll\.a]] + [[mylib/liblib2\.a]] + ) +else() + set(_check_files + [[lib3]] + [[lib3/liblib3\.(dylib|so)]] + [[lib4]] + [[lib4/liblib4\.(dylib|so)]] + [[mybin]] + [[mybin/exe]] + [[myinclude]] + [[myinclude/obj4\.h]] + [[myinclude/obj5\.h]] + [[mylib]] + [[mylib/liblib1\.(dylib|so)]] + [[mylib/liblib2\.a]] + ) +endif() +check_installed("^${_check_files}$") 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 + ) diff --git a/Tests/RunCMake/install/TARGETS-Defaults-all-check.cmake b/Tests/RunCMake/install/TARGETS-Defaults-all-check.cmake new file mode 100644 index 0000000..59209e6 --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-Defaults-all-check.cmake @@ -0,0 +1,49 @@ +if(WIN32) + set(_check_files + [[bin]] + [[bin/exe\.exe]] + [[bin/(lib)?lib1\.dll]] + [[include]] + [[include/obj4\.h]] + [[include/obj5\.h]] + [[lib]] + [[lib/(lib)?lib1\.(dll\.a|lib)]] + [[lib/(lib)?lib2\.(a|lib)]] + [[lib3]] + [[lib3/(lib)?lib3\.(dll\.a|lib)]] + [[lib4]] + [[lib4/(lib)?lib4\.dll]] + ) +elseif(CYGWIN) + set(_check_files + [[bin]] + [[bin/exe\.exe]] + [[bin/cyglib1\.dll]] + [[include]] + [[include/obj4\.h]] + [[include/obj5\.h]] + [[lib]] + [[lib/liblib1\.dll\.a]] + [[lib/liblib2\.a]] + [[lib3]] + [[lib3/liblib3\.dll\.a]] + [[lib4]] + [[lib4/cyglib4\.dll]] + ) +else() + set(_check_files + [[bin]] + [[bin/exe]] + [[include]] + [[include/obj4\.h]] + [[include/obj5\.h]] + [[lib]] + [[lib/liblib1\.(dylib|so)]] + [[lib/liblib2\.a]] + [[lib3]] + [[lib3/liblib3\.(dylib|so)]] + [[lib4]] + [[lib4/liblib4\.(dylib|so)]] + ) +endif() +check_installed("^${_check_files}$") diff --git a/Tests/RunCMake/install/TARGETS-Defaults.cmake b/Tests/RunCMake/install/TARGETS-Defaults.cmake new file mode 100644 index 0000000..bfd8c2c --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-Defaults.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 + ) diff --git a/Tests/RunCMake/install/obj3.c b/Tests/RunCMake/install/obj3.c new file mode 100644 index 0000000..991fed3 --- /dev/null +++ b/Tests/RunCMake/install/obj3.c @@ -0,0 +1,7 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif + int obj3(void) +{ + return 0; +} diff --git a/Tests/RunCMake/install/obj3.h b/Tests/RunCMake/install/obj3.h new file mode 100644 index 0000000..9e8bb76 --- /dev/null +++ b/Tests/RunCMake/install/obj3.h @@ -0,0 +1,6 @@ +#ifndef OBJ3_H +#define OBJ3_H + +int obj3(void); + +#endif /* OBJ3_H */ diff --git a/Tests/RunCMake/install/obj4.c b/Tests/RunCMake/install/obj4.c new file mode 100644 index 0000000..edd6172 --- /dev/null +++ b/Tests/RunCMake/install/obj4.c @@ -0,0 +1,7 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif + int obj4(void) +{ + return 0; +} diff --git a/Tests/RunCMake/install/obj4.h b/Tests/RunCMake/install/obj4.h new file mode 100644 index 0000000..6195aa7 --- /dev/null +++ b/Tests/RunCMake/install/obj4.h @@ -0,0 +1,6 @@ +#ifndef OBJ4_H +#define OBJ4_H + +int obj4(void); + +#endif /* OBJ4_H */ diff --git a/Tests/RunCMake/install/obj5.c b/Tests/RunCMake/install/obj5.c new file mode 100644 index 0000000..df3e997 --- /dev/null +++ b/Tests/RunCMake/install/obj5.c @@ -0,0 +1,7 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif + int obj5(void) +{ + return 0; +} diff --git a/Tests/RunCMake/install/obj5.h b/Tests/RunCMake/install/obj5.h new file mode 100644 index 0000000..a16a1b0 --- /dev/null +++ b/Tests/RunCMake/install/obj5.h @@ -0,0 +1,6 @@ +#ifndef OBJ5_H +#define OBJ5_H + +int obj5(void); + +#endif /* OBJ5_H */ |