summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalXCodeGenerator.cxx
diff options
context:
space:
mode:
authorMarc Chevrier <marc.chevrier@gmail.com>2023-02-01 16:58:30 (GMT)
committerMarc Chevrier <marc.chevrier@gmail.com>2023-03-01 11:23:28 (GMT)
commitede33f30cfef9e03ecccdb9ce4c7fdf1e8208d75 (patch)
tree338052612b36c9394f6f0ad71bab57109cf60957 /Source/cmGlobalXCodeGenerator.cxx
parentfcbd723a5085c11c57ec966f8aea605a55d0bdd5 (diff)
downloadCMake-ede33f30cfef9e03ecccdb9ce4c7fdf1e8208d75.zip
CMake-ede33f30cfef9e03ecccdb9ce4c7fdf1e8208d75.tar.gz
CMake-ede33f30cfef9e03ecccdb9ce4c7fdf1e8208d75.tar.bz2
Apple: Handle generation and comsuption of text-based stubs (.tbd files)
Fixes: #24123
Diffstat (limited to 'Source/cmGlobalXCodeGenerator.cxx')
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx29
1 files changed, 28 insertions, 1 deletions
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index d4ce69e..5b3ac60 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -1739,7 +1739,7 @@ void cmGlobalXCodeGenerator::CreateCustomCommands(
std::string str_so_file =
cmStrCat("$<TARGET_SONAME_FILE:", gtgt->GetName(), '>');
std::string str_link_file =
- cmStrCat("$<TARGET_LINKER_FILE:", gtgt->GetName(), '>');
+ cmStrCat("$<TARGET_LINKER_LIBRARY_FILE:", gtgt->GetName(), '>');
cmCustomCommandLines cmd = cmMakeSingleCommandLine(
{ cmSystemTools::GetCMakeCommand(), "-E", "cmake_symlink_library",
str_file, str_so_file, str_link_file });
@@ -1754,6 +1754,27 @@ void cmGlobalXCodeGenerator::CreateCustomCommands(
postbuild.push_back(std::move(command));
}
+ if (gtgt->HasImportLibrary("") && !gtgt->IsFrameworkOnApple()) {
+ // create symbolic links for .tbd file
+ std::string file = cmStrCat("$<TARGET_IMPORT_FILE:", gtgt->GetName(), '>');
+ std::string soFile =
+ cmStrCat("$<TARGET_SONAME_IMPORT_FILE:", gtgt->GetName(), '>');
+ std::string linkFile =
+ cmStrCat("$<TARGET_LINKER_IMPORT_FILE:", gtgt->GetName(), '>');
+ cmCustomCommandLines symlink_command = cmMakeSingleCommandLine(
+ { cmSystemTools::GetCMakeCommand(), "-E", "cmake_symlink_library", file,
+ soFile, linkFile });
+
+ cmCustomCommand command;
+ command.SetCommandLines(symlink_command);
+ command.SetComment("Creating import symlinks");
+ command.SetWorkingDirectory("");
+ command.SetBacktrace(this->CurrentMakefile->GetBacktrace());
+ command.SetStdPipesUTF8(true);
+
+ postbuild.push_back(std::move(command));
+ }
+
cmXCodeObject* legacyCustomCommandsBuildPhase = nullptr;
cmXCodeObject* preBuildPhase = nullptr;
cmXCodeObject* preLinkPhase = nullptr;
@@ -2682,6 +2703,12 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
buildSettings->AddAttribute("LIBRARY_STYLE",
this->CreateString("DYNAMIC"));
+
+ if (gtgt->HasImportLibrary(configName)) {
+ // Request .tbd file generation
+ buildSettings->AddAttribute("GENERATE_TEXT_BASED_STUBS",
+ this->CreateString("YES"));
+ }
break;
}
case cmStateEnums::EXECUTABLE: {