summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/configure_file
diff options
context:
space:
mode:
authorRahul Gottipati <rahul.blr97@gmail.com>2020-06-25 13:36:25 (GMT)
committerBrad King <brad.king@kitware.com>2020-06-30 15:20:41 (GMT)
commit27b03281e2028d8239c3f7e43ea67f30a70dc42b (patch)
tree932b13ea34f2256e7d3400d5264cbf39b28f7096 /Tests/RunCMake/configure_file
parentf2b84d24cfccf49b6332cf3f2ca164fd71ae023e (diff)
downloadCMake-27b03281e2028d8239c3f7e43ea67f30a70dc42b.zip
CMake-27b03281e2028d8239c3f7e43ea67f30a70dc42b.tar.gz
CMake-27b03281e2028d8239c3f7e43ea67f30a70dc42b.tar.bz2
configure_file: Add option to control file permissions transfer to copy
Issue: #20866
Diffstat (limited to 'Tests/RunCMake/configure_file')
-rw-r--r--Tests/RunCMake/configure_file/NoSourcePermissions.cmake10
-rwxr-xr-xTests/RunCMake/configure_file/NoSourcePermissions.sh3
-rw-r--r--Tests/RunCMake/configure_file/RunCMakeTest.cmake1
3 files changed, 14 insertions, 0 deletions
diff --git a/Tests/RunCMake/configure_file/NoSourcePermissions.cmake b/Tests/RunCMake/configure_file/NoSourcePermissions.cmake
new file mode 100644
index 0000000..c6ad131
--- /dev/null
+++ b/Tests/RunCMake/configure_file/NoSourcePermissions.cmake
@@ -0,0 +1,10 @@
+configure_file(NoSourcePermissions.sh NoSourcePermissions.sh.out
+ NO_SOURCE_PERMISSIONS)
+
+if (UNIX)
+ execute_process(COMMAND ${CMAKE_CURRENT_BINARY_DIR}/NoSourcePermissions.sh.out
+ RESULT_VARIABLE result)
+ if (result EQUAL "0")
+ message(FATAL_ERROR "Copied file has executable permissions")
+ endif()
+endif()
diff --git a/Tests/RunCMake/configure_file/NoSourcePermissions.sh b/Tests/RunCMake/configure_file/NoSourcePermissions.sh
new file mode 100755
index 0000000..0aa8f41
--- /dev/null
+++ b/Tests/RunCMake/configure_file/NoSourcePermissions.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+#Testing NO_SOURCE_PERMISSIONS option of configure_file.
diff --git a/Tests/RunCMake/configure_file/RunCMakeTest.cmake b/Tests/RunCMake/configure_file/RunCMakeTest.cmake
index 32a0770..71694fb 100644
--- a/Tests/RunCMake/configure_file/RunCMakeTest.cmake
+++ b/Tests/RunCMake/configure_file/RunCMakeTest.cmake
@@ -15,6 +15,7 @@ run_cmake(NewLineStyle-NoArg)
run_cmake(NewLineStyle-WrongArg)
run_cmake(NewLineStyle-ValidArg)
run_cmake(NewLineStyle-COPYONLY)
+run_cmake(NoSourcePermissions)
if(RunCMake_GENERATOR MATCHES "Make")
# Use a single build tree for a few tests without cleaning.