diff options
Diffstat (limited to 'Tests/RunCMake/XcodeProject')
7 files changed, 63 insertions, 0 deletions
diff --git a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake index 3b7b9f4..f89d620 100644 --- a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake +++ b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake @@ -4,6 +4,9 @@ run_cmake(XcodeFileType) run_cmake(XcodeAttributeGenex) run_cmake(XcodeAttributeGenexError) run_cmake(XcodeObjectNeedsQuote) +run_cmake(XcodeOptimizationFlags) +run_cmake(XcodePreserveNonOptimizationFlags) +run_cmake(XcodePreserveObjcFlag) if (NOT XCODE_VERSION VERSION_LESS 6) run_cmake(XcodePlatformFrameworks) endif() diff --git a/Tests/RunCMake/XcodeProject/XcodeOptimizationFlags-check.cmake b/Tests/RunCMake/XcodeProject/XcodeOptimizationFlags-check.cmake new file mode 100644 index 0000000..f5595b3 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/XcodeOptimizationFlags-check.cmake @@ -0,0 +1,7 @@ +foreach(level 1 2 3 s fast) + file(STRINGS ${RunCMake_TEST_BINARY_DIR}/XcodeOptimizationFlags.xcodeproj/project.pbxproj actual-${level} + REGEX "GCC_OPTIMIZATION_LEVEL = ${level};" LIMIT_COUNT 1) + if(NOT actual-${level}) + message(SEND_ERROR "Optimization level '${level}' not found in Xcode project.") + endif() +endforeach() diff --git a/Tests/RunCMake/XcodeProject/XcodeOptimizationFlags.cmake b/Tests/RunCMake/XcodeProject/XcodeOptimizationFlags.cmake new file mode 100644 index 0000000..e14bf80 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/XcodeOptimizationFlags.cmake @@ -0,0 +1,20 @@ +set(CMAKE_CONFIGURATION_TYPES "Release" CACHE INTERNAL "Supported configuration types") + +set(CMAKE_CXX_FLAGS_RELEASE "") + +project(XcodeOptimizationFlags CXX) + +add_library(fooO1 STATIC foo.cpp) +set_target_properties(fooO1 PROPERTIES COMPILE_OPTIONS -O1) + +add_library(fooO2 STATIC foo.cpp) +set_target_properties(fooO2 PROPERTIES COMPILE_OPTIONS -O2) + +add_library(fooO3 STATIC foo.cpp) +set_target_properties(fooO3 PROPERTIES COMPILE_OPTIONS -O3) + +add_library(fooOs STATIC foo.cpp) +set_target_properties(fooOs PROPERTIES COMPILE_OPTIONS -Os) + +add_library(fooOfast STATIC foo.cpp) +set_target_properties(fooOfast PROPERTIES COMPILE_OPTIONS -Ofast) diff --git a/Tests/RunCMake/XcodeProject/XcodePreserveNonOptimizationFlags-check.cmake b/Tests/RunCMake/XcodeProject/XcodePreserveNonOptimizationFlags-check.cmake new file mode 100644 index 0000000..2f6c03d --- /dev/null +++ b/Tests/RunCMake/XcodeProject/XcodePreserveNonOptimizationFlags-check.cmake @@ -0,0 +1,8 @@ +file(STRINGS ${RunCMake_TEST_BINARY_DIR}/XcodePreserveNonOptimizationFlags.xcodeproj/project.pbxproj actual + REGEX "OTHER_CPLUSPLUSFLAGS = [^;]*;") +foreach(expect "-DA" "-DB +-DC" "-DD") + if(NOT "${actual}" MATCHES "${expect}") + message(SEND_ERROR "The actual project contains the lines:\n ${actual}\n" + "which do not match expected regex:\n ${expect}\n") + endif() +endforeach() diff --git a/Tests/RunCMake/XcodeProject/XcodePreserveNonOptimizationFlags.cmake b/Tests/RunCMake/XcodeProject/XcodePreserveNonOptimizationFlags.cmake new file mode 100644 index 0000000..16f0381 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/XcodePreserveNonOptimizationFlags.cmake @@ -0,0 +1,12 @@ +set(CMAKE_CONFIGURATION_TYPES "Release" CACHE INTERNAL "Supported configuration types") + +project(XcodePreserveNonOptimizationFlags CXX) + +add_library(preserveStart STATIC foo.cpp) +set_property(TARGET preserveStart PROPERTY COMPILE_OPTIONS -DA -O1) + +add_library(preserveBoth STATIC foo.cpp) +set_property(TARGET preserveBoth PROPERTY COMPILE_OPTIONS -DB -O1 -DC) + +add_library(preserveEnd STATIC foo.cpp) +set_property(TARGET preserveEnd PROPERTY COMPILE_OPTIONS -O1 -DD) diff --git a/Tests/RunCMake/XcodeProject/XcodePreserveObjcFlag-check.cmake b/Tests/RunCMake/XcodeProject/XcodePreserveObjcFlag-check.cmake new file mode 100644 index 0000000..332906f --- /dev/null +++ b/Tests/RunCMake/XcodeProject/XcodePreserveObjcFlag-check.cmake @@ -0,0 +1,7 @@ +set(expect "-ObjC") +file(STRINGS ${RunCMake_TEST_BINARY_DIR}/XcodePreserveObjcFlag.xcodeproj/project.pbxproj actual + REGEX "OTHER_CPLUSPLUSFLAGS = [^;]*;" LIMIT_COUNT 1) +if(NOT "${actual}" MATCHES "${expect}") + message(SEND_ERROR "The actual project contains the line:\n ${actual}\n" + "which does not match expected regex:\n ${expect}\n") +endif() diff --git a/Tests/RunCMake/XcodeProject/XcodePreserveObjcFlag.cmake b/Tests/RunCMake/XcodeProject/XcodePreserveObjcFlag.cmake new file mode 100644 index 0000000..64db633 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/XcodePreserveObjcFlag.cmake @@ -0,0 +1,6 @@ +set(CMAKE_CONFIGURATION_TYPES "Release" CACHE INTERNAL "Supported configuration types") + +project(XcodePreserveObjcFlag CXX) + +add_library(foo STATIC foo.cpp) +set_target_properties(foo PROPERTIES COMPILE_OPTIONS -ObjC) |