summaryrefslogtreecommitdiffstats
path: root/Source/cmServerProtocol.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmServerProtocol.cxx')
-rw-r--r--Source/cmServerProtocol.cxx45
1 files changed, 29 insertions, 16 deletions
diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx
index e159c8f..3776538 100644
--- a/Source/cmServerProtocol.cxx
+++ b/Source/cmServerProtocol.cxx
@@ -2,11 +2,11 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmServerProtocol.h"
-#include "cmCacheManager.h"
#include "cmExternalMakefileProjectGenerator.h"
#include "cmFileMonitor.h"
#include "cmGeneratorTarget.h"
#include "cmGlobalGenerator.h"
+#include "cmLinkLineComputer.h"
#include "cmListFileCache.h"
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
@@ -41,8 +41,9 @@ static std::vector<std::string> getConfigurations(const cmake* cm)
}
makefiles[0]->GetConfigurations(configurations);
- if (configurations.empty())
+ if (configurations.empty()) {
configurations.push_back("");
+ }
return configurations;
}
@@ -81,7 +82,7 @@ static void getCMakeInputs(const cmGlobalGenerator* gg,
std::vector<std::string>* tmpFiles)
{
const std::string cmakeRootDir = cmSystemTools::GetCMakeRoot() + '/';
- const std::vector<cmMakefile*> makefiles = gg->GetMakefiles();
+ std::vector<cmMakefile*> const& makefiles = gg->GetMakefiles();
for (auto it = makefiles.begin(); it != makefiles.end(); ++it) {
const std::vector<std::string> listFiles = (*it)->GetListFiles();
@@ -95,20 +96,24 @@ static void getCMakeInputs(const cmGlobalGenerator* gg,
if (!sourceDir.empty()) {
const std::string& relative =
cmSystemTools::RelativePath(sourceDir.c_str(), jt->c_str());
- if (toAdd.size() > relative.size())
+ if (toAdd.size() > relative.size()) {
toAdd = relative;
+ }
}
if (isInternal) {
- if (internalFiles)
+ if (internalFiles) {
internalFiles->push_back(toAdd);
+ }
} else {
if (isTemporary) {
- if (tmpFiles)
+ if (tmpFiles) {
tmpFiles->push_back(toAdd);
+ }
} else {
- if (explicitFiles)
+ if (explicitFiles) {
explicitFiles->push_back(toAdd);
+ }
}
}
}
@@ -665,7 +670,12 @@ static Json::Value DumpSourceFilesList(
cmLocalGenerator* lg = target->GetLocalGenerator();
std::string compileFlags = ld.Flags;
- lg->AppendFlags(compileFlags, file->GetProperty("COMPILE_FLAGS"));
+ if (const char* cflags = file->GetProperty("COMPILE_FLAGS")) {
+ cmGeneratorExpression ge;
+ const char* processed =
+ ge.Parse(cflags)->Evaluate(target->GetLocalGenerator(), config);
+ lg->AppendFlags(compileFlags, processed);
+ }
fileData.Flags = compileFlags;
fileData.IncludePathList = ld.IncludePathList;
@@ -689,8 +699,9 @@ static Json::Value DumpSourceFilesList(
Json::Value result = Json::arrayValue;
for (auto it = fileGroups.begin(); it != fileGroups.end(); ++it) {
Json::Value group = DumpSourceFileGroup(it->first, it->second, baseDir);
- if (!group.isNull())
+ if (!group.isNull()) {
result.append(group);
+ }
}
return result;
@@ -702,7 +713,7 @@ static Json::Value DumpTarget(cmGeneratorTarget* target,
cmLocalGenerator* lg = target->GetLocalGenerator();
const cmState* state = lg->GetState();
- const cmState::TargetType type = target->GetType();
+ const cmStateEnums::TargetType type = target->GetType();
const std::string typeName = state->GetTargetTypeName(type);
Json::Value ttl = Json::arrayValue;
@@ -746,8 +757,10 @@ static Json::Value DumpTarget(cmGeneratorTarget* target,
std::string linkLanguageFlags;
std::string frameworkPath;
std::string linkPath;
- lg->GetTargetFlags(config, linkLibs, linkLanguageFlags, linkFlags,
- frameworkPath, linkPath, target, false);
+ cmLinkLineComputer linkLineComputer(lg,
+ lg->GetStateSnapshot().GetDirectory());
+ lg->GetTargetFlags(&linkLineComputer, config, linkLibs, linkLanguageFlags,
+ linkFlags, frameworkPath, linkPath, target);
linkLibs = cmSystemTools::TrimWhitespace(linkLibs);
linkFlags = cmSystemTools::TrimWhitespace(linkFlags);
@@ -826,7 +839,7 @@ static Json::Value DumpTargetsList(
return result;
}
-static Json::Value DumpProjectList(const cmake* cm, const std::string config)
+static Json::Value DumpProjectList(const cmake* cm, std::string const& config)
{
Json::Value result = Json::arrayValue;
@@ -836,8 +849,8 @@ static Json::Value DumpProjectList(const cmake* cm, const std::string config)
Json::Value pObj = Json::objectValue;
pObj[kNAME_KEY] = projectIt.first;
- assert(projectIt.second.size() >
- 0); // All Projects must have at least one local generator
+ // All Projects must have at least one local generator
+ assert(!projectIt.second.empty());
const cmLocalGenerator* lg = projectIt.second.at(0);
// Project structure information:
@@ -1038,7 +1051,7 @@ cmServerResponse cmServerProtocol1_0::ProcessGlobalSettings(
}
static void setBool(const cmServerRequest& request, const std::string& key,
- std::function<void(bool)> setter)
+ std::function<void(bool)> const& setter)
{
if (request.Data[key].isNull()) {
return;