summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2020-04-24 15:42:14 (GMT)
committerAlexandru Croitor <alexandru.croitor@qt.io>2020-05-14 14:31:22 (GMT)
commit3d4b70ea6474c8f29d6b5c057126582dcaad7ea7 (patch)
treed683c5a91d360982f740645dc45765b3b9d52089 /Tests/RunCMake
parent4dc95526868d903c7f9e9505001cb5dbeec259c0 (diff)
downloadCMake-3d4b70ea6474c8f29d6b5c057126582dcaad7ea7.zip
CMake-3d4b70ea6474c8f29d6b5c057126582dcaad7ea7.tar.gz
CMake-3d4b70ea6474c8f29d6b5c057126582dcaad7ea7.tar.bz2
set_source_files_properties: Allow specification of directory scope
Both set_source_files_properties() and set_property(SOURCE) now accept two new optional arguments: DIRECTORY and TARGET_DIRECTORY. The DIRECTORY option takes a list of relative or absolute paths pointing to processed source directories (add_subdirectory was already called on them). These paths specify directory scopes where the source file properties will be set. Previously the scope was always the currently processed source directory. Similarly TARGET_DIRECTORY takes a list of targets, whose source directories will be used as the list of scopes where to set the source file properties. get_property() and get_source_file_property() also get the same new arguments, except only one value can be specified instead of a list. Fixes: #20128
Diffstat (limited to 'Tests/RunCMake')
-rw-r--r--Tests/RunCMake/get_property/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/get_property/source_properties_failures-result.txt1
-rw-r--r--Tests/RunCMake/get_property/source_properties_failures-stderr.txt66
-rw-r--r--Tests/RunCMake/get_property/source_properties_failures.cmake14
-rw-r--r--Tests/RunCMake/set_property/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/set_property/SOURCE_FILE-result.txt1
-rw-r--r--Tests/RunCMake/set_property/SOURCE_FILE-stderr.txt22
-rw-r--r--Tests/RunCMake/set_property/SOURCE_FILE.cmake4
8 files changed, 110 insertions, 0 deletions
diff --git a/Tests/RunCMake/get_property/RunCMakeTest.cmake b/Tests/RunCMake/get_property/RunCMakeTest.cmake
index 6e36473..c4ee53d 100644
--- a/Tests/RunCMake/get_property/RunCMakeTest.cmake
+++ b/Tests/RunCMake/get_property/RunCMakeTest.cmake
@@ -5,6 +5,7 @@ run_cmake(directory_properties)
run_cmake(global_properties)
run_cmake(install_properties)
run_cmake(source_properties)
+run_cmake(source_properties_failures)
run_cmake(target_properties)
run_cmake(test_properties)
run_cmake(DebugConfigurations)
diff --git a/Tests/RunCMake/get_property/source_properties_failures-result.txt b/Tests/RunCMake/get_property/source_properties_failures-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/get_property/source_properties_failures-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/get_property/source_properties_failures-stderr.txt b/Tests/RunCMake/get_property/source_properties_failures-stderr.txt
new file mode 100644
index 0000000..a500e2e
--- /dev/null
+++ b/Tests/RunCMake/get_property/source_properties_failures-stderr.txt
@@ -0,0 +1,66 @@
+^CMake Error at source_properties_failures.cmake:1 \(set_source_files_properties\):
+ set_source_files_properties called with incorrect number of arguments no
+ value provided to the DIRECTORY option
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at source_properties_failures.cmake:2 \(set_source_files_properties\):
+ set_source_files_properties given non-existent DIRECTORY non_existing_dir
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at source_properties_failures.cmake:3 \(set_source_files_properties\):
+ set_source_files_properties called with incorrect number of arguments no
+ value provided to the TARGET_DIRECTORY option
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at source_properties_failures.cmake:4 \(set_source_files_properties\):
+ set_source_files_properties given non-existent target for DIRECTORY_TARGET
+ non_existing_target
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at source_properties_failures.cmake:6 \(get_property\):
+ get_property called with incorrect number of arguments no value provided to
+ the DIRECTORY option
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at source_properties_failures.cmake:7 \(get_property\):
+ get_property given non-existent DIRECTORY non_existing_dir
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at source_properties_failures.cmake:8 \(get_property\):
+ get_property called with incorrect number of arguments no value provided to
+ the TARGET_DIRECTORY option
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at source_properties_failures.cmake:9 \(get_property\):
+ get_property given non-existent target for DIRECTORY_TARGET
+ non_existing_dir
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at source_properties_failures.cmake:11 \(get_source_file_property\):
+ get_source_file_property given non-existent DIRECTORY PROPERTY
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at source_properties_failures.cmake:12 \(get_source_file_property\):
+ get_source_file_property called with incorrect number of arguments
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at source_properties_failures.cmake:13 \(get_source_file_property\):
+ get_source_file_property given non-existent target for DIRECTORY_TARGET
+ PROPERTY
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at source_properties_failures.cmake:14 \(get_source_file_property\):
+ get_source_file_property called with incorrect number of arguments
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/get_property/source_properties_failures.cmake b/Tests/RunCMake/get_property/source_properties_failures.cmake
new file mode 100644
index 0000000..f4b87f9
--- /dev/null
+++ b/Tests/RunCMake/get_property/source_properties_failures.cmake
@@ -0,0 +1,14 @@
+set_source_files_properties(a.txt DIRECTORY PROPERTIES COMPILE_DEFINITIONS "def")
+set_source_files_properties(a.txt DIRECTORY non_existing_dir PROPERTIES COMPILE_DEFINITIONS "def")
+set_source_files_properties(a.txt TARGET_DIRECTORY PROPERTIES COMPILE_DEFINITIONS "def")
+set_source_files_properties(a.txt TARGET_DIRECTORY non_existing_target PROPERTIES COMPILE_DEFINITIONS "def")
+
+get_property(in_var SOURCE a.txt DIRECTORY PROPERTY COMPILE_DEFINITIONS)
+get_property(in_var SOURCE a.txt DIRECTORY non_existing_dir PROPERTY COMPILE_DEFINITIONS)
+get_property(in_var SOURCE a.txt TARGET_DIRECTORY PROPERTY COMPILE_DEFINITIONS)
+get_property(in_var SOURCE a.txt TARGET_DIRECTORY non_existing_dir PROPERTY COMPILE_DEFINITIONS)
+
+get_source_file_property(in_var a.txt DIRECTORY PROPERTY COMPILE_DEFINITIONS)
+get_source_file_property(in_var a.txt DIRECTORY non_existing_dir PROPERTY COMPILE_DEFINITIONS)
+get_source_file_property(in_var a.txt TARGET_DIRECTORY PROPERTY COMPILE_DEFINITIONS)
+get_source_file_property(in_var a.txt TARGET_DIRECTORY non_existing_dir PROPERTY COMPILE_DEFINITIONS)
diff --git a/Tests/RunCMake/set_property/RunCMakeTest.cmake b/Tests/RunCMake/set_property/RunCMakeTest.cmake
index 8d4614c..692c6b9 100644
--- a/Tests/RunCMake/set_property/RunCMakeTest.cmake
+++ b/Tests/RunCMake/set_property/RunCMakeTest.cmake
@@ -9,6 +9,7 @@ run_cmake(LINK_OPTIONS)
run_cmake(LINK_DIRECTORIES)
run_cmake(LINK_LIBRARIES)
run_cmake(SOURCES)
+run_cmake(SOURCE_FILE)
run_cmake(TYPE)
run_cmake(USER_PROP)
run_cmake(USER_PROP_INHERITED)
diff --git a/Tests/RunCMake/set_property/SOURCE_FILE-result.txt b/Tests/RunCMake/set_property/SOURCE_FILE-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/set_property/SOURCE_FILE-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/set_property/SOURCE_FILE-stderr.txt b/Tests/RunCMake/set_property/SOURCE_FILE-stderr.txt
new file mode 100644
index 0000000..2e0b238
--- /dev/null
+++ b/Tests/RunCMake/set_property/SOURCE_FILE-stderr.txt
@@ -0,0 +1,22 @@
+^CMake Error at SOURCE_FILE.cmake:1 \(set_property\):
+ set_property called with incorrect number of arguments no value provided to
+ the DIRECTORY option
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at SOURCE_FILE.cmake:2 \(set_property\):
+ set_property given non-existent DIRECTORY non_existing_dir
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at SOURCE_FILE.cmake:3 \(set_property\):
+ set_property called with incorrect number of arguments no value provided to
+ the TARGET_DIRECTORY option
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at SOURCE_FILE.cmake:4 \(set_property\):
+ set_property given non-existent target for DIRECTORY_TARGET
+ non_existing_target
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/set_property/SOURCE_FILE.cmake b/Tests/RunCMake/set_property/SOURCE_FILE.cmake
new file mode 100644
index 0000000..b1d78bd
--- /dev/null
+++ b/Tests/RunCMake/set_property/SOURCE_FILE.cmake
@@ -0,0 +1,4 @@
+set_property(SOURCE a.txt DIRECTORY PROPERTY COMPILE_DEFINITIONS "def")
+set_property(SOURCE a.txt DIRECTORY non_existing_dir PROPERTY COMPILE_DEFINITIONS "def")
+set_property(SOURCE a.txt TARGET_DIRECTORY PROPERTY COMPILE_DEFINITIONS "def")
+set_property(SOURCE a.txt TARGET_DIRECTORY non_existing_target PROPERTY COMPILE_DEFINITIONS "def")