From 1638ffa287e5032eecb1d8eaa1051a29379f6017 Mon Sep 17 00:00:00 2001 From: Kyle Edwards Date: Wed, 11 Jul 2018 14:32:00 -0400 Subject: Tests: Add tests for install( ... OPTIONAL) --- Tests/RunCMake/install/FILES-OPTIONAL-all-check.cmake | 1 + Tests/RunCMake/install/FILES-OPTIONAL.cmake | 1 + Tests/RunCMake/install/RunCMakeTest.cmake | 2 ++ Tests/RunCMake/install/TARGETS-OPTIONAL-all-check.cmake | 1 + Tests/RunCMake/install/TARGETS-OPTIONAL-stderr.txt | 1 + Tests/RunCMake/install/TARGETS-OPTIONAL.cmake | 4 ++++ 6 files changed, 10 insertions(+) create mode 100644 Tests/RunCMake/install/FILES-OPTIONAL-all-check.cmake create mode 100644 Tests/RunCMake/install/FILES-OPTIONAL.cmake create mode 100644 Tests/RunCMake/install/TARGETS-OPTIONAL-all-check.cmake create mode 100644 Tests/RunCMake/install/TARGETS-OPTIONAL-stderr.txt create mode 100644 Tests/RunCMake/install/TARGETS-OPTIONAL.cmake diff --git a/Tests/RunCMake/install/FILES-OPTIONAL-all-check.cmake b/Tests/RunCMake/install/FILES-OPTIONAL-all-check.cmake new file mode 100644 index 0000000..2997a8d --- /dev/null +++ b/Tests/RunCMake/install/FILES-OPTIONAL-all-check.cmake @@ -0,0 +1 @@ +check_installed([[^src;src/main.c$]]) diff --git a/Tests/RunCMake/install/FILES-OPTIONAL.cmake b/Tests/RunCMake/install/FILES-OPTIONAL.cmake new file mode 100644 index 0000000..812bf4f --- /dev/null +++ b/Tests/RunCMake/install/FILES-OPTIONAL.cmake @@ -0,0 +1 @@ +install(FILES main.c noexist.c DESTINATION src OPTIONAL) diff --git a/Tests/RunCMake/install/RunCMakeTest.cmake b/Tests/RunCMake/install/RunCMakeTest.cmake index b1add3a..02dcc7d 100644 --- a/Tests/RunCMake/install/RunCMakeTest.cmake +++ b/Tests/RunCMake/install/RunCMakeTest.cmake @@ -73,6 +73,8 @@ if(NOT RunCMake_GENERATOR STREQUAL "Xcode" OR NOT "$ENV{CMAKE_OSX_ARCHITECTURES} endif() run_install_test(TARGETS-InstallFromSubDir) +run_install_test(TARGETS-OPTIONAL) +run_install_test(FILES-OPTIONAL) set(run_install_test_components 1) run_install_test(FILES-EXCLUDE_FROM_ALL) diff --git a/Tests/RunCMake/install/TARGETS-OPTIONAL-all-check.cmake b/Tests/RunCMake/install/TARGETS-OPTIONAL-all-check.cmake new file mode 100644 index 0000000..bcf71dd --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-OPTIONAL-all-check.cmake @@ -0,0 +1 @@ +check_installed([[^bin;bin/myexe(\.exe)?$]]) diff --git a/Tests/RunCMake/install/TARGETS-OPTIONAL-stderr.txt b/Tests/RunCMake/install/TARGETS-OPTIONAL-stderr.txt new file mode 100644 index 0000000..86e3ec0 --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-OPTIONAL-stderr.txt @@ -0,0 +1 @@ +^WARNING: Target "notall" has EXCLUDE_FROM_ALL set and will not be built by default but an install rule has been provided for it\. CMake does not define behavior for this case\.$ diff --git a/Tests/RunCMake/install/TARGETS-OPTIONAL.cmake b/Tests/RunCMake/install/TARGETS-OPTIONAL.cmake new file mode 100644 index 0000000..d3c5cda --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-OPTIONAL.cmake @@ -0,0 +1,4 @@ +enable_language(C) +add_executable(myexe main.c) +add_executable(notall EXCLUDE_FROM_ALL main.c) +install(TARGETS myexe notall DESTINATION bin OPTIONAL) -- cgit v0.12