mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-05 13:20:47 -06:00
#pragma once is a widely supported compiler pragma, even though it is not part of the C++ standard. Many of the issues keeping #pragma once from being standardized (distributed filesystems, build farms, hard links, etc.) do not apply to CMake - it is easy to build CMake on a single machine. CMake also does not install any header files which can be consumed by other projects (though cmCPluginAPI.h has been deliberately omitted from this conversion in case anyone is still using it.) Finally, #pragma once has been required to build CMake since at least August 2017 (7f29bbe6enabled server mode unconditionally, which had been using #pragma once since September 2016 (b13d3e0d)). The fact that we now require C++11 filters out old compilers, and it is unlikely that there is a compiler which supports C++11 but does not support #pragma once.
87 lines
2.5 KiB
C++
87 lines
2.5 KiB
C++
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
|
file Copyright.txt or https://cmake.org/licensing for details. */
|
|
|
|
#pragma once
|
|
|
|
#include "cmConfigure.h" // IWYU pragma: keep
|
|
|
|
#include <map>
|
|
#include <string>
|
|
|
|
class cmOutputConverter;
|
|
|
|
class cmRulePlaceholderExpander
|
|
{
|
|
public:
|
|
cmRulePlaceholderExpander(
|
|
std::map<std::string, std::string> compilers,
|
|
std::map<std::string, std::string> variableMappings,
|
|
std::string compilerSysroot, std::string linkerSysroot);
|
|
|
|
void SetTargetImpLib(std::string const& targetImpLib)
|
|
{
|
|
this->TargetImpLib = targetImpLib;
|
|
}
|
|
|
|
// Create a struct to hold the variables passed into
|
|
// ExpandRuleVariables
|
|
struct RuleVariables
|
|
{
|
|
RuleVariables();
|
|
const char* CMTargetName;
|
|
const char* CMTargetType;
|
|
const char* TargetPDB;
|
|
const char* TargetCompilePDB;
|
|
const char* TargetVersionMajor;
|
|
const char* TargetVersionMinor;
|
|
const char* Language;
|
|
const char* AIXExports;
|
|
const char* Objects;
|
|
const char* Target;
|
|
const char* LinkLibraries;
|
|
const char* Source;
|
|
const char* AssemblySource;
|
|
const char* PreprocessedSource;
|
|
const char* Output;
|
|
const char* Object;
|
|
const char* ObjectDir;
|
|
const char* ObjectFileDir;
|
|
const char* Flags;
|
|
const char* ObjectsQuoted;
|
|
const char* SONameFlag;
|
|
const char* TargetSOName;
|
|
const char* TargetInstallNameDir;
|
|
const char* LinkFlags;
|
|
const char* Manifests;
|
|
const char* LanguageCompileFlags;
|
|
const char* Defines;
|
|
const char* Includes;
|
|
const char* DependencyFile;
|
|
const char* FilterPrefix;
|
|
const char* SwiftLibraryName;
|
|
const char* SwiftModule;
|
|
const char* SwiftModuleName;
|
|
const char* SwiftOutputFileMap;
|
|
const char* SwiftSources;
|
|
const char* ISPCHeader;
|
|
};
|
|
|
|
// Expand rule variables in CMake of the type found in language rules
|
|
void ExpandRuleVariables(cmOutputConverter* outputConverter,
|
|
std::string& string,
|
|
const RuleVariables& replaceValues);
|
|
|
|
// Expand rule variables in a single string
|
|
std::string ExpandRuleVariable(cmOutputConverter* outputConverter,
|
|
std::string const& variable,
|
|
const RuleVariables& replaceValues);
|
|
|
|
private:
|
|
std::string TargetImpLib;
|
|
|
|
std::map<std::string, std::string> Compilers;
|
|
std::map<std::string, std::string> VariableMappings;
|
|
std::string CompilerSysroot;
|
|
std::string LinkerSysroot;
|
|
};
|