Commit f62a2bf4 authored by Craig Scott's avatar Craig Scott
Browse files

Tests: Factor out XcodeProject-Embed check function findAttribute()

parent 6e7ff52a
function(findAttribute project attr)
execute_process(
COMMAND grep ${attr} ${RunCMake_TEST_BINARY_DIR}/${project}.xcodeproj/project.pbxproj
OUTPUT_VARIABLE output_var
RESULT_VARIABLE result_var
)
include(${CMAKE_CURRENT_LIST_DIR}/findAttribute.cmake)
if(NOT result_var)
set(RunCMake_TEST_FAILED "${attr} attribute is set" PARENT_SCOPE)
endif()
endfunction()
findAttribute(${test} "RemoveHeadersOnCopy")
findAttribute(${test} "CodeSignOnCopy")
findAttribute(${test} "RemoveHeadersOnCopy" FALSE)
findAttribute(${test} "CodeSignOnCopy" FALSE)
function(findAttribute project attr)
execute_process(
COMMAND grep ${attr} ${RunCMake_TEST_BINARY_DIR}/${project}.xcodeproj/project.pbxproj
OUTPUT_VARIABLE output_var
RESULT_VARIABLE result_var
)
include(${CMAKE_CURRENT_LIST_DIR}/findAttribute.cmake)
if(result_var)
set(RunCMake_TEST_FAILED "${attr} attribute not set" PARENT_SCOPE)
endif()
endfunction()
findAttribute(${test} "RemoveHeadersOnCopy")
findAttribute(${test} "CodeSignOnCopy")
findAttribute(${test} "RemoveHeadersOnCopy" TRUE)
findAttribute(${test} "CodeSignOnCopy" TRUE)
function(findAttribute project attr)
execute_process(
COMMAND grep ${attr} ${RunCMake_TEST_BINARY_DIR}/${project}.xcodeproj/project.pbxproj
OUTPUT_VARIABLE output_var
RESULT_VARIABLE result_var
)
include(${CMAKE_CURRENT_LIST_DIR}/findAttribute.cmake)
if(result_var)
set(RunCMake_TEST_FAILED "${attr} attribute not set" PARENT_SCOPE)
endif()
endfunction()
findAttribute(${test} "RemoveHeadersOnCopy")
findAttribute(${test} "CodeSignOnCopy")
findAttribute(${test} "RemoveHeadersOnCopy" TRUE)
findAttribute(${test} "CodeSignOnCopy" TRUE)
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()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment