cmIncludeExternalMSProjectCommand: Port away from cmCommand
Ref: #19499
This commit is contained in:
parent
b46970cfe9
commit
06a2e764f0
@ -281,9 +281,8 @@ void GetProjectCommands(cmState* state)
|
|||||||
cmAuxSourceDirectoryCommand);
|
cmAuxSourceDirectoryCommand);
|
||||||
state->AddBuiltinCommand("export", cm::make_unique<cmExportCommand>());
|
state->AddBuiltinCommand("export", cm::make_unique<cmExportCommand>());
|
||||||
state->AddBuiltinCommand("fltk_wrap_ui", cmFLTKWrapUICommand);
|
state->AddBuiltinCommand("fltk_wrap_ui", cmFLTKWrapUICommand);
|
||||||
state->AddBuiltinCommand(
|
state->AddBuiltinCommand("include_external_msproject",
|
||||||
"include_external_msproject",
|
cmIncludeExternalMSProjectCommand);
|
||||||
cm::make_unique<cmIncludeExternalMSProjectCommand>());
|
|
||||||
state->AddBuiltinCommand("install_programs",
|
state->AddBuiltinCommand("install_programs",
|
||||||
cm::make_unique<cmInstallProgramsCommand>());
|
cm::make_unique<cmInstallProgramsCommand>());
|
||||||
state->AddBuiltinCommand("add_link_options", cmAddLinkOptionsCommand);
|
state->AddBuiltinCommand("add_link_options", cmAddLinkOptionsCommand);
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
file Copyright.txt or https://cmake.org/licensing for details. */
|
file Copyright.txt or https://cmake.org/licensing for details. */
|
||||||
#include "cmIncludeExternalMSProjectCommand.h"
|
#include "cmIncludeExternalMSProjectCommand.h"
|
||||||
|
|
||||||
|
#include "cmExecutionStatus.h"
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
# include "cmGlobalGenerator.h"
|
# include "cmGlobalGenerator.h"
|
||||||
# include "cmMakefile.h"
|
# include "cmMakefile.h"
|
||||||
@ -11,22 +13,20 @@
|
|||||||
# include "cmake.h"
|
# include "cmake.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class cmExecutionStatus;
|
bool cmIncludeExternalMSProjectCommand(std::vector<std::string> const& args,
|
||||||
|
cmExecutionStatus& status)
|
||||||
// cmIncludeExternalMSProjectCommand
|
|
||||||
bool cmIncludeExternalMSProjectCommand::InitialPass(
|
|
||||||
std::vector<std::string> const& args, cmExecutionStatus&)
|
|
||||||
{
|
{
|
||||||
if (args.size() < 2) {
|
if (args.size() < 2) {
|
||||||
this->SetError("INCLUDE_EXTERNAL_MSPROJECT called with incorrect "
|
status.SetError("INCLUDE_EXTERNAL_MSPROJECT called with incorrect "
|
||||||
"number of arguments");
|
"number of arguments");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// only compile this for win32 to avoid coverage errors
|
// only compile this for win32 to avoid coverage errors
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
if (this->Makefile->GetDefinition("WIN32") ||
|
cmMakefile& mf = status.GetMakefile();
|
||||||
this->Makefile->GetGlobalGenerator()
|
if (mf.GetDefinition("WIN32") ||
|
||||||
->IsIncludeExternalMSProjectSupported()) {
|
mf.GetGlobalGenerator()->IsIncludeExternalMSProjectSupported()) {
|
||||||
enum Doing
|
enum Doing
|
||||||
{
|
{
|
||||||
DoingNone,
|
DoingNone,
|
||||||
@ -77,15 +77,15 @@ bool cmIncludeExternalMSProjectCommand::InitialPass(
|
|||||||
|
|
||||||
if (!customGuid.empty()) {
|
if (!customGuid.empty()) {
|
||||||
std::string guidVariable = utility_name + "_GUID_CMAKE";
|
std::string guidVariable = utility_name + "_GUID_CMAKE";
|
||||||
this->Makefile->GetCMakeInstance()->AddCacheEntry(
|
mf.GetCMakeInstance()->AddCacheEntry(guidVariable.c_str(),
|
||||||
guidVariable.c_str(), customGuid.c_str(), "Stored GUID",
|
customGuid.c_str(), "Stored GUID",
|
||||||
cmStateEnums::INTERNAL);
|
cmStateEnums::INTERNAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a target instance for this utility.
|
// Create a target instance for this utility.
|
||||||
cmTarget* target = this->Makefile->AddNewTarget(cmStateEnums::UTILITY,
|
cmTarget* target =
|
||||||
utility_name.c_str());
|
mf.AddNewTarget(cmStateEnums::UTILITY, utility_name.c_str());
|
||||||
if (this->Makefile->GetPropertyAsBool("EXCLUDE_FROM_ALL")) {
|
if (mf.GetPropertyAsBool("EXCLUDE_FROM_ALL")) {
|
||||||
target->SetProperty("EXCLUDE_FROM_ALL", "TRUE");
|
target->SetProperty("EXCLUDE_FROM_ALL", "TRUE");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,36 +8,9 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "cm_memory.hxx"
|
|
||||||
|
|
||||||
#include "cmCommand.h"
|
|
||||||
|
|
||||||
class cmExecutionStatus;
|
class cmExecutionStatus;
|
||||||
|
|
||||||
/** \class cmIncludeExternalMSProjectCommand
|
bool cmIncludeExternalMSProjectCommand(std::vector<std::string> const& args,
|
||||||
* \brief Specify an external MS project file for inclusion in the workspace.
|
cmExecutionStatus& status);
|
||||||
*
|
|
||||||
* cmIncludeExternalMSProjectCommand is used to specify an externally
|
|
||||||
* generated Microsoft project file for inclusion in the default workspace
|
|
||||||
* generated by CMake.
|
|
||||||
*/
|
|
||||||
class cmIncludeExternalMSProjectCommand : public cmCommand
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
/**
|
|
||||||
* This is a virtual constructor for the command.
|
|
||||||
*/
|
|
||||||
std::unique_ptr<cmCommand> Clone() override
|
|
||||||
{
|
|
||||||
return cm::make_unique<cmIncludeExternalMSProjectCommand>();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This is called when the command is first encountered in
|
|
||||||
* the CMakeLists.txt file.
|
|
||||||
*/
|
|
||||||
bool InitialPass(std::vector<std::string> const& args,
|
|
||||||
cmExecutionStatus& status) override;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user