mirror of
https://github.com/Kitware/CMake.git
synced 2026-04-26 16:18:43 -05:00
Apple: Handle generation and comsuption of text-based stubs (.tbd files)
Fixes: #24123
This commit is contained in:
@@ -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: {
|
||||
|
||||
Reference in New Issue
Block a user