summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/cmFileAPI.cxx2
-rw-r--r--Source/cmFileAPICodemodel.cxx46
2 files changed, 47 insertions, 1 deletions
diff --git a/Source/cmFileAPI.cxx b/Source/cmFileAPI.cxx
index 8b0f309..4524ba6 100644
--- a/Source/cmFileAPI.cxx
+++ b/Source/cmFileAPI.cxx
@@ -727,7 +727,7 @@ std::string cmFileAPI::NoSupportedVersion(
// The "codemodel" object kind.
// Update Help/manual/cmake-file-api.7.rst when updating this constant.
-static unsigned int const CodeModelV2Minor = 6;
+static unsigned int const CodeModelV2Minor = 7;
void cmFileAPI::BuildClientRequestCodeModel(
ClientRequest& r, std::vector<RequestVersion> const& versions)
diff --git a/Source/cmFileAPICodemodel.cxx b/Source/cmFileAPICodemodel.cxx
index d069186..a6c3c66 100644
--- a/Source/cmFileAPICodemodel.cxx
+++ b/Source/cmFileAPICodemodel.cxx
@@ -41,10 +41,12 @@
#include "cmInstallSubdirectoryGenerator.h"
#include "cmInstallTargetGenerator.h"
#include "cmLinkLineComputer.h" // IWYU pragma: keep
+#include "cmList.h"
#include "cmListFileCache.h"
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
+#include "cmRange.h"
#include "cmSourceFile.h"
#include "cmSourceGroup.h"
#include "cmState.h"
@@ -503,6 +505,8 @@ class Target
Json::Value DumpDependencies();
Json::Value DumpDependency(cmTargetDepend const& td);
Json::Value DumpFolder();
+ Json::Value DumpLauncher(const char* name, const char* type);
+ Json::Value DumpLaunchers();
public:
Target(cmGeneratorTarget* gt, std::string const& config);
@@ -1223,6 +1227,13 @@ Json::Value Target::Dump()
target["archive"] = this->DumpArchive();
}
+ if (type == cmStateEnums::EXECUTABLE) {
+ Json::Value launchers = this->DumpLaunchers();
+ if (!launchers.empty()) {
+ target["launchers"] = std::move(launchers);
+ }
+ }
+
Json::Value dependencies = this->DumpDependencies();
if (!dependencies.empty()) {
target["dependencies"] = dependencies;
@@ -2075,6 +2086,41 @@ Json::Value Target::DumpFolder()
}
return folder;
}
+
+Json::Value Target::DumpLauncher(const char* name, const char* type)
+{
+ cmValue property = this->GT->GetProperty(name);
+ Json::Value launcher;
+ if (property) {
+ cmList commandWithArgs{ *property };
+ std::string command(commandWithArgs[0]);
+ cmSystemTools::ConvertToUnixSlashes(command);
+ launcher = Json::objectValue;
+ launcher["command"] = RelativeIfUnder(this->TopSource, command);
+ launcher["type"] = type;
+ Json::Value args;
+ for (std::string const& arg : cmMakeRange(commandWithArgs).advance(1)) {
+ args.append(arg);
+ }
+ launcher["arguments"] = args;
+ }
+ return launcher;
+}
+
+Json::Value Target::DumpLaunchers()
+{
+ Json::Value launchers;
+ bool allow =
+ this->GT->Makefile->GetDefinition("CMAKE_CROSSCOMPILING").IsOn();
+ Json::Value launcher;
+ if (allow) {
+ launcher = DumpLauncher("CROSSCOMPILING_EMULATOR", "emulator");
+ if (!launcher.empty()) {
+ launchers.append(launcher);
+ }
+ }
+ return launchers;
+}
}
Json::Value cmFileAPICodemodelDump(cmFileAPI& fileAPI, unsigned long version)