From 47ffa0ea5d6cf08bd891d889ce67bee8008ebd8c Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 11 Jan 2017 15:56:21 -0500 Subject: Ninja: Do not use module definition `.def` files for static libraries A module definition (`.def`) file specifies symbols to export from a linked binary. The librarian tool is not a linker and so should not be given a `/DEF:...` flag with the `.def` file. The other generators already do not do this, so fix Ninja to be consistent. Closes: #16537 --- Source/cmCommonTargetGenerator.cxx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx index 7e113ab..239582f 100644 --- a/Source/cmCommonTargetGenerator.cxx +++ b/Source/cmCommonTargetGenerator.cxx @@ -63,6 +63,13 @@ void cmCommonTargetGenerator::AddFeatureFlags(std::string& flags, void cmCommonTargetGenerator::AddModuleDefinitionFlag( cmLinkLineComputer* linkLineComputer, std::string& flags) { + // A module definition file only makes sense on certain target types. + if (this->GeneratorTarget->GetType() != cmStateEnums::SHARED_LIBRARY && + this->GeneratorTarget->GetType() != cmStateEnums::MODULE_LIBRARY && + this->GeneratorTarget->GetType() != cmStateEnums::EXECUTABLE) { + return; + } + if (!this->ModuleDefinitionFile) { return; } -- cgit v0.12