summaryrefslogtreecommitdiff
path: root/Source/cmGlobalVisualStudioGenerator.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmGlobalVisualStudioGenerator.cxx')
-rw-r--r--Source/cmGlobalVisualStudioGenerator.cxx58
1 files changed, 46 insertions, 12 deletions
diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx
index 6296dd2632..cc2536c439 100644
--- a/Source/cmGlobalVisualStudioGenerator.cxx
+++ b/Source/cmGlobalVisualStudioGenerator.cxx
@@ -3,6 +3,9 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmGlobalVisualStudioGenerator.h"
+#include <cmsys/Encoding.hxx>
+#include <iostream>
+
#include "cmAlgorithms.h"
#include "cmCallVisualStudioMacro.h"
#include "cmGeneratedFileStream.h"
@@ -10,8 +13,8 @@
#include "cmLocalVisualStudioGenerator.h"
#include "cmMakefile.h"
#include "cmSourceFile.h"
+#include "cmState.h"
#include "cmTarget.h"
-#include <cmsys/Encoding.hxx>
cmGlobalVisualStudioGenerator::cmGlobalVisualStudioGenerator(cmake* cm)
: cmGlobalGenerator(cm)
@@ -81,7 +84,8 @@ void cmGlobalVisualStudioGenerator::AddExtraIDETargets()
for (std::vector<cmGeneratorTarget*>::iterator t = targets.begin();
t != targets.end(); ++t) {
cmGeneratorTarget* tgt = *t;
- if (tgt->GetType() == cmState::GLOBAL_TARGET || tgt->IsImported()) {
+ if (tgt->GetType() == cmStateEnums::GLOBAL_TARGET ||
+ tgt->IsImported()) {
continue;
}
if (!this->IsExcluded(gen[0], tgt)) {
@@ -265,11 +269,11 @@ cmGlobalVisualStudioGenerator::GetTargetLinkClosure(cmGeneratorTarget* target)
void cmGlobalVisualStudioGenerator::FollowLinkDepends(
const cmGeneratorTarget* target, std::set<const cmGeneratorTarget*>& linked)
{
- if (target->GetType() == cmState::INTERFACE_LIBRARY) {
+ if (target->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
return;
}
if (linked.insert(target).second &&
- target->GetType() == cmState::STATIC_LIBRARY) {
+ target->GetType() == cmStateEnums::STATIC_LIBRARY) {
// Static library targets do not list their link dependencies so
// we must follow them transitively now.
TargetDependSet const& depends = this->GetTargetDirectDepends(target);
@@ -304,7 +308,7 @@ bool cmGlobalVisualStudioGenerator::ComputeTargetDepends()
static bool VSLinkable(cmGeneratorTarget const* t)
{
- return t->IsLinkable() || t->GetType() == cmState::OBJECT_LIBRARY;
+ return t->IsLinkable() || t->GetType() == cmStateEnums::OBJECT_LIBRARY;
}
void cmGlobalVisualStudioGenerator::ComputeVSTargetDepends(
@@ -333,10 +337,10 @@ void cmGlobalVisualStudioGenerator::ComputeVSTargetDepends(
// leaving them out for the static library itself but following them
// transitively for other targets.
- bool allowLinkable = (target->GetType() != cmState::STATIC_LIBRARY &&
- target->GetType() != cmState::SHARED_LIBRARY &&
- target->GetType() != cmState::MODULE_LIBRARY &&
- target->GetType() != cmState::EXECUTABLE);
+ bool allowLinkable = (target->GetType() != cmStateEnums::STATIC_LIBRARY &&
+ target->GetType() != cmStateEnums::SHARED_LIBRARY &&
+ target->GetType() != cmStateEnums::MODULE_LIBRARY &&
+ target->GetType() != cmStateEnums::EXECUTABLE);
TargetDependSet const& depends = this->GetTargetDirectDepends(target);
@@ -344,7 +348,7 @@ void cmGlobalVisualStudioGenerator::ComputeVSTargetDepends(
// Static libraries cannot depend on their link implementation
// due to behavior (2), but they do not really need to.
std::set<cmGeneratorTarget const*> linkDepends;
- if (target->GetType() != cmState::STATIC_LIBRARY) {
+ if (target->GetType() != cmStateEnums::STATIC_LIBRARY) {
for (TargetDependSet::const_iterator di = depends.begin();
di != depends.end(); ++di) {
cmTargetDepend dep = *di;
@@ -367,7 +371,7 @@ void cmGlobalVisualStudioGenerator::ComputeVSTargetDepends(
// Collect all targets linked by this target so we can avoid
// intermediate targets below.
TargetSet linked;
- if (target->GetType() != cmState::STATIC_LIBRARY) {
+ if (target->GetType() != cmStateEnums::STATIC_LIBRARY) {
linked = this->GetTargetLinkClosure(target);
}
@@ -393,7 +397,7 @@ void cmGlobalVisualStudioGenerator::ComputeVSTargetDepends(
}
}
-void cmGlobalVisualStudioGenerator::FindMakeProgram(cmMakefile* mf)
+bool cmGlobalVisualStudioGenerator::FindMakeProgram(cmMakefile* mf)
{
// Visual Studio generators know how to lookup their build tool
// directly instead of needing a helper module to do it, so we
@@ -401,6 +405,7 @@ void cmGlobalVisualStudioGenerator::FindMakeProgram(cmMakefile* mf)
if (cmSystemTools::IsOff(mf->GetDefinition("CMAKE_MAKE_PROGRAM"))) {
mf->AddDefinition("CMAKE_MAKE_PROGRAM", this->GetVSMakeProgram().c_str());
}
+ return true;
}
std::string cmGlobalVisualStudioGenerator::GetUtilityDepend(
@@ -734,6 +739,27 @@ bool cmGlobalVisualStudioGenerator::TargetIsFortranOnly(
return false;
}
+bool cmGlobalVisualStudioGenerator::TargetIsCSharpOnly(
+ cmGeneratorTarget const* gt)
+{
+ // check to see if this is a C# build
+ std::set<std::string> languages;
+ {
+ // Issue diagnostic if the source files depend on the config.
+ std::vector<cmSourceFile*> sources;
+ if (!gt->GetConfigCommonSourceFiles(sources)) {
+ return false;
+ }
+ }
+ gt->GetLanguages(languages, "");
+ if (languages.size() == 1) {
+ if (*languages.begin() == "CSharp") {
+ return true;
+ }
+ }
+ return false;
+}
+
bool cmGlobalVisualStudioGenerator::TargetCompare::operator()(
cmGeneratorTarget const* l, cmGeneratorTarget const* r) const
{
@@ -830,6 +856,14 @@ void cmGlobalVisualStudioGenerator::AddSymbolExportCommand(
std::string objFile = obj_dir + map_it->second;
objs.push_back(objFile);
}
+ std::vector<cmSourceFile const*> externalObjectSources;
+ gt->GetExternalObjects(externalObjectSources, configName);
+ for (std::vector<cmSourceFile const*>::const_iterator it =
+ externalObjectSources.begin();
+ it != externalObjectSources.end(); ++it) {
+ objs.push_back((*it)->GetFullPath());
+ }
+
gt->UseObjectLibraries(objs, configName);
for (std::vector<std::string>::iterator it = objs.begin(); it != objs.end();
++it) {