summaryrefslogtreecommitdiff
path: root/Source/cmJsonObjects.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmJsonObjects.cxx')
-rw-r--r--Source/cmJsonObjects.cxx69
1 files changed, 34 insertions, 35 deletions
diff --git a/Source/cmJsonObjects.cxx b/Source/cmJsonObjects.cxx
index 636a8e1c20..b23ab43d82 100644
--- a/Source/cmJsonObjects.cxx
+++ b/Source/cmJsonObjects.cxx
@@ -2,6 +2,18 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmJsonObjects.h" // IWYU pragma: keep
+#include <algorithm>
+#include <cassert>
+#include <cstddef>
+#include <functional>
+#include <limits>
+#include <map>
+#include <set>
+#include <string>
+#include <unordered_map>
+#include <utility>
+#include <vector>
+
#include "cmAlgorithms.h"
#include "cmGeneratorExpression.h"
#include "cmGeneratorTarget.h"
@@ -14,30 +26,18 @@
#include "cmLinkLineComputer.h"
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
-#include "cmProperty.h"
#include "cmPropertyMap.h"
#include "cmSourceFile.h"
#include "cmState.h"
#include "cmStateDirectory.h"
#include "cmStateSnapshot.h"
#include "cmStateTypes.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmTest.h"
#include "cmake.h"
-#include <algorithm>
-#include <cassert>
-#include <cstddef>
-#include <functional>
-#include <limits>
-#include <map>
-#include <set>
-#include <string>
-#include <unordered_map>
-#include <utility>
-#include <vector>
-
namespace {
std::vector<std::string> getConfigurations(const cmake* cm)
@@ -263,7 +263,7 @@ static Json::Value DumpSourceFilesList(
std::unordered_map<LanguageData, std::vector<std::string>> fileGroups;
for (cmSourceFile* file : files) {
LanguageData fileData;
- fileData.Language = file->GetLanguage();
+ fileData.Language = file->GetOrDetermineLanguage();
if (!fileData.Language.empty()) {
const LanguageData& ld = languageDataMap.at(fileData.Language);
cmLocalGenerator* lg = target->GetLocalGenerator();
@@ -326,7 +326,7 @@ static Json::Value DumpSourceFilesList(
fileData.IsGenerated = file->GetIsGenerated();
std::vector<std::string>& groupFileList = fileGroups[fileData];
- groupFileList.push_back(file->GetFullPath());
+ groupFileList.push_back(file->ResolveFullPath());
}
const std::string& baseDir = target->Makefile->GetCurrentSourceDirectory();
@@ -356,21 +356,18 @@ static Json::Value DumpCTestInfo(cmLocalGenerator* lg, cmTest* testInfo,
}
// Remove any config specific variables from the output.
- cmGeneratorExpression ge;
- auto cge = ge.Parse(command);
- const std::string& processed = cge->Evaluate(lg, config);
- result[kCTEST_COMMAND] = processed;
+ result[kCTEST_COMMAND] =
+ cmGeneratorExpression::Evaluate(command, lg, config);
// Build up the list of properties that may have been specified
Json::Value properties = Json::arrayValue;
- for (auto& prop : testInfo->GetProperties()) {
+ for (auto& prop : testInfo->GetProperties().GetList()) {
Json::Value entry = Json::objectValue;
entry[kKEY_KEY] = prop.first;
// Remove config variables from the value too.
- auto cge_value = ge.Parse(prop.second.GetValue());
- const std::string& processed_value = cge_value->Evaluate(lg, config);
- entry[kVALUE_KEY] = processed_value;
+ entry[kVALUE_KEY] =
+ cmGeneratorExpression::Evaluate(prop.second, lg, config);
properties.append(entry);
}
result[kPROPERTIES_KEY] = properties;
@@ -500,9 +497,9 @@ static Json::Value DumpTarget(cmGeneratorTarget* target,
if (!dest.empty() && cmSystemTools::FileIsFullPath(dest)) {
installPath = dest;
} else {
- std::string installPrefix =
- target->Makefile->GetSafeDefinition("CMAKE_INSTALL_PREFIX");
- installPath = installPrefix + '/' + dest;
+ installPath = cmStrCat(
+ target->Makefile->GetSafeDefinition("CMAKE_INSTALL_PREFIX"), '/',
+ dest);
}
installPaths.append(installPath);
@@ -516,9 +513,11 @@ static Json::Value DumpTarget(cmGeneratorTarget* target,
Json::Value artifacts = Json::arrayValue;
artifacts.append(
target->GetFullPath(config, cmStateEnums::RuntimeBinaryArtifact));
- if (target->IsDLLPlatform()) {
+ if (target->HasImportLibrary(config)) {
artifacts.append(
target->GetFullPath(config, cmStateEnums::ImportLibraryArtifact));
+ }
+ if (target->IsDLLPlatform()) {
const cmGeneratorTarget::OutputInfo* output =
target->GetOutputInfo(config);
if (output && !output->PdbDir.empty()) {
@@ -539,19 +538,19 @@ static Json::Value DumpTarget(cmGeneratorTarget* target,
lg->GetTargetFlags(&linkLineComputer, config, linkLibs, linkLanguageFlags,
linkFlags, frameworkPath, linkPath, target);
- linkLibs = cmSystemTools::TrimWhitespace(linkLibs);
- linkFlags = cmSystemTools::TrimWhitespace(linkFlags);
- linkLanguageFlags = cmSystemTools::TrimWhitespace(linkLanguageFlags);
- frameworkPath = cmSystemTools::TrimWhitespace(frameworkPath);
- linkPath = cmSystemTools::TrimWhitespace(linkPath);
+ linkLibs = cmTrimWhitespace(linkLibs);
+ linkFlags = cmTrimWhitespace(linkFlags);
+ linkLanguageFlags = cmTrimWhitespace(linkLanguageFlags);
+ frameworkPath = cmTrimWhitespace(frameworkPath);
+ linkPath = cmTrimWhitespace(linkPath);
- if (!cmSystemTools::TrimWhitespace(linkLibs).empty()) {
+ if (!cmTrimWhitespace(linkLibs).empty()) {
result[kLINK_LIBRARIES_KEY] = linkLibs;
}
- if (!cmSystemTools::TrimWhitespace(linkFlags).empty()) {
+ if (!cmTrimWhitespace(linkFlags).empty()) {
result[kLINK_FLAGS_KEY] = linkFlags;
}
- if (!cmSystemTools::TrimWhitespace(linkLanguageFlags).empty()) {
+ if (!cmTrimWhitespace(linkLanguageFlags).empty()) {
result[kLINK_LANGUAGE_FLAGS_KEY] = linkLanguageFlags;
}
if (!frameworkPath.empty()) {