summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/XcodeProject-Embed/findAttribute.cmake
diff options
context:
space:
mode:
authorCraig Scott <craig.scott@crascit.com>2021-04-11 08:05:14 (GMT)
committerCraig Scott <craig.scott@crascit.com>2021-04-11 08:06:16 (GMT)
commitf62a2bf44f392f6a23836848714ed36cd02975af (patch)
tree704729842548d71750291fb1390e323950b0a6de /Tests/RunCMake/XcodeProject-Embed/findAttribute.cmake
parent6e7ff52af74cfbff15ded5c3aba7097499dffd32 (diff)
downloadCMake-f62a2bf44f392f6a23836848714ed36cd02975af.zip
CMake-f62a2bf44f392f6a23836848714ed36cd02975af.tar.gz
CMake-f62a2bf44f392f6a23836848714ed36cd02975af.tar.bz2
Tests: Factor out XcodeProject-Embed check function findAttribute()
Diffstat (limited to 'Tests/RunCMake/XcodeProject-Embed/findAttribute.cmake')
-rw-r--r--Tests/RunCMake/XcodeProject-Embed/findAttribute.cmake19
1 files changed, 19 insertions, 0 deletions
diff --git a/Tests/RunCMake/XcodeProject-Embed/findAttribute.cmake b/Tests/RunCMake/XcodeProject-Embed/findAttribute.cmake
new file mode 100644
index 0000000..b1963e2
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject-Embed/findAttribute.cmake
@@ -0,0 +1,19 @@
+cmake_policy(VERSION 3.1...3.20)
+
+function(findAttribute project attr expectPresent)
+ execute_process(
+ COMMAND grep ${attr} ${RunCMake_TEST_BINARY_DIR}/${project}.xcodeproj/project.pbxproj
+ OUTPUT_VARIABLE output_var
+ RESULT_VARIABLE result_var
+ )
+
+ if(${expectPresent})
+ if(result_var)
+ set(RunCMake_TEST_FAILED "${attr} attribute is not set" PARENT_SCOPE)
+ endif()
+ else()
+ if(NOT result_var)
+ set(RunCMake_TEST_FAILED "${attr} attribute is set" PARENT_SCOPE)
+ endif()
+ endif()
+endfunction()