diff options
Diffstat (limited to 'Tests/RunCMake')
23 files changed, 66 insertions, 6 deletions
diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index 8072a2cad..caf3c8896 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -54,6 +54,14 @@ run_cmake_command(build-no-dir ${CMAKE_COMMAND} --build) run_cmake_command(build-no-cache ${CMAKE_COMMAND} --build ${RunCMake_SOURCE_DIR}) +run_cmake_command(build-unknown-command-short + ${CMAKE_COMMAND} --build ${RunCMake_SOURCE_DIR} -invalid-command) +run_cmake_command(build-unknown-command-long + ${CMAKE_COMMAND} --build ${RunCMake_SOURCE_DIR} --invalid-command) +run_cmake_command(build-unknown-command-partial-match + ${CMAKE_COMMAND} --build ${RunCMake_SOURCE_DIR} --targetinvalid) +run_cmake_command(build-invalid-target-syntax + ${CMAKE_COMMAND} --build ${RunCMake_SOURCE_DIR} --target=invalid) run_cmake_command(build-no-generator ${CMAKE_COMMAND} --build ${RunCMake_SOURCE_DIR}/cache-no-generator) run_cmake_command(build-bad-dir @@ -65,6 +73,10 @@ run_cmake_command(install-no-dir ${CMAKE_COMMAND} --install) run_cmake_command(install-bad-dir ${CMAKE_COMMAND} --install dir-does-not-exist) +run_cmake_command(install-unknown-command-short + ${CMAKE_COMMAND} --install ${RunCMake_SOURCE_DIR} -invalid-command) +run_cmake_command(install-unknown-command-long + ${CMAKE_COMMAND} --install ${RunCMake_SOURCE_DIR} --invalid-command) run_cmake_command(install-options-to-vars ${CMAKE_COMMAND} --install ${RunCMake_SOURCE_DIR}/dir-install-options-to-vars --strip --prefix /var/test --config sample --component pack) diff --git a/Tests/RunCMake/CommandLine/build-invalid-target-syntax-result.txt b/Tests/RunCMake/CommandLine/build-invalid-target-syntax-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/CommandLine/build-invalid-target-syntax-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/build-invalid-target-syntax-stderr.txt b/Tests/RunCMake/CommandLine/build-invalid-target-syntax-stderr.txt new file mode 100644 index 000000000..5fe25390a --- /dev/null +++ b/Tests/RunCMake/CommandLine/build-invalid-target-syntax-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: '--target=invalid' is invalid syntax for --target +Usage: cmake --build \[<dir> \| --preset <preset>\] \[options\] \[-- \[native-options\]\] diff --git a/Tests/RunCMake/CommandLine/build-unknown-command-long-result.txt b/Tests/RunCMake/CommandLine/build-unknown-command-long-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/CommandLine/build-unknown-command-long-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/build-unknown-command-long-stderr.txt b/Tests/RunCMake/CommandLine/build-unknown-command-long-stderr.txt new file mode 100644 index 000000000..c8f1a03cb --- /dev/null +++ b/Tests/RunCMake/CommandLine/build-unknown-command-long-stderr.txt @@ -0,0 +1,2 @@ +^Unknown argument --invalid-command +Usage: cmake --build \[<dir> \| --preset <preset>\] \[options\] \[-- \[native-options\]\] diff --git a/Tests/RunCMake/CommandLine/build-unknown-command-partial-match-result.txt b/Tests/RunCMake/CommandLine/build-unknown-command-partial-match-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/CommandLine/build-unknown-command-partial-match-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/build-unknown-command-partial-match-stderr.txt b/Tests/RunCMake/CommandLine/build-unknown-command-partial-match-stderr.txt new file mode 100644 index 000000000..d69338a41 --- /dev/null +++ b/Tests/RunCMake/CommandLine/build-unknown-command-partial-match-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: '--targetinvalid' is invalid syntax for --target +Usage: cmake --build \[<dir> \| --preset <preset>\] \[options\] \[-- \[native-options\]\] diff --git a/Tests/RunCMake/CommandLine/build-unknown-command-short-result.txt b/Tests/RunCMake/CommandLine/build-unknown-command-short-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/CommandLine/build-unknown-command-short-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/build-unknown-command-short-stderr.txt b/Tests/RunCMake/CommandLine/build-unknown-command-short-stderr.txt new file mode 100644 index 000000000..a6cfeceac --- /dev/null +++ b/Tests/RunCMake/CommandLine/build-unknown-command-short-stderr.txt @@ -0,0 +1,2 @@ +^Unknown argument -invalid-command +Usage: cmake --build \[<dir> \| --preset <preset>\] \[options\] \[-- \[native-options\]\] diff --git a/Tests/RunCMake/CommandLine/install-unknown-command-long-result.txt b/Tests/RunCMake/CommandLine/install-unknown-command-long-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/CommandLine/install-unknown-command-long-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/install-unknown-command-long-stderr.txt b/Tests/RunCMake/CommandLine/install-unknown-command-long-stderr.txt new file mode 100644 index 000000000..e6cee6b45 --- /dev/null +++ b/Tests/RunCMake/CommandLine/install-unknown-command-long-stderr.txt @@ -0,0 +1,2 @@ +^Unknown argument --invalid-command +Usage: cmake --install <dir> \[options\] diff --git a/Tests/RunCMake/CommandLine/install-unknown-command-short-result.txt b/Tests/RunCMake/CommandLine/install-unknown-command-short-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/CommandLine/install-unknown-command-short-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/install-unknown-command-short-stderr.txt b/Tests/RunCMake/CommandLine/install-unknown-command-short-stderr.txt new file mode 100644 index 000000000..f690ec430 --- /dev/null +++ b/Tests/RunCMake/CommandLine/install-unknown-command-short-stderr.txt @@ -0,0 +1,2 @@ +^Unknown argument -invalid-command +Usage: cmake --install <dir> \[options\] diff --git a/Tests/RunCMake/ExternalProject/FetchGitTags.cmake b/Tests/RunCMake/ExternalProject/FetchGitRefs.cmake index 37d1b4088..a00908b39 100644 --- a/Tests/RunCMake/ExternalProject/FetchGitTags.cmake +++ b/Tests/RunCMake/ExternalProject/FetchGitRefs.cmake @@ -11,7 +11,7 @@ file(MAKE_DIRECTORY ${srcDir}) file(GLOB entries ${srcRepo}/*) file(REMOVE_RECURSE ${entries} ${binDir}) file(TOUCH ${srcRepo}/firstFile.txt) -configure_file(${CMAKE_CURRENT_LIST_DIR}/FetchGitTags/CMakeLists.txt +configure_file(${CMAKE_CURRENT_LIST_DIR}/FetchGitRefs/CMakeLists.txt ${srcDir}/CMakeLists.txt COPYONLY) function(execGitCommand) @@ -63,5 +63,22 @@ execGitCommand(commit -m "Second file") execGitCommand(tag -a -m "Adding tag" tag_of_interest) execGitCommand(reset --hard HEAD~1) -message(STATUS "Second configure-and-build") +message(STATUS "Configure-and-build, update to tag") configureAndBuild(tag_of_interest) + +# Do the same, but this time for a commit hash +file(TOUCH ${srcRepo}/thirdFile.txt) +execGitCommand(add thirdFile.txt) +execGitCommand(commit -m "Third file") +execGitCommand(tag -a -m "Adding another tag" check_for_hash) +execGitCommand(reset --hard HEAD~1) +execute_process( + WORKING_DIRECTORY ${srcRepo} + COMMAND ${GIT_EXECUTABLE} rev-parse check_for_hash + COMMAND_ERROR_IS_FATAL ANY + OUTPUT_VARIABLE commit_hash + OUTPUT_STRIP_TRAILING_WHITESPACE +) + +message(STATUS "Configure-and-build, update to commit hash ${commit_hash}") +configureAndBuild(${commit_hash}) diff --git a/Tests/RunCMake/ExternalProject/FetchGitTags/CMakeLists.txt b/Tests/RunCMake/ExternalProject/FetchGitRefs/CMakeLists.txt index d9a380c03..d9a380c03 100644 --- a/Tests/RunCMake/ExternalProject/FetchGitTags/CMakeLists.txt +++ b/Tests/RunCMake/ExternalProject/FetchGitRefs/CMakeLists.txt diff --git a/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake b/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake index 3205dd54c..a4244e364 100644 --- a/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake +++ b/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake @@ -185,6 +185,6 @@ if(GIT_EXECUTABLE) # Note that there appear to be differences in where git writes its output to # on some platforms. It may go to stdout or stderr, so force it to be merged. set(RunCMake_TEST_OUTPUT_MERGE TRUE) - run_cmake(FetchGitTags) + run_cmake(FetchGitRefs) set(RunCMake_TEST_OUTPUT_MERGE FALSE) endif() diff --git a/Tests/RunCMake/NinjaMultiConfig/LongCommandLine-release-config-build-stdout.txt b/Tests/RunCMake/NinjaMultiConfig/LongCommandLine-release-config-build-stdout.txt new file mode 100644 index 000000000..628b6bc33 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/LongCommandLine-release-config-build-stdout.txt @@ -0,0 +1,2 @@ + +Post-build Debug Release \.*$ diff --git a/Tests/RunCMake/NinjaMultiConfig/LongCommandLine.cmake b/Tests/RunCMake/NinjaMultiConfig/LongCommandLine.cmake index 00aa896af..de528be46 100644 --- a/Tests/RunCMake/NinjaMultiConfig/LongCommandLine.cmake +++ b/Tests/RunCMake/NinjaMultiConfig/LongCommandLine.cmake @@ -14,3 +14,10 @@ add_custom_target( ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/gen.txt" ) + +add_executable(exe main.c) + +add_custom_command( + TARGET exe POST_BUILD + COMMAND ${CMAKE_COMMAND} -E echo "Post-build $<CONFIG> $<COMMAND_CONFIG:$<CONFIG>> ${very_long}" + ) diff --git a/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake b/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake index aa427391e..e7acbc284 100644 --- a/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake +++ b/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake @@ -198,8 +198,11 @@ run_cmake_build(PostBuild release Release Exe) run_cmake_build(PostBuild debug-in-release-graph Release Exe:Debug) set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/LongCommandLine-build) +set(RunCMake_TEST_OPTIONS "-DCMAKE_CROSS_CONFIGS=all") run_cmake_configure(LongCommandLine) +unset(RunCMake_TEST_OPTIONS) run_cmake_build(LongCommandLine release Release custom) +run_cmake_build(LongCommandLine release-config Release exe:Debug) set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Framework-build) set(RunCMake_TEST_OPTIONS "-DCMAKE_CROSS_CONFIGS=all") diff --git a/Tests/RunCMake/add_subdirectory/CMP0082-ExcludeFromAll/CMakeLists.txt b/Tests/RunCMake/add_subdirectory/CMP0082-ExcludeFromAll/CMakeLists.txt index 1bd7f495b..32bb1a96b 100644 --- a/Tests/RunCMake/add_subdirectory/CMP0082-ExcludeFromAll/CMakeLists.txt +++ b/Tests/RunCMake/add_subdirectory/CMP0082-ExcludeFromAll/CMakeLists.txt @@ -1 +1,2 @@ install(CODE "message(STATUS \"exclude\")") +set_directory_properties(PROPERTIES EXCLUDE_FROM_ALL TRUE) diff --git a/Tests/RunCMake/add_subdirectory/CMP0082-NEW.cmake b/Tests/RunCMake/add_subdirectory/CMP0082-NEW.cmake index 56c1b81f7..8ebf21b3d 100644 --- a/Tests/RunCMake/add_subdirectory/CMP0082-NEW.cmake +++ b/Tests/RunCMake/add_subdirectory/CMP0082-NEW.cmake @@ -1,3 +1,3 @@ add_subdirectory(CMP0082) -add_subdirectory(CMP0082-ExcludeFromAll EXCLUDE_FROM_ALL) +add_subdirectory(CMP0082-ExcludeFromAll) install(CODE "message(STATUS \"top\")") diff --git a/Tests/RunCMake/add_subdirectory/CMP0082-OLD.cmake b/Tests/RunCMake/add_subdirectory/CMP0082-OLD.cmake index 56c1b81f7..8ebf21b3d 100644 --- a/Tests/RunCMake/add_subdirectory/CMP0082-OLD.cmake +++ b/Tests/RunCMake/add_subdirectory/CMP0082-OLD.cmake @@ -1,3 +1,3 @@ add_subdirectory(CMP0082) -add_subdirectory(CMP0082-ExcludeFromAll EXCLUDE_FROM_ALL) +add_subdirectory(CMP0082-ExcludeFromAll) install(CODE "message(STATUS \"top\")") diff --git a/Tests/RunCMake/add_subdirectory/CMP0082-WARN.cmake b/Tests/RunCMake/add_subdirectory/CMP0082-WARN.cmake index 56c1b81f7..8ebf21b3d 100644 --- a/Tests/RunCMake/add_subdirectory/CMP0082-WARN.cmake +++ b/Tests/RunCMake/add_subdirectory/CMP0082-WARN.cmake @@ -1,3 +1,3 @@ add_subdirectory(CMP0082) -add_subdirectory(CMP0082-ExcludeFromAll EXCLUDE_FROM_ALL) +add_subdirectory(CMP0082-ExcludeFromAll) install(CODE "message(STATUS \"top\")") |