diff options
author | Wil Stark <wil_stark@keysight.com> | 2019-02-19 23:02:34 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-02-25 14:14:15 (GMT) |
commit | 917c035ada212cec47f92b51449b554526119372 (patch) | |
tree | 0aac592abaa8f35ec58acf03a082514241260103 /Source | |
parent | 7574e16096abe57d44cde4e6380a22d940cde98c (diff) | |
download | CMake-917c035ada212cec47f92b51449b554526119372.zip CMake-917c035ada212cec47f92b51449b554526119372.tar.gz CMake-917c035ada212cec47f92b51449b554526119372.tar.bz2 |
VS: support suppressing deployment of selected targets
Add a `VS_NO_SOLUTION_DEPLOY` target property to explicitly specify for
each target whether to suppress VS solution deployment of the generated
target project.
Fixes: #18953
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmGlobalVisualStudio11Generator.cxx | 11 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudio11Generator.h | 4 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudio8Generator.cxx | 31 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudio8Generator.h | 10 |
4 files changed, 40 insertions, 16 deletions
diff --git a/Source/cmGlobalVisualStudio11Generator.cxx b/Source/cmGlobalVisualStudio11Generator.cxx index 4eb78ba..4b74ef1 100644 --- a/Source/cmGlobalVisualStudio11Generator.cxx +++ b/Source/cmGlobalVisualStudio11Generator.cxx @@ -252,15 +252,10 @@ cmGlobalVisualStudio11Generator::GetInstalledWindowsCESDKs() return ret; } -bool cmGlobalVisualStudio11Generator::NeedsDeploy( - cmStateEnums::TargetType type) const +bool cmGlobalVisualStudio11Generator::TargetSystemSupportsDeployment() const { - if ((type == cmStateEnums::EXECUTABLE || - type == cmStateEnums::SHARED_LIBRARY) && - (this->SystemIsWindowsPhone || this->SystemIsWindowsStore)) { - return true; - } - return cmGlobalVisualStudio10Generator::NeedsDeploy(type); + return this->SystemIsWindowsPhone || this->SystemIsWindowsStore || + cmGlobalVisualStudio10Generator::TargetSystemSupportsDeployment(); } bool cmGlobalVisualStudio11Generator::IsWindowsDesktopToolsetInstalled() const diff --git a/Source/cmGlobalVisualStudio11Generator.h b/Source/cmGlobalVisualStudio11Generator.h index 8b4c8b7..f8cce18 100644 --- a/Source/cmGlobalVisualStudio11Generator.h +++ b/Source/cmGlobalVisualStudio11Generator.h @@ -45,8 +45,8 @@ protected: bool UseFolderProperty() const override; static std::set<std::string> GetInstalledWindowsCESDKs(); - /** Return true if the configuration needs to be deployed */ - bool NeedsDeploy(cmStateEnums::TargetType type) const override; + /** Return true if target system supports debugging deployment. */ + bool TargetSystemSupportsDeployment() const override; private: class Factory; diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index f6db018..f3e73d3 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -273,7 +273,7 @@ void cmGlobalVisualStudio8Generator::WriteProjectConfigurations( : this->GetPlatformName()) << "\n"; } - if (this->NeedsDeploy(target.GetType())) { + if (this->NeedsDeploy(target, dstConfig)) { fout << "\t\t{" << guid << "}." << i << "|" << this->GetPlatformName() << ".Deploy.0 = " << dstConfig << "|" << (!platformMapping.empty() ? platformMapping @@ -284,11 +284,32 @@ void cmGlobalVisualStudio8Generator::WriteProjectConfigurations( } bool cmGlobalVisualStudio8Generator::NeedsDeploy( - cmStateEnums::TargetType type) const + cmGeneratorTarget const& target, const char* config) const { - bool needsDeploy = - (type == cmStateEnums::EXECUTABLE || type == cmStateEnums::SHARED_LIBRARY); - return this->TargetsWindowsCE() && needsDeploy; + cmStateEnums::TargetType type = target.GetType(); + bool noDeploy = DeployInhibited(target, config); + return !noDeploy && + (type == cmStateEnums::EXECUTABLE || + type == cmStateEnums::SHARED_LIBRARY) && + this->TargetSystemSupportsDeployment(); +} + +bool cmGlobalVisualStudio8Generator::DeployInhibited( + cmGeneratorTarget const& target, const char* config) const +{ + bool rVal = false; + if (const char* propStr = target.GetProperty("VS_NO_SOLUTION_DEPLOY")) { + cmGeneratorExpression ge; + std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(propStr); + std::string prop = cge->Evaluate(target.LocalGenerator, config); + rVal = cmSystemTools::IsOn(prop); + } + return rVal; +} + +bool cmGlobalVisualStudio8Generator::TargetSystemSupportsDeployment() const +{ + return this->TargetsWindowsCE(); } bool cmGlobalVisualStudio8Generator::ComputeTargetDepends() diff --git a/Source/cmGlobalVisualStudio8Generator.h b/Source/cmGlobalVisualStudio8Generator.h index 8719bf3..75f4778 100644 --- a/Source/cmGlobalVisualStudio8Generator.h +++ b/Source/cmGlobalVisualStudio8Generator.h @@ -54,7 +54,15 @@ protected: bool AddCheckTarget(); /** Return true if the configuration needs to be deployed */ - virtual bool NeedsDeploy(cmStateEnums::TargetType type) const; + virtual bool NeedsDeploy(cmGeneratorTarget const& target, + const char* config) const; + + /** Returns true if deployment has been disabled in cmake file. */ + bool DeployInhibited(cmGeneratorTarget const& target, + const char* config) const; + + /** Returns true if the target system support debugging deployment. */ + virtual bool TargetSystemSupportsDeployment() const; static cmIDEFlagTable const* GetExtraFlagTableVS8(); void WriteSolutionConfigurations( |