mirror of
https://gitlab.kitware.com/cmake/cmake.git
synced 2026-09-25 04:09:36 +03:00
WINDOWS_EXPORT_ALL_SYMBOLS: Fix support for Visual Studio with ClangCL
Thread `CMAKE_NM` to the generated `__create_def` commands. Closes: #27994
This commit is contained in:
@@ -639,7 +639,7 @@ void cmFastbuildNormalTargetGenerator::GenerateModuleDefinitionInfo(
|
||||
std::string const obj_list_file = mdi->DefFile + ".objs";
|
||||
|
||||
auto const nm_executable = GetMakefile()->GetDefinition("CMAKE_NM");
|
||||
if (!nm_executable.IsEmpty()) {
|
||||
if (!cmIsOff(nm_executable)) {
|
||||
execNode.ExecArguments += " --nm=";
|
||||
execNode.ExecArguments += ConvertToFastbuildPath(*nm_executable);
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ public:
|
||||
std::string const& GetPlatformToolsetString() const;
|
||||
|
||||
/** Return true when using a Visual Studio clang-cl toolset. */
|
||||
bool IsClangClToolset() const;
|
||||
bool IsClangClToolset() const override;
|
||||
|
||||
/** The toolset version props file, if any. */
|
||||
std::string const& GetPlatformToolsetVersionProps() const;
|
||||
|
||||
@@ -733,6 +733,11 @@ void cmGlobalVisualStudioGenerator::AddSymbolExportCommand(
|
||||
|
||||
cmCustomCommandLines commandLines = cmMakeSingleCommandLine(
|
||||
{ cmakeCommand, "-E", "__create_def", mdi->DefFile, objs_file });
|
||||
cmValue const nmExecutable =
|
||||
gt->Target->GetMakefile()->GetDefinition("CMAKE_NM");
|
||||
if (!cmIsOff(nmExecutable) && this->IsClangClToolset()) {
|
||||
commandLines[0].emplace_back(cmStrCat("--nm=", *nmExecutable));
|
||||
}
|
||||
cmCustomCommand command;
|
||||
command.SetOutputs(outputs);
|
||||
command.SetCommandLines(commandLines);
|
||||
|
||||
@@ -156,6 +156,9 @@ public:
|
||||
protected:
|
||||
cmGlobalVisualStudioGenerator(cmake* cm);
|
||||
|
||||
/** Return true when using a Visual Studio clang-cl toolset. */
|
||||
virtual bool IsClangClToolset() const { return false; }
|
||||
|
||||
virtual bool InitializePlatform(cmMakefile* mf);
|
||||
|
||||
void AddExtraIDETargets() override;
|
||||
|
||||
@@ -2424,7 +2424,7 @@ void cmMakefileTargetGenerator::GenDefFile(
|
||||
this->LocalGenerator->MaybeRelativeToCurBinDir(objlist_file),
|
||||
cmOutputConverter::SHELL);
|
||||
cmValue const nm_executable = this->Makefile->GetDefinition("CMAKE_NM");
|
||||
if (cmNonempty(nm_executable)) {
|
||||
if (!cmIsOff(nm_executable)) {
|
||||
cmd += " --nm=";
|
||||
cmd += this->LocalCommonGenerator->ConvertToOutputFormat(
|
||||
*nm_executable, cmOutputConverter::SHELL);
|
||||
|
||||
@@ -1534,7 +1534,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement(
|
||||
obj_list_file, cmOutputConverter::SHELL);
|
||||
|
||||
cmValue nm_executable = this->GetMakefile()->GetDefinition("CMAKE_NM");
|
||||
if (cmNonempty(nm_executable)) {
|
||||
if (!cmIsOff(nm_executable)) {
|
||||
cmd += " --nm=";
|
||||
cmd += this->LocalCommonGenerator->ConvertToOutputFormat(
|
||||
*nm_executable, cmOutputConverter::SHELL);
|
||||
|
||||
Reference in New Issue
Block a user