summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2023-01-26 14:15:48 (GMT)
committerKitware Robot <kwrobot@kitware.com>2023-01-26 14:15:57 (GMT)
commit6dca2dd86dfbbdb7199b88e7d34318b92c862b41 (patch)
tree446399cc183d6745f69e0f5ec0cdf7b734f5be21
parentd693c35ea64046a38f32159b587ca685ad6ffc97 (diff)
parent01c1d81527aec261445fa533d5f92ca473f77160 (diff)
downloadCMake-6dca2dd86dfbbdb7199b88e7d34318b92c862b41.zip
CMake-6dca2dd86dfbbdb7199b88e7d34318b92c862b41.tar.gz
CMake-6dca2dd86dfbbdb7199b88e7d34318b92c862b41.tar.bz2
Merge topic 'xcode-swift-inherited-flags'
01c1d81527 Xcode: Inherit Swift flags and compilation conditions Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !8122
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx3
-rw-r--r--Tests/RunCMake/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/XcodeProject/InheritedParameters-check.cmake24
-rw-r--r--Tests/RunCMake/XcodeProject/InheritedParameters.cmake5
-rw-r--r--Tests/RunCMake/XcodeProject/RunCMakeTest.cmake2
5 files changed, 35 insertions, 2 deletions
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 5f28fc6..8e6e706 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -4536,6 +4536,9 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects(
this->InheritBuildSettingAttribute(t, "GCC_PREPROCESSOR_DEFINITIONS");
this->InheritBuildSettingAttribute(t, "OTHER_CFLAGS");
this->InheritBuildSettingAttribute(t, "OTHER_LDFLAGS");
+ this->InheritBuildSettingAttribute(t, "OTHER_SWIFT_FLAGS");
+ this->InheritBuildSettingAttribute(t,
+ "SWIFT_ACTIVE_COMPILATION_CONDITIONS");
}
if (this->XcodeBuildSystem == BuildSystem::One) {
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index d5c07dd..be6c5b1 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -636,7 +636,8 @@ if(CMAKE_GENERATOR MATCHES "^Visual Studio (1[6-9]|[2-9][0-9])")
endif()
if(XCODE_VERSION)
- add_RunCMake_test(XcodeProject -DXCODE_VERSION=${XCODE_VERSION})
+ add_RunCMake_test(XcodeProject -DXCODE_VERSION=${XCODE_VERSION}
+ -DCMake_TEST_Swift=${CMake_TEST_Swift})
add_RunCMake_test(XcodeProject-Embed -DXCODE_VERSION=${XCODE_VERSION})
# This test can take a very long time due to lots of combinations.
diff --git a/Tests/RunCMake/XcodeProject/InheritedParameters-check.cmake b/Tests/RunCMake/XcodeProject/InheritedParameters-check.cmake
index 4fe42ac..59e3f4b 100644
--- a/Tests/RunCMake/XcodeProject/InheritedParameters-check.cmake
+++ b/Tests/RunCMake/XcodeProject/InheritedParameters-check.cmake
@@ -7,6 +7,8 @@ endif()
set(found_inherited_GCC_PREPROCESSOR_DEFINITIONS 1)
set(found_inherited_OTHER_CFLAGS 1)
set(found_inherited_OTHER_LDFLAGS 1)
+set(found_inherited_OTHER_SWIFT_FLAGS 1)
+set(found_inherited_SWIFT_ACTIVE_COMPILATION_CONDITIONS 1)
file(STRINGS "${xcProjectFile}" lines)
foreach(line IN LISTS lines)
@@ -32,6 +34,20 @@ foreach(line IN LISTS lines)
endif()
endif()
+ if(line MATCHES [[OTHER_SWIFT_FLAGS]])
+ if(NOT line MATCHES [["\$\(inherited\)"]])
+ string(APPEND relevant_lines " ${line}\n")
+ set(found_inherited_OTHER_SWIFT_FLAGS 0)
+ endif()
+ endif()
+
+ if(line MATCHES [[SWIFT_ACTIVE_COMPILATION_CONDITIONS]])
+ if(NOT line MATCHES [["\$\(inherited\)"]])
+ string(APPEND relevant_lines " ${line}\n")
+ set(found_inherited_SWIFT_ACTIVE_COMPILATION_CONDITIONS 0)
+ endif()
+ endif()
+
endforeach()
if(NOT found_inherited_GCC_PREPROCESSOR_DEFINITIONS)
@@ -43,6 +59,14 @@ endif()
if(NOT found_inherited_OTHER_LDFLAGS)
string(APPEND RunCMake_TEST_FAILED "Found missing inherited value for OTHER_LDFLAGS in\n ${xcProjectFile}\n")
endif()
+if(CMake_TEST_Swift)
+ if(NOT found_inherited_OTHER_SWIFT_FLAGS)
+ string(APPEND RunCMake_TEST_FAILED "Found missing inherited value for OTHER_SWIFT_FLAGS in\n ${xcProjectFile}\n")
+ endif()
+ if(NOT found_inherited_SWIFT_ACTIVE_COMPILATION_CONDITIONS)
+ string(APPEND RunCMake_TEST_FAILED "Found missing inherited value for SWIFT_ACTIVE_COMPILATION_CONDITIONS in\n ${xcProjectFile}\n")
+ endif()
+endif()
if(RunCMake_TEST_FAILED)
string(APPEND RunCMake_TEST_FAILED "Relevant lines include\n${relevant_lines}")
diff --git a/Tests/RunCMake/XcodeProject/InheritedParameters.cmake b/Tests/RunCMake/XcodeProject/InheritedParameters.cmake
index 5b8ec71..e2cc2a7 100644
--- a/Tests/RunCMake/XcodeProject/InheritedParameters.cmake
+++ b/Tests/RunCMake/XcodeProject/InheritedParameters.cmake
@@ -1,4 +1,9 @@
enable_language(C)
+if(CMake_TEST_Swift)
+ enable_language(Swift)
+ string(APPEND CMAKE_Swift_FLAGS " -DSWIFTFLAG")
+ add_executable(swift_inherit_test dummy_main.swift)
+endif()
add_compile_definitions(TEST_INHERITTEST)
string(APPEND CMAKE_C_FLAGS " -DTESTFLAG=\\\"TEST_INHERITTEST\\\"")
diff --git a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake
index 573d5f7..3910127 100644
--- a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake
+++ b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake
@@ -13,7 +13,7 @@ run_cmake(ExplicitCMakeLists)
run_cmake(ImplicitCMakeLists)
run_cmake(InterfaceLibSources)
run_cmake_with_options(SearchPaths -DCMAKE_CONFIGURATION_TYPES=Debug)
-run_cmake(InheritedParameters)
+run_cmake_with_options(InheritedParameters -DCMake_TEST_Swift=${CMake_TEST_Swift})
run_cmake(XcodeFileType)
run_cmake(XcodeAttributeLocation)