diff options
author | Gregor Jasny <gjasny@googlemail.com> | 2018-07-29 19:37:18 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2018-08-01 13:12:42 (GMT) |
commit | 6b7f1e1db0d84d9d83a34c7aee94967526ed2b0b (patch) | |
tree | c1a0601913c23007b1bddf1e02e10f50f42e5094 /Tests/RunCMake/XcodeProject | |
parent | 39c91d07035d6fb8bddc6e02ee391a0f095e47ee (diff) | |
download | CMake-6b7f1e1db0d84d9d83a34c7aee94967526ed2b0b.zip CMake-6b7f1e1db0d84d9d83a34c7aee94967526ed2b0b.tar.gz CMake-6b7f1e1db0d84d9d83a34c7aee94967526ed2b0b.tar.bz2 |
Xcode: Add variables and properties to configure schemes
Add `XCODE_SCHEME_*` target properties and associated variables
`CMAKE_XCODE_SCHEME_*` to initialize them on target creation.
Map each target property value to an associated Xcode scheme entry.
Co-Author: Martin Sander <mail@martin-sander.de>
Fixes: #17919
Diffstat (limited to 'Tests/RunCMake/XcodeProject')
-rw-r--r-- | Tests/RunCMake/XcodeProject/RunCMakeTest.cmake | 1 | ||||
-rw-r--r-- | Tests/RunCMake/XcodeProject/XcodeSchemaProperty-check.cmake | 33 | ||||
-rw-r--r-- | Tests/RunCMake/XcodeProject/XcodeSchemaProperty.cmake | 37 |
3 files changed, 71 insertions, 0 deletions
diff --git a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake index 1150666..fb04005 100644 --- a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake +++ b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake @@ -219,6 +219,7 @@ endfunction() if(NOT XCODE_VERSION VERSION_LESS 7) XcodeSchemaGeneration() + run_cmake(XcodeSchemaProperty) endif() if(XCODE_VERSION VERSION_GREATER_EQUAL 8) diff --git a/Tests/RunCMake/XcodeProject/XcodeSchemaProperty-check.cmake b/Tests/RunCMake/XcodeProject/XcodeSchemaProperty-check.cmake new file mode 100644 index 0000000..f675d81 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/XcodeSchemaProperty-check.cmake @@ -0,0 +1,33 @@ +function(check_property property matcher) + set(schema "${RunCMake_TEST_BINARY_DIR}/XcodeSchemaProperty.xcodeproj/xcshareddata/xcschemes/${property}.xcscheme") + file(STRINGS ${schema} actual-${property} + REGEX "${matcher}" LIMIT_COUNT 1) + if(NOT actual-${property}) + message(SEND_ERROR "Xcode schema property ${property}: Could not find ${matcher} in schema ${schema}") + endif() +endfunction() + +check_property("ADDRESS_SANITIZER" "enableAddressSanitizer") +check_property("ADDRESS_SANITIZER_USE_AFTER_RETURN" "enableASanStackUseAfterReturn") +check_property("THREAD_SANITIZER" "enableThreadSanitizer") +check_property("THREAD_SANITIZER_STOP" "stopOnEveryThreadSanitizerIssue") +check_property("UNDEFINED_BEHAVIOUR_SANITIZER" "enableUBSanitizer") +check_property("UNDEFINED_BEHAVIOUR_SANITIZER_STOP" "stopOnEveryUBSanitizerIssue") +check_property("DISABLE_MAIN_THREAD_CHECKER" "disableMainThreadChecker") +check_property("MAIN_THREAD_CHECKER_STOP" "stopOnEveryMainThreadCheckerIssue") + +check_property("MALLOC_SCRIBBLE" "MallocScribble") +check_property("MALLOC_GUARD_EDGES" "MallocGuardEdges") +check_property("GUARD_MALLOC" "DYLD_INSERT_LIBRARIES") +check_property("ZOMBIE_OBJECTS" "NSZombieEnabled") +check_property("MALLOC_STACK" "MallocStackLogging") +check_property("DYNAMIC_LINKER_API_USAGE" "DYLD_PRINT_APIS") +check_property("DYNAMIC_LIBRARY_LOADS" "DYLD_PRINT_LIBRARIES") + +check_property("EXECUTABLE" "myExecutable") +check_property("ARGUMENTS" [=["--foo"]=]) +check_property("ARGUMENTS" [=["--bar=baz"]=]) +check_property("ENVIRONMENT" [=[key="FOO"]=]) +check_property("ENVIRONMENT" [=[value="foo"]=]) +check_property("ENVIRONMENT" [=[key="BAR"]=]) +check_property("ENVIRONMENT" [=[value="bar"]=]) diff --git a/Tests/RunCMake/XcodeProject/XcodeSchemaProperty.cmake b/Tests/RunCMake/XcodeProject/XcodeSchemaProperty.cmake new file mode 100644 index 0000000..2b72a64 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/XcodeSchemaProperty.cmake @@ -0,0 +1,37 @@ +cmake_minimum_required(VERSION 3.7) + +set(CMAKE_XCODE_GENERATE_SCHEME ON) + +project(XcodeSchemaProperty CXX) + +function(create_scheme_for_variable variable) + set(CMAKE_XCODE_SCHEME_${variable} ON) + add_executable(${variable} main.cpp) +endfunction() + +create_scheme_for_variable(ADDRESS_SANITIZER) +create_scheme_for_variable(ADDRESS_SANITIZER_USE_AFTER_RETURN) +create_scheme_for_variable(THREAD_SANITIZER) +create_scheme_for_variable(THREAD_SANITIZER_STOP) +create_scheme_for_variable(UNDEFINED_BEHAVIOUR_SANITIZER) +create_scheme_for_variable(UNDEFINED_BEHAVIOUR_SANITIZER_STOP) +create_scheme_for_variable(DISABLE_MAIN_THREAD_CHECKER) +create_scheme_for_variable(MAIN_THREAD_CHECKER_STOP) + +create_scheme_for_variable(MALLOC_SCRIBBLE) +create_scheme_for_variable(MALLOC_GUARD_EDGES) +create_scheme_for_variable(GUARD_MALLOC) +create_scheme_for_variable(ZOMBIE_OBJECTS) +create_scheme_for_variable(MALLOC_STACK) +create_scheme_for_variable(DYNAMIC_LINKER_API_USAGE) +create_scheme_for_variable(DYNAMIC_LIBRARY_LOADS) + +function(create_scheme_for_property property value) + set(XCODE_SCHEME_${property} ON) + add_executable(${property} main.cpp) + set_target_properties(${property} PROPERTIES XCODE_SCHEME_${property} "${value}") +endfunction() + +create_scheme_for_property(EXECUTABLE myExecutable) +create_scheme_for_property(ARGUMENTS "--foo;--bar=baz") +create_scheme_for_property(ENVIRONMENT "FOO=foo;BAR=bar") |