From 83703bda7d1017e1f75ec1b92d672d5ef17194d5 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 19 Oct 2015 00:34:23 +0200 Subject: cmGeneratorTarget: Copy IsExecutableWithExports from cmTarget. --- Source/cmComputeLinkInformation.cxx | 2 +- Source/cmComputeTargetDepends.cxx | 4 ++-- Source/cmExportBuildFileGenerator.cxx | 2 +- Source/cmExportFileGenerator.cxx | 2 +- Source/cmGeneratorTarget.cxx | 21 ++++++++++++++------- Source/cmGeneratorTarget.h | 2 ++ Source/cmLocalGenerator.cxx | 4 ++-- Source/cmMakefileExecutableTargetGenerator.cxx | 4 ++-- 8 files changed, 25 insertions(+), 16 deletions(-) diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index 2497f82..6ca15a3 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -635,7 +635,7 @@ void cmComputeLinkInformation::AddItem(std::string const& item, { // Compute the proper name to use to link this library. const std::string& config = this->Config; - bool impexe = (tgt && tgt->Target->IsExecutableWithExports()); + bool impexe = (tgt && tgt->IsExecutableWithExports()); if(impexe && !this->UseImportLibrary && !this->LoaderFlag) { // Skip linking to executables on platforms with no import diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx index a5a1f29..3541922 100644 --- a/Source/cmComputeTargetDepends.cxx +++ b/Source/cmComputeTargetDepends.cxx @@ -325,7 +325,7 @@ void cmComputeTargetDepends::AddInterfaceDepends(int depender_index, // within the project. if(dependee && dependee->GetType() == cmState::EXECUTABLE && - !dependee->Target->IsExecutableWithExports()) + !dependee->IsExecutableWithExports()) { dependee = 0; } @@ -401,7 +401,7 @@ void cmComputeTargetDepends::AddTargetDepend( // within the project. if(linking && dependee && dependee->GetType() == cmState::EXECUTABLE && - !dependee->Target->IsExecutableWithExports()) + !dependee->IsExecutableWithExports()) { dependee = 0; } diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx index 3af7b71..be65a19 100644 --- a/Source/cmExportBuildFileGenerator.cxx +++ b/Source/cmExportBuildFileGenerator.cxx @@ -220,7 +220,7 @@ cmExportBuildFileGenerator // Add the import library for windows DLLs. if(dll_platform && (target->GetType() == cmState::SHARED_LIBRARY || - target->Target->IsExecutableWithExports()) && + target->IsExecutableWithExports()) && mf->GetDefinition("CMAKE_IMPORT_LIBRARY_SUFFIX")) { std::string prop = "IMPORTED_IMPLIB"; diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index 5177ec8..c542f85 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -1075,7 +1075,7 @@ cmExportFileGenerator } // Mark the imported executable if it has exports. - if(target->Target->IsExecutableWithExports()) + if(target->IsExecutableWithExports()) { os << "set_property(TARGET " << targetName << " PROPERTY ENABLE_EXPORTS 1)\n"; diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index b2959fe..c68b84a 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -4571,7 +4571,7 @@ cmGeneratorTarget::GetLinkInterface(const std::string& config, // Link interfaces are not supported for executables that do not // export symbols. if(this->GetType() == cmState::EXECUTABLE && - !this->Target->IsExecutableWithExports()) + !this->IsExecutableWithExports()) { return 0; } @@ -4720,7 +4720,7 @@ cmGeneratorTarget::GetLinkInterfaceLibraries(const std::string& config, // Link interfaces are not supported for executables that do not // export symbols. if(this->GetType() == cmState::EXECUTABLE && - !this->Target->IsExecutableWithExports()) + !this->IsExecutableWithExports()) { return 0; } @@ -5031,7 +5031,7 @@ cmGeneratorTarget::ComputeLinkInterfaceLibraries( explicitLibraries = this->GetProperty(linkIfaceProp); } else if(this->GetType() == cmState::SHARED_LIBRARY || - this->Target->IsExecutableWithExports()) + this->IsExecutableWithExports()) { // CMP0022 OLD behavior is to use LINK_INTERFACE_LIBRARIES if set on a // shared lib or executable. @@ -5350,7 +5350,7 @@ void cmGeneratorTarget::ComputeImportInfo(std::string const& desired_config, info.ImportLibrary = imp; } else if(this->GetType() == cmState::SHARED_LIBRARY || - this->Target->IsExecutableWithExports()) + this->IsExecutableWithExports()) { std::string impProp = "IMPORTED_IMPLIB"; impProp += suffix; @@ -5858,7 +5858,7 @@ cmGeneratorTarget::FindTargetToLink(std::string const& name) const // name conflict between an external library and an executable // within the project. if(tgt && tgt->GetType() == cmState::EXECUTABLE && - !tgt->Target->IsExecutableWithExports()) + !tgt->IsExecutableWithExports()) { tgt = 0; } @@ -5914,11 +5914,18 @@ bool cmGeneratorTarget::GetImplibGNUtoMS(std::string const& gnuName, } //---------------------------------------------------------------------------- +bool cmGeneratorTarget::IsExecutableWithExports() const +{ + return (this->GetType() == cmState::EXECUTABLE && + this->GetPropertyAsBool("ENABLE_EXPORTS")); +} + +//---------------------------------------------------------------------------- bool cmGeneratorTarget::HasImportLibrary() const { return (this->Target->IsDLLPlatform() && (this->GetType() == cmState::SHARED_LIBRARY || - this->Target->IsExecutableWithExports())); + this->IsExecutableWithExports())); } //---------------------------------------------------------------------------- @@ -5944,7 +5951,7 @@ bool cmGeneratorTarget::IsLinkable() const this->GetType() == cmState::MODULE_LIBRARY || this->GetType() == cmState::UNKNOWN_LIBRARY || this->GetType() == cmState::INTERFACE_LIBRARY || - this->Target->IsExecutableWithExports()); + this->IsExecutableWithExports()); } //---------------------------------------------------------------------------- diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 6537421..a6b7f6e 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -406,6 +406,8 @@ public: bool GetImplibGNUtoMS(std::string const& gnuName, std::string& out, const char* newExt = 0) const; + bool IsExecutableWithExports() const; + /** Return whether or not the target has a DLL import library. */ bool HasImportLibrary() const; diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 9d5dd8e..deda88e 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1444,7 +1444,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs, this->Makefile->GetSafeDefinition("CMAKE_CREATE_CONSOLE_EXE"); linkFlags += " "; } - if (target->Target->IsExecutableWithExports()) + if (target->IsExecutableWithExports()) { std::string exportFlagVar = "CMAKE_EXE_EXPORTS_"; exportFlagVar += linkLanguage; @@ -2106,7 +2106,7 @@ void cmLocalGenerator std::string *pWarnCMP0063 = 0; if (target->GetType() != cmState::SHARED_LIBRARY && target->GetType() != cmState::MODULE_LIBRARY && - !target->Target->IsExecutableWithExports()) + !target->IsExecutableWithExports()) { switch (target->Target->GetPolicyStatusCMP0063()) { diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx index 31fb37b..020e64c 100644 --- a/Source/cmMakefileExecutableTargetGenerator.cxx +++ b/Source/cmMakefileExecutableTargetGenerator.cxx @@ -209,7 +209,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) } // Add symbol export flags if necessary. - if(this->Target->IsExecutableWithExports()) + if(this->GeneratorTarget->IsExecutableWithExports()) { std::string export_flag_var = "CMAKE_EXE_EXPORTS_"; export_flag_var += linkLanguage; @@ -297,7 +297,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) std::string linkRule = this->GetLinkRule(linkRuleVar); std::vector commands1; cmSystemTools::ExpandListArgument(linkRule, real_link_commands); - if(this->Target->IsExecutableWithExports()) + if(this->GeneratorTarget->IsExecutableWithExports()) { // If a separate rule for creating an import library is specified // add it now. -- cgit v0.12