Imported Upstream version 3.25.0
[platform/upstream/cmake.git] / Tests / RunCMake / XcodeProject / XcodeSchemaProperty-check.cmake
1 function(check_property property matcher)
2   set(schema "${RunCMake_TEST_BINARY_DIR}/XcodeSchemaProperty.xcodeproj/xcshareddata/xcschemes/${property}.xcscheme")
3   file(STRINGS ${schema} actual-${property}
4        REGEX "${matcher}" LIMIT_COUNT 1)
5   if(NOT actual-${property})
6     message(SEND_ERROR "Xcode schema property ${property}: Could not find ${matcher} in schema ${schema}")
7   endif()
8 endfunction()
9
10 function(expect_schema target)
11   set(schema "${RunCMake_TEST_BINARY_DIR}/XcodeSchemaProperty.xcodeproj/xcshareddata/xcschemes/${target}.xcscheme")
12   if(NOT EXISTS ${schema})
13     message(SEND_ERROR "Missing schema for target ${target}")
14   endif()
15 endfunction()
16
17 function(expect_no_schema target)
18   set(schema "${RunCMake_TEST_BINARY_DIR}/XcodeSchemaProperty.xcodeproj/xcshareddata/xcschemes/${target}.xcscheme")
19   if(EXISTS ${schema})
20     message(SEND_ERROR "Found unexpected schema ${schema}")
21   endif()
22 endfunction()
23
24 check_property("ADDRESS_SANITIZER" "enableAddressSanitizer")
25 check_property("ADDRESS_SANITIZER_USE_AFTER_RETURN" "enableASanStackUseAfterReturn")
26 check_property("THREAD_SANITIZER" "enableThreadSanitizer")
27 check_property("THREAD_SANITIZER_STOP" "stopOnEveryThreadSanitizerIssue")
28 check_property("UNDEFINED_BEHAVIOUR_SANITIZER" "enableUBSanitizer")
29 check_property("UNDEFINED_BEHAVIOUR_SANITIZER_STOP" "stopOnEveryUBSanitizerIssue")
30 check_property("DISABLE_MAIN_THREAD_CHECKER" "disableMainThreadChecker")
31 check_property("MAIN_THREAD_CHECKER_STOP" "stopOnEveryMainThreadCheckerIssue")
32 check_property("DISABLE_XCODE_SCHEME_ENABLE_GPU_API_VALIDATION" "enableGPUValidationMode")
33 check_property("ENABLE_XCODE_SCHEME_ENABLE_GPU_SHADER_VALIDATION" "enableGPUShaderValidationMode")
34
35 check_property("MALLOC_SCRIBBLE" "MallocScribble")
36 check_property("MALLOC_GUARD_EDGES" "MallocGuardEdges")
37 check_property("GUARD_MALLOC" "DYLD_INSERT_LIBRARIES")
38 check_property("ZOMBIE_OBJECTS" "NSZombieEnabled")
39 check_property("MALLOC_STACK" "MallocStackLogging")
40 check_property("DYNAMIC_LINKER_API_USAGE" "DYLD_PRINT_APIS")
41 check_property("DYNAMIC_LIBRARY_LOADS" "DYLD_PRINT_LIBRARIES")
42 check_property("ENABLE_GPU_FRAME_CAPTURE_MODE_1" "enableGPUFrameCaptureMode=\"1\"")
43 check_property("ENABLE_GPU_FRAME_CAPTURE_MODE_3" "enableGPUFrameCaptureMode=\"3\"")
44 check_property("ENABLE_GPU_FRAME_CAPTURE_MODE_DISABLED" "enableGPUFrameCaptureMode=\"3\"")
45 check_property("ENABLE_GPU_FRAME_CAPTURE_MODE_METAL" "enableGPUFrameCaptureMode=\"1\"")
46 check_property("ENABLE_GPU_FRAME_CAPTURE_MODE_DISABLED_MIXED_CASE" "enableGPUFrameCaptureMode=\"3\"")
47 check_property("ENABLE_GPU_FRAME_CAPTURE_MODE_METAL_MIXED_CASE" "enableGPUFrameCaptureMode=\"1\"")
48 check_property("LAUNCH_MODE_AUTO" "launchStyle=\"0\"")
49 check_property("LAUNCH_MODE_WAIT" "launchStyle=\"1\"")
50
51 check_property("EXECUTABLE" "myExecutable")
52 check_property("ARGUMENTS" [=["--foo"]=])
53 check_property("ARGUMENTS" [=["--bar=baz"]=])
54 check_property("ENVIRONMENT" [=[key="FOO"]=])
55 check_property("ENVIRONMENT" [=[value="foo"]=])
56 check_property("ENVIRONMENT" [=[key="BAR"]=])
57 check_property("ENVIRONMENT" [=[value="bar"]=])
58 check_property("WORKING_DIRECTORY" [=["/working/dir"]=])
59
60 expect_no_schema("NoSchema")
61
62 expect_schema("CustomTarget")
63 expect_schema("ALL_BUILD")