be44ecdbba6c12f043b0893263f71c9e672e9a41
[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
33 check_property("MALLOC_SCRIBBLE" "MallocScribble")
34 check_property("MALLOC_GUARD_EDGES" "MallocGuardEdges")
35 check_property("GUARD_MALLOC" "DYLD_INSERT_LIBRARIES")
36 check_property("ZOMBIE_OBJECTS" "NSZombieEnabled")
37 check_property("MALLOC_STACK" "MallocStackLogging")
38 check_property("DYNAMIC_LINKER_API_USAGE" "DYLD_PRINT_APIS")
39 check_property("DYNAMIC_LIBRARY_LOADS" "DYLD_PRINT_LIBRARIES")
40 check_property("ENABLE_GPU_FRAME_CAPTURE_MODE_1" "enableGPUFrameCaptureMode=\"1\"")
41 check_property("ENABLE_GPU_FRAME_CAPTURE_MODE_3" "enableGPUFrameCaptureMode=\"3\"")
42 check_property("ENABLE_GPU_FRAME_CAPTURE_MODE_DISABLED" "enableGPUFrameCaptureMode=\"3\"")
43 check_property("ENABLE_GPU_FRAME_CAPTURE_MODE_METAL" "enableGPUFrameCaptureMode=\"1\"")
44 check_property("ENABLE_GPU_FRAME_CAPTURE_MODE_DISABLED_MIXED_CASE" "enableGPUFrameCaptureMode=\"3\"")
45 check_property("ENABLE_GPU_FRAME_CAPTURE_MODE_METAL_MIXED_CASE" "enableGPUFrameCaptureMode=\"1\"")
46
47 check_property("EXECUTABLE" "myExecutable")
48 check_property("ARGUMENTS" [=["--foo"]=])
49 check_property("ARGUMENTS" [=["--bar=baz"]=])
50 check_property("ENVIRONMENT" [=[key="FOO"]=])
51 check_property("ENVIRONMENT" [=[value="foo"]=])
52 check_property("ENVIRONMENT" [=[key="BAR"]=])
53 check_property("ENVIRONMENT" [=[value="bar"]=])
54 check_property("WORKING_DIRECTORY" [=["/working/dir"]=])
55
56 expect_no_schema("NoSchema")
57
58 expect_schema("CustomTarget")
59 expect_schema("ALL_BUILD")