mirror of
https://github.com/reactos/CMake.git
synced 2025-01-24 04:34:26 +00:00
PCH: add target_precompile_headers command
This commit is contained in:
parent
0467a2f91b
commit
9b6797e71d
@ -656,6 +656,8 @@ set(SRCS
|
||||
cmTargetLinkDirectoriesCommand.h
|
||||
cmTargetLinkLibrariesCommand.cxx
|
||||
cmTargetLinkLibrariesCommand.h
|
||||
cmTargetPrecompileHeadersCommand.cxx
|
||||
cmTargetPrecompileHeadersCommand.h
|
||||
cmTargetPropCommandBase.cxx
|
||||
cmTargetPropCommandBase.h
|
||||
cmTargetSourcesCommand.cxx
|
||||
|
@ -78,6 +78,7 @@
|
||||
#include "cmTargetCompileOptionsCommand.h"
|
||||
#include "cmTargetIncludeDirectoriesCommand.h"
|
||||
#include "cmTargetLinkLibrariesCommand.h"
|
||||
#include "cmTargetPrecompileHeadersCommand.h"
|
||||
#include "cmTargetSourcesCommand.h"
|
||||
#include "cmTryCompileCommand.h"
|
||||
#include "cmTryRunCommand.h"
|
||||
@ -277,6 +278,9 @@ void GetProjectCommands(cmState* state)
|
||||
state->AddBuiltinCommand("try_compile",
|
||||
cm::make_unique<cmTryCompileCommand>());
|
||||
state->AddBuiltinCommand("try_run", cm::make_unique<cmTryRunCommand>());
|
||||
state->AddBuiltinCommand(
|
||||
"target_precompile_headers",
|
||||
cm::make_unique<cmTargetPrecompileHeadersCommand>());
|
||||
|
||||
#if !defined(CMAKE_BOOTSTRAP)
|
||||
state->AddBuiltinCommand("add_compile_definitions",
|
||||
|
36
Source/cmTargetPrecompileHeadersCommand.cxx
Normal file
36
Source/cmTargetPrecompileHeadersCommand.cxx
Normal file
@ -0,0 +1,36 @@
|
||||
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
file Copyright.txt or https://cmake.org/licensing for details. */
|
||||
#include "cmTargetPrecompileHeadersCommand.h"
|
||||
|
||||
#include "cmMakefile.h"
|
||||
#include "cmMessageType.h"
|
||||
#include "cmStringAlgorithms.h"
|
||||
#include "cmTarget.h"
|
||||
|
||||
bool cmTargetPrecompileHeadersCommand::InitialPass(
|
||||
std::vector<std::string> const& args, cmExecutionStatus&)
|
||||
{
|
||||
return this->HandleArguments(args, "PRECOMPILE_HEADERS");
|
||||
}
|
||||
|
||||
void cmTargetPrecompileHeadersCommand::HandleMissingTarget(
|
||||
const std::string& name)
|
||||
{
|
||||
const std::string e =
|
||||
cmStrCat("Cannot specify precompile headers for target \"", name,
|
||||
"\" which is not built by this project.");
|
||||
this->Makefile->IssueMessage(MessageType::FATAL_ERROR, e);
|
||||
}
|
||||
|
||||
std::string cmTargetPrecompileHeadersCommand::Join(
|
||||
const std::vector<std::string>& content)
|
||||
{
|
||||
return cmJoin(content, ";");
|
||||
}
|
||||
|
||||
bool cmTargetPrecompileHeadersCommand::HandleDirectContent(
|
||||
cmTarget* tgt, const std::vector<std::string>& content, bool, bool)
|
||||
{
|
||||
tgt->AppendProperty("PRECOMPILE_HEADERS", this->Join(content).c_str());
|
||||
return true;
|
||||
}
|
41
Source/cmTargetPrecompileHeadersCommand.h
Normal file
41
Source/cmTargetPrecompileHeadersCommand.h
Normal file
@ -0,0 +1,41 @@
|
||||
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
file Copyright.txt or https://cmake.org/licensing for details. */
|
||||
#ifndef cmTargetPrecompileHeadersCommand_h
|
||||
#define cmTargetPrecompileHeadersCommand_h
|
||||
|
||||
#include "cmConfigure.h" // IWYU pragma: keep
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "cm_memory.hxx"
|
||||
|
||||
#include "cmCommand.h"
|
||||
|
||||
#include "cmTargetPropCommandBase.h"
|
||||
|
||||
class cmExecutionStatus;
|
||||
class cmTarget;
|
||||
|
||||
class cmTargetPrecompileHeadersCommand : public cmTargetPropCommandBase
|
||||
{
|
||||
public:
|
||||
std::unique_ptr<cmCommand> Clone() override
|
||||
{
|
||||
return cm::make_unique<cmTargetPrecompileHeadersCommand>();
|
||||
}
|
||||
|
||||
bool InitialPass(std::vector<std::string> const& args,
|
||||
cmExecutionStatus& status) override;
|
||||
|
||||
private:
|
||||
void HandleMissingTarget(const std::string& name) override;
|
||||
|
||||
bool HandleDirectContent(cmTarget* tgt,
|
||||
const std::vector<std::string>& content,
|
||||
bool prepend, bool system) override;
|
||||
|
||||
std::string Join(const std::vector<std::string>& content) override;
|
||||
};
|
||||
|
||||
#endif
|
Loading…
x
Reference in New Issue
Block a user