diff options
author | Alexander Grund <git@grundis.de> | 2018-12-16 17:05:23 (GMT) |
---|---|---|
committer | Craig Scott <craig.scott@crascit.com> | 2019-01-04 22:09:39 (GMT) |
commit | 08be74bfd7e24af9ffdb64dddffd3d56bf52c3ce (patch) | |
tree | 78cb35917baeebf19f4521152c1dc66ab3451e9d /Tests/RunCMake/GetPrerequisites | |
parent | 52445300d67df73b5b8c288cc33c915053c7ba24 (diff) | |
download | CMake-08be74bfd7e24af9ffdb64dddffd3d56bf52c3ce.zip CMake-08be74bfd7e24af9ffdb64dddffd3d56bf52c3ce.tar.gz CMake-08be74bfd7e24af9ffdb64dddffd3d56bf52c3ce.tar.bz2 |
GetPrerequisites: Fix handling of executable scripts
Fixes: #18667
Diffstat (limited to 'Tests/RunCMake/GetPrerequisites')
-rw-r--r-- | Tests/RunCMake/GetPrerequisites/ExecutableScripts-stdout.txt | 3 | ||||
-rw-r--r-- | Tests/RunCMake/GetPrerequisites/ExecutableScripts.cmake | 19 | ||||
-rw-r--r-- | Tests/RunCMake/GetPrerequisites/RunCMakeTest.cmake | 1 | ||||
-rwxr-xr-x | Tests/RunCMake/GetPrerequisites/script | 3 | ||||
-rwxr-xr-x | Tests/RunCMake/GetPrerequisites/script.bat | 3 | ||||
-rwxr-xr-x | Tests/RunCMake/GetPrerequisites/script.sh | 3 |
6 files changed, 32 insertions, 0 deletions
diff --git a/Tests/RunCMake/GetPrerequisites/ExecutableScripts-stdout.txt b/Tests/RunCMake/GetPrerequisites/ExecutableScripts-stdout.txt new file mode 100644 index 0000000..5a353d8 --- /dev/null +++ b/Tests/RunCMake/GetPrerequisites/ExecutableScripts-stdout.txt @@ -0,0 +1,3 @@ +-- GetPrequisites\(.*script.sh\) : ignoring script file +-- GetPrequisites\(.*script.bat\) : ignoring script file +-- GetPrequisites\(.*script\) : ignoring script file diff --git a/Tests/RunCMake/GetPrerequisites/ExecutableScripts.cmake b/Tests/RunCMake/GetPrerequisites/ExecutableScripts.cmake new file mode 100644 index 0000000..d1bc9b1 --- /dev/null +++ b/Tests/RunCMake/GetPrerequisites/ExecutableScripts.cmake @@ -0,0 +1,19 @@ +include(GetPrerequisites) + +function(check_script script) + set(prereqs "") + get_prerequisites(${script} prereqs 1 1 "" "") + if(NOT "${prereqs}" STREQUAL "") + message(FATAL_ERROR "Prerequisites for ${script} not empty") + endif() +endfunction() + +# Should not throw any errors +# Regular executable +get_prerequisites(${CMAKE_COMMAND} cmake_prereqs 1 1 "" "") +# Shell script +check_script(${CMAKE_CURRENT_LIST_DIR}/script.sh) +# Batch script +check_script(${CMAKE_CURRENT_LIST_DIR}/script.bat) +# Shell script without extension +check_script(${CMAKE_CURRENT_LIST_DIR}/script) diff --git a/Tests/RunCMake/GetPrerequisites/RunCMakeTest.cmake b/Tests/RunCMake/GetPrerequisites/RunCMakeTest.cmake index 3856c54..a635e38 100644 --- a/Tests/RunCMake/GetPrerequisites/RunCMakeTest.cmake +++ b/Tests/RunCMake/GetPrerequisites/RunCMakeTest.cmake @@ -1,3 +1,4 @@ include(RunCMake) run_cmake_command(TargetMissing ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/TargetMissing.cmake) +run_cmake_command(ExecutableScripts ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/ExecutableScripts.cmake) diff --git a/Tests/RunCMake/GetPrerequisites/script b/Tests/RunCMake/GetPrerequisites/script new file mode 100755 index 0000000..23bf47c --- /dev/null +++ b/Tests/RunCMake/GetPrerequisites/script @@ -0,0 +1,3 @@ +#!/bin/bash + +echo "Hello World" diff --git a/Tests/RunCMake/GetPrerequisites/script.bat b/Tests/RunCMake/GetPrerequisites/script.bat new file mode 100755 index 0000000..dbb0ec2 --- /dev/null +++ b/Tests/RunCMake/GetPrerequisites/script.bat @@ -0,0 +1,3 @@ +@echo off + +echo "Hello world" diff --git a/Tests/RunCMake/GetPrerequisites/script.sh b/Tests/RunCMake/GetPrerequisites/script.sh new file mode 100755 index 0000000..23bf47c --- /dev/null +++ b/Tests/RunCMake/GetPrerequisites/script.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +echo "Hello World" |