summaryrefslogtreecommitdiffstats
path: root/Source/cmCommonTargetGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-01-11 20:56:21 (GMT)
committerBrad King <brad.king@kitware.com>2017-01-12 18:35:48 (GMT)
commit47ffa0ea5d6cf08bd891d889ce67bee8008ebd8c (patch)
treef2430102fb6e9e809866951b169bf0f6d22cd956 /Source/cmCommonTargetGenerator.cxx
parent728820f3ea0faf55ffe1236a44a35e9197fc6291 (diff)
downloadCMake-47ffa0ea5d6cf08bd891d889ce67bee8008ebd8c.zip
CMake-47ffa0ea5d6cf08bd891d889ce67bee8008ebd8c.tar.gz
CMake-47ffa0ea5d6cf08bd891d889ce67bee8008ebd8c.tar.bz2
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
Diffstat (limited to 'Source/cmCommonTargetGenerator.cxx')
-rw-r--r--Source/cmCommonTargetGenerator.cxx7
1 files changed, 7 insertions, 0 deletions
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;
}