Xcode: Fix "clean" operation under the "new build system"

Previously we set `SYMROOT` to tell Xcode where to place the build
products.  However, the "clean" operation in the Xcode "new build
system" expects that only Xcode creates the `SYMROOT` directory or
contents inside it.  Since we create that directory, "clean" fails.

We now explicitly set `CONFIGURATION_BUILD_DIR` and `TARGET_TEMP_DIR`
instead of letting Xcode compute their values from `SYMROOT`, so we no
longer need to set the latter.  Drop the now-unnecessary `SYMROOT`.

Fixes: #22550
This commit is contained in:
Brad King
2022-09-29 14:44:01 -04:00
parent dc5fc898f6
commit d0a6ebf57b
5 changed files with 11 additions and 1 deletions

View File

@@ -2552,7 +2552,6 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
// Store the product name for all target types.
buildSettings->AddAttribute("PRODUCT_NAME", this->CreateString(realName));
buildSettings->AddAttribute("SYMROOT", this->CreateString(pndir));
// Handle settings for each target type.
switch (gtgt->GetType()) {

View File

@@ -0,0 +1,2 @@
enable_language(C)
add_subdirectory(Clean)

View File

@@ -0,0 +1 @@
add_library(empty empty.c)

View File

@@ -1,5 +1,13 @@
include(RunCMake)
function(RunClean)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Clean-build)
run_cmake(Clean)
set(RunCMake_TEST_NO_CLEAN 1)
run_cmake_command(Clean-build xcodebuild clean)
endfunction()
RunClean()
run_cmake(ExplicitCMakeLists)
run_cmake(ImplicitCMakeLists)
run_cmake(InterfaceLibSources)