summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalGenerator.cxx
diff options
context:
space:
mode:
authorKitware Robot <kwrobot@kitware.com>2016-05-16 14:34:04 (GMT)
committerBrad King <brad.king@kitware.com>2016-05-16 20:05:19 (GMT)
commitd9fd2f5402eeaa345691313658e02b51038f570b (patch)
treedca71b9a7e267f4c6300da3eb770415381726785 /Source/cmLocalGenerator.cxx
parent82df6deaafb36cbbfd450202bb20b320f637751a (diff)
downloadCMake-d9fd2f5402eeaa345691313658e02b51038f570b.zip
CMake-d9fd2f5402eeaa345691313658e02b51038f570b.tar.gz
CMake-d9fd2f5402eeaa345691313658e02b51038f570b.tar.bz2
Revise C++ coding style using clang-format
Run the `Utilities/Scripts/clang-format.bash` script to update all our C++ code to a new style defined by `.clang-format`. Use `clang-format` version 3.8. * If you reached this commit for a line in `git blame`, re-run the blame operation starting at the parent of this commit to see older history for the content. * See the parent commit for instructions to rebase a change across this style transition commit.
Diffstat (limited to 'Source/cmLocalGenerator.cxx')
-rw-r--r--Source/cmLocalGenerator.cxx2181
1 files changed, 877 insertions, 1304 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 8d985b1..0ff13d9 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -29,8 +29,8 @@
#include "cmake.h"
#if defined(CMAKE_BUILD_WITH_CMAKE)
-# define CM_LG_ENCODE_OBJECT_NAMES
-# include <cmsys/MD5.h>
+#define CM_LG_ENCODE_OBJECT_NAMES
+#include <cmsys/MD5.h>
#endif
#include <ctype.h> // for isalpha
@@ -42,10 +42,9 @@
#include <StorageDefs.h>
#endif
-cmLocalGenerator::cmLocalGenerator(cmGlobalGenerator* gg,
- cmMakefile* makefile)
- : cmOutputConverter(makefile->GetStateSnapshot()),
- StateSnapshot(makefile->GetStateSnapshot())
+cmLocalGenerator::cmLocalGenerator(cmGlobalGenerator* gg, cmMakefile* makefile)
+ : cmOutputConverter(makefile->GetStateSnapshot())
+ , StateSnapshot(makefile->GetStateSnapshot())
{
this->GlobalGenerator = gg;
@@ -74,40 +73,33 @@ void cmLocalGenerator::IssueMessage(cmake::MessageType t,
void cmLocalGenerator::ComputeObjectMaxPath()
{
- // Choose a maximum object file name length.
+// Choose a maximum object file name length.
#if defined(_WIN32) || defined(__CYGWIN__)
this->ObjectPathMax = 250;
#else
this->ObjectPathMax = 1000;
#endif
const char* plen = this->Makefile->GetDefinition("CMAKE_OBJECT_PATH_MAX");
- if(plen && *plen)
- {
+ if (plen && *plen) {
unsigned int pmax;
- if(sscanf(plen, "%u", &pmax) == 1)
- {
- if(pmax >= 128)
- {
+ if (sscanf(plen, "%u", &pmax) == 1) {
+ if (pmax >= 128) {
this->ObjectPathMax = pmax;
- }
- else
- {
+ } else {
std::ostringstream w;
w << "CMAKE_OBJECT_PATH_MAX is set to " << pmax
<< ", which is less than the minimum of 128. "
<< "The value will be ignored.";
this->IssueMessage(cmake::AUTHOR_WARNING, w.str());
- }
}
- else
- {
+ } else {
std::ostringstream w;
w << "CMAKE_OBJECT_PATH_MAX is set to \"" << plen
<< "\", which fails to parse as a positive integer. "
<< "The value will be ignored.";
this->IssueMessage(cmake::AUTHOR_WARNING, w.str());
- }
}
+ }
this->ObjectMaxPathViolations.clear();
}
@@ -115,42 +107,36 @@ void cmLocalGenerator::TraceDependencies()
{
std::vector<std::string> configs;
this->Makefile->GetConfigurations(configs);
- if (configs.empty())
- {
+ if (configs.empty()) {
configs.push_back("");
- }
- for(std::vector<std::string>::const_iterator ci = configs.begin();
- ci != configs.end(); ++ci)
- {
+ }
+ for (std::vector<std::string>::const_iterator ci = configs.begin();
+ ci != configs.end(); ++ci) {
this->GlobalGenerator->CreateEvaluationSourceFiles(*ci);
- }
+ }
// Generate the rule files for each target.
std::vector<cmGeneratorTarget*> targets = this->GetGeneratorTargets();
- for(std::vector<cmGeneratorTarget*>::iterator t = targets.begin();
- t != targets.end(); ++t)
- {
- if ((*t)->GetType() == cmState::INTERFACE_LIBRARY)
- {
+ for (std::vector<cmGeneratorTarget*>::iterator t = targets.begin();
+ t != targets.end(); ++t) {
+ if ((*t)->GetType() == cmState::INTERFACE_LIBRARY) {
continue;
- }
- (*t)->TraceDependencies();
}
+ (*t)->TraceDependencies();
+ }
}
void cmLocalGenerator::GenerateTestFiles()
{
- if ( !this->Makefile->IsOn("CMAKE_TESTING_ENABLED") )
- {
+ if (!this->Makefile->IsOn("CMAKE_TESTING_ENABLED")) {
return;
- }
+ }
// Compute the set of configurations.
std::vector<std::string> configurationTypes;
const std::string& config =
this->Makefile->GetConfigurations(configurationTypes, false);
- std::string file =
- this->StateSnapshot.GetDirectory().GetCurrentBinary();
+ std::string file = this->StateSnapshot.GetDirectory().GetCurrentBinary();
file += "/";
file += "CTestTestfile.cmake";
@@ -159,11 +145,9 @@ void cmLocalGenerator::GenerateTestFiles()
fout << "# CMake generated Testfile for " << std::endl
<< "# Source directory: "
- << this->StateSnapshot.GetDirectory().GetCurrentSource()
- << std::endl
+ << this->StateSnapshot.GetDirectory().GetCurrentSource() << std::endl
<< "# Build directory: "
- << this->StateSnapshot.GetDirectory().GetCurrentBinary()
- << std::endl
+ << this->StateSnapshot.GetDirectory().GetCurrentBinary() << std::endl
<< "# " << std::endl
<< "# This file includes the relevant testing commands "
<< "required for " << std::endl
@@ -172,78 +156,72 @@ void cmLocalGenerator::GenerateTestFiles()
const char* testIncludeFile =
this->Makefile->GetProperty("TEST_INCLUDE_FILE");
- if ( testIncludeFile )
- {
+ if (testIncludeFile) {
fout << "include(\"" << testIncludeFile << "\")" << std::endl;
- }
+ }
// Ask each test generator to write its code.
- std::vector<cmTestGenerator*> const&
- testers = this->Makefile->GetTestGenerators();
- for(std::vector<cmTestGenerator*>::const_iterator gi = testers.begin();
- gi != testers.end(); ++gi)
- {
+ std::vector<cmTestGenerator*> const& testers =
+ this->Makefile->GetTestGenerators();
+ for (std::vector<cmTestGenerator*>::const_iterator gi = testers.begin();
+ gi != testers.end(); ++gi) {
(*gi)->Compute(this);
(*gi)->Generate(fout, config, configurationTypes);
- }
+ }
size_t i;
- std::vector<cmState::Snapshot> children
- = this->Makefile->GetStateSnapshot().GetChildren();
- for(i = 0; i < children.size(); ++i)
- {
+ std::vector<cmState::Snapshot> children =
+ this->Makefile->GetStateSnapshot().GetChildren();
+ for (i = 0; i < children.size(); ++i) {
// TODO: Use add_subdirectory instead?
fout << "subdirs(";
std::string outP = children[i].GetDirectory().GetCurrentBinary();
- fout << this->Convert(outP,START_OUTPUT);
+ fout << this->Convert(outP, START_OUTPUT);
fout << ")" << std::endl;
- }
+ }
}
void cmLocalGenerator::CreateEvaluationFileOutputs(std::string const& config)
{
std::vector<cmGeneratorExpressionEvaluationFile*> ef =
- this->Makefile->GetEvaluationFiles();
- for(std::vector<cmGeneratorExpressionEvaluationFile*>::const_iterator
- li = ef.begin(); li != ef.end(); ++li)
- {
+ this->Makefile->GetEvaluationFiles();
+ for (std::vector<cmGeneratorExpressionEvaluationFile*>::const_iterator li =
+ ef.begin();
+ li != ef.end(); ++li) {
(*li)->CreateOutputFile(this, config);
- }
+ }
}
void cmLocalGenerator::ProcessEvaluationFiles(
- std::vector<std::string>& generatedFiles)
+ std::vector<std::string>& generatedFiles)
{
std::vector<cmGeneratorExpressionEvaluationFile*> ef =
- this->Makefile->GetEvaluationFiles();
- for(std::vector<cmGeneratorExpressionEvaluationFile*>::const_iterator
- li = ef.begin();
- li != ef.end();
- ++li)
- {
+ this->Makefile->GetEvaluationFiles();
+ for (std::vector<cmGeneratorExpressionEvaluationFile*>::const_iterator li =
+ ef.begin();
+ li != ef.end(); ++li) {
(*li)->Generate(this);
- if (cmSystemTools::GetFatalErrorOccured())
- {
+ if (cmSystemTools::GetFatalErrorOccured()) {
return;
- }
+ }
std::vector<std::string> files = (*li)->GetFiles();
std::sort(files.begin(), files.end());
std::vector<std::string> intersection;
- std::set_intersection(files.begin(), files.end(),
- generatedFiles.begin(), generatedFiles.end(),
+ std::set_intersection(files.begin(), files.end(), generatedFiles.begin(),
+ generatedFiles.end(),
std::back_inserter(intersection));
- if (!intersection.empty())
- {
+ if (!intersection.empty()) {
cmSystemTools::Error("Files to be generated by multiple different "
- "commands: ", cmWrap('"', intersection, '"', " ").c_str());
+ "commands: ",
+ cmWrap('"', intersection, '"', " ").c_str());
return;
- }
+ }
generatedFiles.insert(generatedFiles.end(), files.begin(), files.end());
std::vector<std::string>::iterator newIt =
- generatedFiles.end() - files.size();
+ generatedFiles.end() - files.size();
std::inplace_merge(generatedFiles.begin(), newIt, generatedFiles.end());
- }
+ }
}
void cmLocalGenerator::GenerateInstallRules()
@@ -252,49 +230,38 @@ void cmLocalGenerator::GenerateInstallRules()
const char* prefix = this->Makefile->GetDefinition("CMAKE_INSTALL_PREFIX");
#if defined(_WIN32) && !defined(__CYGWIN__)
std::string prefix_win32;
- if(!prefix)
- {
- if(!cmSystemTools::GetEnv("SystemDrive", prefix_win32))
- {
+ if (!prefix) {
+ if (!cmSystemTools::GetEnv("SystemDrive", prefix_win32)) {
prefix_win32 = "C:";
- }
+ }
const char* project_name = this->Makefile->GetDefinition("PROJECT_NAME");
- if(project_name && project_name[0])
- {
+ if (project_name && project_name[0]) {
prefix_win32 += "/Program Files/";
prefix_win32 += project_name;
- }
- else
- {
+ } else {
prefix_win32 += "/InstalledCMakeProject";
- }
- prefix = prefix_win32.c_str();
}
+ prefix = prefix_win32.c_str();
+ }
#elif defined(__HAIKU__)
char dir[B_PATH_NAME_LENGTH];
- if (!prefix)
- {
- if (find_directory(B_SYSTEM_DIRECTORY, -1, false, dir, sizeof(dir))
- == B_OK)
- {
+ if (!prefix) {
+ if (find_directory(B_SYSTEM_DIRECTORY, -1, false, dir, sizeof(dir)) ==
+ B_OK) {
prefix = dir;
- }
- else
- {
+ } else {
prefix = "/boot/system";
- }
}
+ }
#else
- if (!prefix)
- {
+ if (!prefix) {
prefix = "/usr/local";
- }
+ }
#endif
- if (const char *stagingPrefix
- = this->Makefile->GetDefinition("CMAKE_STAGING_PREFIX"))
- {
+ if (const char* stagingPrefix =
+ this->Makefile->GetDefinition("CMAKE_STAGING_PREFIX")) {
prefix = stagingPrefix;
- }
+ }
// Compute the set of configurations.
std::vector<std::string> configurationTypes;
@@ -303,41 +270,35 @@ void cmLocalGenerator::GenerateInstallRules()
// Choose a default install configuration.
std::string default_config = config;
- const char* default_order[] = {"RELEASE", "MINSIZEREL",
- "RELWITHDEBINFO", "DEBUG", 0};
- for(const char** c = default_order; *c && default_config.empty(); ++c)
- {
- for(std::vector<std::string>::iterator i = configurationTypes.begin();
- i != configurationTypes.end(); ++i)
- {
- if(cmSystemTools::UpperCase(*i) == *c)
- {
+ const char* default_order[] = { "RELEASE", "MINSIZEREL", "RELWITHDEBINFO",
+ "DEBUG", 0 };
+ for (const char** c = default_order; *c && default_config.empty(); ++c) {
+ for (std::vector<std::string>::iterator i = configurationTypes.begin();
+ i != configurationTypes.end(); ++i) {
+ if (cmSystemTools::UpperCase(*i) == *c) {
default_config = *i;
- }
}
}
- if(default_config.empty() && !configurationTypes.empty())
- {
+ }
+ if (default_config.empty() && !configurationTypes.empty()) {
default_config = configurationTypes[0];
- }
+ }
// Create the install script file.
- std::string file =
- this->StateSnapshot.GetDirectory().GetCurrentBinary();
+ std::string file = this->StateSnapshot.GetDirectory().GetCurrentBinary();
std::string homedir = this->GetState()->GetBinaryDirectory();
int toplevel_install = 0;
- if (file == homedir)
- {
+ if (file == homedir) {
toplevel_install = 1;
- }
+ }
file += "/cmake_install.cmake";
cmGeneratedFileStream fout(file.c_str());
fout.SetCopyIfDifferent(true);
// Write the header.
fout << "# Install script for directory: "
- << this->StateSnapshot.GetDirectory().GetCurrentSource()
- << std::endl << std::endl;
+ << this->StateSnapshot.GetDirectory().GetCurrentSource() << std::endl
+ << std::endl;
fout << "# Set the install prefix" << std::endl
<< "if(NOT DEFINED CMAKE_INSTALL_PREFIX)" << std::endl
<< " set(CMAKE_INSTALL_PREFIX \"" << prefix << "\")" << std::endl
@@ -379,9 +340,8 @@ void cmLocalGenerator::GenerateInstallRules()
/* clang-format on */
// Copy user-specified install options to the install code.
- if(const char* so_no_exe =
- this->Makefile->GetDefinition("CMAKE_INSTALL_SO_NO_EXE"))
- {
+ if (const char* so_no_exe =
+ this->Makefile->GetDefinition("CMAKE_INSTALL_SO_NO_EXE")) {
/* clang-format off */
fout <<
"# Install shared libraries without execute permission?\n"
@@ -390,46 +350,41 @@ void cmLocalGenerator::GenerateInstallRules()
"endif()\n"
"\n";
/* clang-format on */
- }
+ }
// Ask each install generator to write its code.
std::vector<cmInstallGenerator*> const& installers =
this->Makefile->GetInstallGenerators();
- for(std::vector<cmInstallGenerator*>::const_iterator
- gi = installers.begin();
- gi != installers.end(); ++gi)
- {
+ for (std::vector<cmInstallGenerator*>::const_iterator gi =
+ installers.begin();
+ gi != installers.end(); ++gi) {
(*gi)->Generate(fout, config, configurationTypes);
- }
+ }
// Write rules from old-style specification stored in targets.
this->GenerateTargetInstallRules(fout, config, configurationTypes);
// Include install scripts from subdirectories.
- std::vector<cmState::Snapshot> children
- = this->Makefile->GetStateSnapshot().GetChildren();
- if(!children.empty())
- {
+ std::vector<cmState::Snapshot> children =
+ this->Makefile->GetStateSnapshot().GetChildren();
+ if (!children.empty()) {
fout << "if(NOT CMAKE_INSTALL_LOCAL_ONLY)\n";
fout << " # Include the install script for each subdirectory.\n";
- for(std::vector<cmState::Snapshot>::const_iterator
- ci = children.begin(); ci != children.end(); ++ci)
- {
- if(!ci->GetDirectory().GetPropertyAsBool("EXCLUDE_FROM_ALL"))
- {
+ for (std::vector<cmState::Snapshot>::const_iterator ci = children.begin();
+ ci != children.end(); ++ci) {
+ if (!ci->GetDirectory().GetPropertyAsBool("EXCLUDE_FROM_ALL")) {
std::string odir = ci->GetDirectory().GetCurrentBinary();
cmSystemTools::ConvertToUnixSlashes(odir);
- fout << " include(\"" << odir
- << "/cmake_install.cmake\")" << std::endl;
- }
+ fout << " include(\"" << odir << "/cmake_install.cmake\")"
+ << std::endl;
}
+ }
fout << "\n";
fout << "endif()\n\n";
- }
+ }
// Record the install manifest.
- if ( toplevel_install )
- {
+ if (toplevel_install) {
/* clang-format off */
fout <<
"if(CMAKE_INSTALL_COMPONENT)\n"
@@ -444,10 +399,9 @@ void cmLocalGenerator::GenerateInstallRules()
"file(WRITE \"" << homedir << "/${CMAKE_INSTALL_MANIFEST}\"\n"
" \"${CMAKE_INSTALL_MANIFEST_CONTENT}\")\n";
/* clang-format on */
- }
+ }
}
-
void cmLocalGenerator::AddGeneratorTarget(cmGeneratorTarget* gt)
{
this->GeneratorTargets.push_back(gt);
@@ -470,28 +424,26 @@ struct NamedGeneratorTargetFinder
NamedGeneratorTargetFinder(std::string const& name)
: Name(name)
{
-
}
bool operator()(cmGeneratorTarget* tgt)
{
return tgt->GetName() == this->Name;
}
+
private:
std::string Name;
};
cmGeneratorTarget* cmLocalGenerator::FindLocalNonAliasGeneratorTarget(
- const std::string& name) const
+ const std::string& name) const
{
std::vector<cmGeneratorTarget*>::const_iterator ti =
- std::find_if(this->GeneratorTargets.begin(),
- this->GeneratorTargets.end(),
- NamedGeneratorTargetFinder(name));
- if ( ti != this->GeneratorTargets.end() )
- {
+ std::find_if(this->GeneratorTargets.begin(), this->GeneratorTargets.end(),
+ NamedGeneratorTargetFinder(name));
+ if (ti != this->GeneratorTargets.end()) {
return *ti;
- }
+ }
return 0;
}
@@ -500,28 +452,24 @@ void cmLocalGenerator::ComputeTargetManifest()
// Collect the set of configuration types.
std::vector<std::string> configNames;
this->Makefile->GetConfigurations(configNames);
- if(configNames.empty())
- {
+ if (configNames.empty()) {
configNames.push_back("");
- }
+ }
// Add our targets to the manifest for each configuration.
std::vector<cmGeneratorTarget*> targets = this->GetGeneratorTargets();
- for(std::vector<cmGeneratorTarget*>::iterator t = targets.begin();
- t != targets.end(); ++t)
- {
+ for (std::vector<cmGeneratorTarget*>::iterator t = targets.begin();
+ t != targets.end(); ++t) {
cmGeneratorTarget* target = *t;
- if (target->GetType() == cmState::INTERFACE_LIBRARY)
- {
+ if (target->GetType() == cmState::INTERFACE_LIBRARY) {
continue;
- }
- for(std::vector<std::string>::iterator ci = configNames.begin();
- ci != configNames.end(); ++ci)
- {
+ }
+ for (std::vector<std::string>::iterator ci = configNames.begin();
+ ci != configNames.end(); ++ci) {
const char* config = ci->c_str();
target->ComputeTargetManifest(config);
- }
}
+ }
}
bool cmLocalGenerator::IsRootMakefile() const
@@ -544,8 +492,7 @@ cmState::Snapshot cmLocalGenerator::GetStateSnapshot() const
// replaced in the form <var> with GetSafeDefinition(var).
// ${LANG} is replaced in the variable first with all enabled
// languages.
-static const char* ruleReplaceVars[] =
-{
+static const char* ruleReplaceVars[] = {
"CMAKE_${LANG}_COMPILER",
"CMAKE_SHARED_LIBRARY_CREATE_${LANG}_FLAGS",
"CMAKE_SHARED_MODULE_CREATE_${LANG}_FLAGS",
@@ -563,266 +510,195 @@ static const char* ruleReplaceVars[] =
0
};
-std::string
-cmLocalGenerator::ExpandRuleVariable(std::string const& variable,
- const RuleVariables& replaceValues)
+std::string cmLocalGenerator::ExpandRuleVariable(
+ std::string const& variable, const RuleVariables& replaceValues)
{
- if(replaceValues.LinkFlags)
- {
- if(variable == "LINK_FLAGS")
- {
+ if (replaceValues.LinkFlags) {
+ if (variable == "LINK_FLAGS") {
return replaceValues.LinkFlags;
- }
}
- if(replaceValues.Manifests)
- {
- if(variable == "MANIFESTS")
- {
+ }
+ if (replaceValues.Manifests) {
+ if (variable == "MANIFESTS") {
return replaceValues.Manifests;
- }
}
- if(replaceValues.Flags)
- {
- if(variable == "FLAGS")
- {
+ }
+ if (replaceValues.Flags) {
+ if (variable == "FLAGS") {
return replaceValues.Flags;
- }
}
+ }
- if(replaceValues.Source)
- {
- if(variable == "SOURCE")
- {
+ if (replaceValues.Source) {
+ if (variable == "SOURCE") {
return replaceValues.Source;
- }
}
- if(replaceValues.PreprocessedSource)
- {
- if(variable == "PREPROCESSED_SOURCE")
- {
+ }
+ if (replaceValues.PreprocessedSource) {
+ if (variable == "PREPROCESSED_SOURCE") {
return replaceValues.PreprocessedSource;
- }
}
- if(replaceValues.AssemblySource)
- {
- if(variable == "ASSEMBLY_SOURCE")
- {
+ }
+ if (replaceValues.AssemblySource) {
+ if (variable == "ASSEMBLY_SOURCE") {
return replaceValues.AssemblySource;
- }
}
- if(replaceValues.Object)
- {
- if(variable == "OBJECT")
- {
+ }
+ if (replaceValues.Object) {
+ if (variable == "OBJECT") {
return replaceValues.Object;
- }
}
- if(replaceValues.ObjectDir)
- {
- if(variable == "OBJECT_DIR")
- {
+ }
+ if (replaceValues.ObjectDir) {
+ if (variable == "OBJECT_DIR") {
return replaceValues.ObjectDir;
- }
}
- if(replaceValues.ObjectFileDir)
- {
- if(variable == "OBJECT_FILE_DIR")
- {
+ }
+ if (replaceValues.ObjectFileDir) {
+ if (variable == "OBJECT_FILE_DIR") {
return replaceValues.ObjectFileDir;
- }
}
- if(replaceValues.Objects)
- {
- if(variable == "OBJECTS")
- {
+ }
+ if (replaceValues.Objects) {
+ if (variable == "OBJECTS") {
return replaceValues.Objects;
- }
}
- if(replaceValues.ObjectsQuoted)
- {
- if(variable == "OBJECTS_QUOTED")
- {
+ }
+ if (replaceValues.ObjectsQuoted) {
+ if (variable == "OBJECTS_QUOTED") {
return replaceValues.ObjectsQuoted;
- }
}
- if(replaceValues.Defines && variable == "DEFINES")
- {
+ }
+ if (replaceValues.Defines && variable == "DEFINES") {
return replaceValues.Defines;
- }
- if(replaceValues.Includes && variable == "INCLUDES")
- {
+ }
+ if (replaceValues.Includes && variable == "INCLUDES") {
return replaceValues.Includes;
- }
- if(replaceValues.TargetPDB )
- {
- if(variable == "TARGET_PDB")
- {
+ }
+ if (replaceValues.TargetPDB) {
+ if (variable == "TARGET_PDB") {
return replaceValues.TargetPDB;
- }
}
- if(replaceValues.TargetCompilePDB)
- {
- if(variable == "TARGET_COMPILE_PDB")
- {
+ }
+ if (replaceValues.TargetCompilePDB) {
+ if (variable == "TARGET_COMPILE_PDB") {
return replaceValues.TargetCompilePDB;
- }
}
- if(replaceValues.DependencyFile )
- {
- if(variable == "DEP_FILE")
- {
+ }
+ if (replaceValues.DependencyFile) {
+ if (variable == "DEP_FILE") {
return replaceValues.DependencyFile;
- }
}
+ }
- if(replaceValues.Target)
- {
- if(variable == "TARGET_QUOTED")
- {
+ if (replaceValues.Target) {
+ if (variable == "TARGET_QUOTED") {
std::string targetQuoted = replaceValues.Target;
- if(!targetQuoted.empty() && targetQuoted[0] != '\"')
- {
+ if (!targetQuoted.empty() && targetQuoted[0] != '\"') {
targetQuoted = '\"';
targetQuoted += replaceValues.Target;
targetQuoted += '\"';
- }
- return targetQuoted;
}
- if(variable == "TARGET_UNQUOTED")
- {
+ return targetQuoted;
+ }
+ if (variable == "TARGET_UNQUOTED") {
std::string unquoted = replaceValues.Target;
std::string::size_type sz = unquoted.size();
- if(sz > 2 && unquoted[0] == '\"' && unquoted[sz-1] == '\"')
- {
- unquoted = unquoted.substr(1, sz-2);
- }
- return unquoted;
+ if (sz > 2 && unquoted[0] == '\"' && unquoted[sz - 1] == '\"') {
+ unquoted = unquoted.substr(1, sz - 2);
}
- if(replaceValues.LanguageCompileFlags)
- {
- if(variable == "LANGUAGE_COMPILE_FLAGS")
- {
+ return unquoted;
+ }
+ if (replaceValues.LanguageCompileFlags) {
+ if (variable == "LANGUAGE_COMPILE_FLAGS") {
return replaceValues.LanguageCompileFlags;
- }
}
- if(replaceValues.Target)
- {
- if(variable == "TARGET")
- {
+ }
+ if (replaceValues.Target) {
+ if (variable == "TARGET") {
return replaceValues.Target;
- }
}
- if(variable == "TARGET_IMPLIB")
- {
+ }
+ if (variable == "TARGET_IMPLIB") {
return this->TargetImplib;
- }
- if(variable == "TARGET_VERSION_MAJOR")
- {
- if(replaceValues.TargetVersionMajor)
- {
+ }
+ if (variable == "TARGET_VERSION_MAJOR") {
+ if (replaceValues.TargetVersionMajor) {
return replaceValues.TargetVersionMajor;
- }
- else
- {
+ } else {
return "0";
- }
}
- if(variable == "TARGET_VERSION_MINOR")
- {
- if(replaceValues.TargetVersionMinor)
- {
+ }
+ if (variable == "TARGET_VERSION_MINOR") {
+ if (replaceValues.TargetVersionMinor) {
return replaceValues.TargetVersionMinor;
- }
- else
- {
+ } else {
return "0";
- }
}
- if(replaceValues.Target)
- {
- if(variable == "TARGET_BASE")
- {
+ }
+ if (replaceValues.Target) {
+ if (variable == "TARGET_BASE") {
// Strip the last extension off the target name.
std::string targetBase = replaceValues.Target;
std::string::size_type pos = targetBase.rfind(".");
- if(pos != targetBase.npos)
- {
- return targetBase.substr(0, pos);
- }
- else
- {
+ if (pos != targetBase.npos) {
+ return targetBase.substr(0, pos);
+ } else {
return targetBase;
- }
}
}
}
- if(variable == "TARGET_SONAME" || variable == "SONAME_FLAG" ||
- variable == "TARGET_INSTALLNAME_DIR")
- {
+ }
+ if (variable == "TARGET_SONAME" || variable == "SONAME_FLAG" ||
+ variable == "TARGET_INSTALLNAME_DIR") {
// All these variables depend on TargetSOName
- if(replaceValues.TargetSOName)
- {
- if(variable == "TARGET_SONAME")
- {
+ if (replaceValues.TargetSOName) {
+ if (variable == "TARGET_SONAME") {
return replaceValues.TargetSOName;
- }
- if(variable == "SONAME_FLAG" && replaceValues.SONameFlag)
- {
+ }
+ if (variable == "SONAME_FLAG" && replaceValues.SONameFlag) {
return replaceValues.SONameFlag;
- }
- if(replaceValues.TargetInstallNameDir &&
- variable == "TARGET_INSTALLNAME_DIR")
- {
+ }
+ if (replaceValues.TargetInstallNameDir &&
+ variable == "TARGET_INSTALLNAME_DIR") {
return replaceValues.TargetInstallNameDir;
- }
}
- return "";
}
- if(replaceValues.LinkLibraries)
- {
- if(variable == "LINK_LIBRARIES")
- {
+ return "";
+ }
+ if (replaceValues.LinkLibraries) {
+ if (variable == "LINK_LIBRARIES") {
return replaceValues.LinkLibraries;
- }
}
- if(replaceValues.Language)
- {
- if(variable == "LANGUAGE")
- {
+ }
+ if (replaceValues.Language) {
+ if (variable == "LANGUAGE") {
return replaceValues.Language;
- }
}
- if(replaceValues.CMTarget)
- {
- if(variable == "TARGET_NAME")
- {
+ }
+ if (replaceValues.CMTarget) {
+ if (variable == "TARGET_NAME") {
return replaceValues.CMTarget->GetName();
- }
- if(variable == "TARGET_TYPE")
- {
+ }
+ if (variable == "TARGET_TYPE") {
return cmState::GetTargetTypeName(replaceValues.CMTarget->GetType());
- }
}
- if(replaceValues.Output)
- {
- if(variable == "OUTPUT")
- {
+ }
+ if (replaceValues.Output) {
+ if (variable == "OUTPUT") {
return replaceValues.Output;
- }
}
- if(variable == "CMAKE_COMMAND")
- {
+ }
+ if (variable == "CMAKE_COMMAND") {
return this->Convert(cmSystemTools::GetCMakeCommand(), FULL, SHELL);
- }
+ }
std::vector<std::string> enabledLanguages =
- this->GetState()->GetEnabledLanguages();
+ this->GetState()->GetEnabledLanguages();
// loop over language specific replace variables
int pos = 0;
- while(ruleReplaceVars[pos])
- {
- for(std::vector<std::string>::iterator i = enabledLanguages.begin();
- i != enabledLanguages.end(); ++i)
- {
+ while (ruleReplaceVars[pos]) {
+ for (std::vector<std::string>::iterator i = enabledLanguages.begin();
+ i != enabledLanguages.end(); ++i) {
const char* lang = i->c_str();
std::string actualReplace = ruleReplaceVars[pos];
// If this is the compiler then look for the extra variable
@@ -834,221 +710,176 @@ cmLocalGenerator::ExpandRuleVariable(std::string const& variable,
const char* compilerOptionExternalToolchain = 0;
const char* compilerSysroot = 0;
const char* compilerOptionSysroot = 0;
- if(actualReplace == "CMAKE_${LANG}_COMPILER")
- {
+ if (actualReplace == "CMAKE_${LANG}_COMPILER") {
std::string arg1 = actualReplace + "_ARG1";
cmSystemTools::ReplaceString(arg1, "${LANG}", lang);
compilerArg1 = this->Makefile->GetDefinition(arg1);
- compilerTarget
- = this->Makefile->GetDefinition(
- std::string("CMAKE_") + lang + "_COMPILER_TARGET");
- compilerOptionTarget
- = this->Makefile->GetDefinition(
- std::string("CMAKE_") + lang +
- "_COMPILE_OPTIONS_TARGET");
- compilerExternalToolchain
- = this->Makefile->GetDefinition(
- std::string("CMAKE_") + lang +
- "_COMPILER_EXTERNAL_TOOLCHAIN");
- compilerOptionExternalToolchain
- = this->Makefile->GetDefinition(
- std::string("CMAKE_") + lang +
- "_COMPILE_OPTIONS_EXTERNAL_TOOLCHAIN");
- compilerSysroot
- = this->Makefile->GetDefinition("CMAKE_SYSROOT");
- compilerOptionSysroot
- = this->Makefile->GetDefinition(
- std::string("CMAKE_") + lang +
- "_COMPILE_OPTIONS_SYSROOT");
- }
- if(actualReplace.find("${LANG}") != actualReplace.npos)
- {
+ compilerTarget = this->Makefile->GetDefinition(
+ std::string("CMAKE_") + lang + "_COMPILER_TARGET");
+ compilerOptionTarget = this->Makefile->GetDefinition(
+ std::string("CMAKE_") + lang + "_COMPILE_OPTIONS_TARGET");
+ compilerExternalToolchain = this->Makefile->GetDefinition(
+ std::string("CMAKE_") + lang + "_COMPILER_EXTERNAL_TOOLCHAIN");
+ compilerOptionExternalToolchain =
+ this->Makefile->GetDefinition(std::string("CMAKE_") + lang +
+ "_COMPILE_OPTIONS_EXTERNAL_TOOLCHAIN");
+ compilerSysroot = this->Makefile->GetDefinition("CMAKE_SYSROOT");
+ compilerOptionSysroot = this->Makefile->GetDefinition(
+ std::string("CMAKE_") + lang + "_COMPILE_OPTIONS_SYSROOT");
+ }
+ if (actualReplace.find("${LANG}") != actualReplace.npos) {
cmSystemTools::ReplaceString(actualReplace, "${LANG}", lang);
- }
- if(actualReplace == variable)
- {
- std::string replace =
- this->Makefile->GetSafeDefinition(variable);
+ }
+ if (actualReplace == variable) {
+ std::string replace = this->Makefile->GetSafeDefinition(variable);
// if the variable is not a FLAG then treat it like a path
- if(variable.find("_FLAG") == variable.npos)
- {
+ if (variable.find("_FLAG") == variable.npos) {
std::string ret = this->ConvertToOutputForExisting(replace);
// if there is a required first argument to the compiler add it
// to the compiler string
- if(compilerArg1)
- {
+ if (compilerArg1) {
ret += " ";
ret += compilerArg1;
- }
- if (compilerTarget && compilerOptionTarget)
- {
+ }
+ if (compilerTarget && compilerOptionTarget) {
ret += " ";
ret += compilerOptionTarget;
ret += compilerTarget;
- }
- if (compilerExternalToolchain && compilerOptionExternalToolchain)
- {
+ }
+ if (compilerExternalToolchain && compilerOptionExternalToolchain) {
ret += " ";
ret += compilerOptionExternalToolchain;
ret += this->EscapeForShell(compilerExternalToolchain, true);
- }
- if (compilerSysroot && compilerOptionSysroot)
- {
+ }
+ if (compilerSysroot && compilerOptionSysroot) {
ret += " ";
ret += compilerOptionSysroot;
ret += this->EscapeForShell(compilerSysroot, true);
- }
- return ret;
}
- return replace;
+ return ret;
}
+ return replace;
}
- pos++;
}
+ pos++;
+ }
return variable;
}
-
-void
-cmLocalGenerator::ExpandRuleVariables(std::string& s,
- const RuleVariables& replaceValues)
+void cmLocalGenerator::ExpandRuleVariables(std::string& s,
+ const RuleVariables& replaceValues)
{
- if(replaceValues.RuleLauncher)
- {
+ if (replaceValues.RuleLauncher) {
this->InsertRuleLauncher(s, replaceValues.CMTarget,
replaceValues.RuleLauncher);
- }
+ }
std::string::size_type start = s.find('<');
// no variables to expand
- if(start == s.npos)
- {
+ if (start == s.npos) {
return;
- }
+ }
std::string::size_type pos = 0;
std::string expandedInput;
- while(start != s.npos && start < s.size()-2)
- {
+ while (start != s.npos && start < s.size() - 2) {
std::string::size_type end = s.find('>', start);
// if we find a < with no > we are done
- if(end == s.npos)
- {
+ if (end == s.npos) {
return;
- }
- char c = s[start+1];
+ }
+ char c = s[start + 1];
// if the next char after the < is not A-Za-z then
// skip it and try to find the next < in the string
- if(!isalpha(c))
- {
- start = s.find('<', start+1);
- }
- else
- {
+ if (!isalpha(c)) {
+ start = s.find('<', start + 1);
+ } else {
// extract the var
- std::string var = s.substr(start+1, end - start-1);
- std::string replace = this->ExpandRuleVariable(var,
- replaceValues);
- expandedInput += s.substr(pos, start-pos);
+ std::string var = s.substr(start + 1, end - start - 1);
+ std::string replace = this->ExpandRuleVariable(var, replaceValues);
+ expandedInput += s.substr(pos, start - pos);
expandedInput += replace;
// move to next one
- start = s.find('<', start+var.size()+2);
- pos = end+1;
- }
+ start = s.find('<', start + var.size() + 2);
+ pos = end + 1;
}
+ }
// add the rest of the input
- expandedInput += s.substr(pos, s.size()-pos);
+ expandedInput += s.substr(pos, s.size() - pos);
s = expandedInput;
}
const char* cmLocalGenerator::GetRuleLauncher(cmGeneratorTarget* target,
const std::string& prop)
{
- if(target)
- {
+ if (target) {
return target->GetProperty(prop);
- }
- else
- {
+ } else {
return this->Makefile->GetProperty(prop);
- }
+ }
}
void cmLocalGenerator::InsertRuleLauncher(std::string& s,
cmGeneratorTarget* target,
const std::string& prop)
{
- if(const char* val = this->GetRuleLauncher(target, prop))
- {
+ if (const char* val = this->GetRuleLauncher(target, prop)) {
std::ostringstream wrapped;
wrapped << val << " " << s;
s = wrapped.str();
- }
+ }
}
-std::string
-cmLocalGenerator::ConvertToIncludeReference(std::string const& path,
- OutputFormat format,
- bool forceFullPaths)
+std::string cmLocalGenerator::ConvertToIncludeReference(
+ std::string const& path, OutputFormat format, bool forceFullPaths)
{
return this->ConvertToOutputForExisting(
- path, forceFullPaths? FULL : START_OUTPUT, format);
+ path, forceFullPaths ? FULL : START_OUTPUT, format);
}
std::string cmLocalGenerator::GetIncludeFlags(
- const std::vector<std::string> &includes,
- cmGeneratorTarget* target,
- const std::string& lang,
- bool forceFullPaths,
- bool forResponseFile,
- const std::string& config)
-{
- if(lang.empty())
- {
+ const std::vector<std::string>& includes, cmGeneratorTarget* target,
+ const std::string& lang, bool forceFullPaths, bool forResponseFile,
+ const std::string& config)
+{
+ if (lang.empty()) {
return "";
- }
+ }
- OutputFormat shellFormat = forResponseFile? RESPONSE : SHELL;
+ OutputFormat shellFormat = forResponseFile ? RESPONSE : SHELL;
std::ostringstream includeFlags;
std::string flagVar = "CMAKE_INCLUDE_FLAG_";
flagVar += lang;
- const char* includeFlag =
- this->Makefile->GetSafeDefinition(flagVar);
+ const char* includeFlag = this->Makefile->GetSafeDefinition(flagVar);
flagVar = "CMAKE_INCLUDE_FLAG_SEP_";
flagVar += lang;
const char* sep = this->Makefile->GetDefinition(flagVar);
bool quotePaths = false;
- if(this->Makefile->GetDefinition("CMAKE_QUOTE_INCLUDE_PATHS"))
- {
+ if (this->Makefile->GetDefinition("CMAKE_QUOTE_INCLUDE_PATHS")) {
quotePaths = true;
- }
+ }
bool repeatFlag = true;
// should the include flag be repeated like ie. -IA -IB
- if(!sep)
- {
+ if (!sep) {
sep = " ";
- }
- else
- {
+ } else {
// if there is a separator then the flag is not repeated but is only
// given once i.e. -classpath a:b:c
repeatFlag = false;
- }
+ }
// Support special system include flag if it is available and the
// normal flag is repeated for each directory.
std::string sysFlagVar = "CMAKE_INCLUDE_SYSTEM_FLAG_";
sysFlagVar += lang;
const char* sysIncludeFlag = 0;
- if(repeatFlag)
- {
+ if (repeatFlag) {
sysIncludeFlag = this->Makefile->GetDefinition(sysFlagVar);
- }
+ }
std::string fwSearchFlagVar = "CMAKE_";
fwSearchFlagVar += lang;
fwSearchFlagVar += "_FRAMEWORK_SEARCH_FLAG";
- const char* fwSearchFlag =
- this->Makefile->GetDefinition(fwSearchFlagVar);
+ const char* fwSearchFlag = this->Makefile->GetDefinition(fwSearchFlagVar);
std::string sysFwSearchFlagVar = "CMAKE_";
sysFwSearchFlagVar += lang;
@@ -1062,63 +893,50 @@ std::string cmLocalGenerator::GetIncludeFlags(
emitted.insert("/System/Library/Frameworks");
#endif
std::vector<std::string>::const_iterator i;
- for(i = includes.begin(); i != includes.end(); ++i)
- {
- if(fwSearchFlag && *fwSearchFlag && this->Makefile->IsOn("APPLE")
- && cmSystemTools::IsPathToFramework(i->c_str()))
- {
+ for (i = includes.begin(); i != includes.end(); ++i) {
+ if (fwSearchFlag && *fwSearchFlag && this->Makefile->IsOn("APPLE") &&
+ cmSystemTools::IsPathToFramework(i->c_str())) {
std::string frameworkDir = *i;
frameworkDir += "/../";
frameworkDir = cmSystemTools::CollapseFullPath(frameworkDir);
- if(emitted.insert(frameworkDir).second)
- {
+ if (emitted.insert(frameworkDir).second) {
if (sysFwSearchFlag && target &&
- target->IsSystemIncludeDirectory(*i, config))
- {
+ target->IsSystemIncludeDirectory(*i, config)) {
includeFlags << sysFwSearchFlag;
- }
- else
- {
+ } else {
includeFlags << fwSearchFlag;
- }
- includeFlags << this->ConvertToOutputFormat(frameworkDir, shellFormat)
- << " ";
}
- continue;
+ includeFlags << this->ConvertToOutputFormat(frameworkDir, shellFormat)
+ << " ";
}
+ continue;
+ }
- if(!flagUsed || repeatFlag)
- {
- if(sysIncludeFlag && target &&
- target->IsSystemIncludeDirectory(*i, config))
- {
+ if (!flagUsed || repeatFlag) {
+ if (sysIncludeFlag && target &&
+ target->IsSystemIncludeDirectory(*i, config)) {
includeFlags << sysIncludeFlag;
- }
- else
- {
+ } else {
includeFlags << includeFlag;
- }
- flagUsed = true;
}
+ flagUsed = true;
+ }
std::string includePath =
this->ConvertToIncludeReference(*i, shellFormat, forceFullPaths);
- if(quotePaths && !includePath.empty() && includePath[0] != '\"')
- {
+ if (quotePaths && !includePath.empty() && includePath[0] != '\"') {
includeFlags << "\"";
- }
+ }
includeFlags << includePath;
- if(quotePaths && !includePath.empty() && includePath[0] != '\"')
- {
+ if (quotePaths && !includePath.empty() && includePath[0] != '\"') {
includeFlags << "\"";
- }
- includeFlags << sep;
}
+ includeFlags << sep;
+ }
std::string flags = includeFlags.str();
// remove trailing separators
- if((sep[0] != ' ') && !flags.empty() && flags[flags.size()-1] == sep[0])
- {
- flags[flags.size()-1] = ' ';
- }
+ if ((sep[0] != ' ') && !flags.empty() && flags[flags.size() - 1] == sep[0]) {
+ flags[flags.size() - 1] = ' ';
+ }
return flags;
}
@@ -1132,87 +950,79 @@ void cmLocalGenerator::AddCompileDefinitions(std::set<std::string>& defines,
this->AppendDefines(defines, targetDefines);
}
-void cmLocalGenerator::AddCompileOptions(
- std::string& flags, cmGeneratorTarget* target,
- const std::string& lang, const std::string& config
- )
+void cmLocalGenerator::AddCompileOptions(std::string& flags,
+ cmGeneratorTarget* target,
+ const std::string& lang,
+ const std::string& config)
{
- std::string langFlagRegexVar = std::string("CMAKE_")+lang+"_FLAG_REGEX";
+ std::string langFlagRegexVar = std::string("CMAKE_") + lang + "_FLAG_REGEX";
- if(const char* langFlagRegexStr =
- this->Makefile->GetDefinition(langFlagRegexVar))
- {
+ if (const char* langFlagRegexStr =
+ this->Makefile->GetDefinition(langFlagRegexVar)) {
// Filter flags acceptable to this language.
cmsys::RegularExpression r(langFlagRegexStr);
std::vector<std::string> opts;
- if(const char* targetFlags = target->GetProperty("COMPILE_FLAGS"))
- {
+ if (const char* targetFlags = target->GetProperty("COMPILE_FLAGS")) {
cmSystemTools::ParseWindowsCommandLine(targetFlags, opts);
- }
+ }
target->GetCompileOptions(opts, config, lang);
- for(std::vector<std::string>::const_iterator i = opts.begin();
- i != opts.end(); ++i)
- {
- if(r.find(i->c_str()))
- {
+ for (std::vector<std::string>::const_iterator i = opts.begin();
+ i != opts.end(); ++i) {
+ if (r.find(i->c_str())) {
// (Re-)Escape this flag. COMPILE_FLAGS were already parsed
// as a command line above, and COMPILE_OPTIONS are escaped.
this->AppendFlagEscape(flags, *i);
- }
}
}
- else
- {
+ } else {
// Use all flags.
- if(const char* targetFlags = target->GetProperty("COMPILE_FLAGS"))
- {
+ if (const char* targetFlags = target->GetProperty("COMPILE_FLAGS")) {
// COMPILE_FLAGS are not escaped for historical reasons.
this->AppendFlags(flags, targetFlags);
- }
+ }
std::vector<std::string> opts;
target->GetCompileOptions(opts, config, lang);
- for(std::vector<std::string>::const_iterator i = opts.begin();
- i != opts.end(); ++i)
- {
+ for (std::vector<std::string>::const_iterator i = opts.begin();
+ i != opts.end(); ++i) {
// COMPILE_OPTIONS are escaped.
this->AppendFlagEscape(flags, *i);
- }
}
+ }
std::vector<std::string> features;
target->GetCompileFeatures(features, config);
- for(std::vector<std::string>::const_iterator it = features.begin();
- it != features.end(); ++it)
- {
- if (!this->Makefile->AddRequiredTargetFeature(target->Target, *it))
- {
+ for (std::vector<std::string>::const_iterator it = features.begin();
+ it != features.end(); ++it) {
+ if (!this->Makefile->AddRequiredTargetFeature(target->Target, *it)) {
return;
- }
}
+ }
- for(std::map<std::string, std::string>::const_iterator it
- = target->GetMaxLanguageStandards().begin();
- it != target->GetMaxLanguageStandards().end(); ++it)
- {
+ for (std::map<std::string, std::string>::const_iterator it =
+ target->GetMaxLanguageStandards().begin();
+ it != target->GetMaxLanguageStandards().end(); ++it) {
const char* standard = target->GetProperty(it->first + "_STANDARD");
- if(!standard)
- {
+ if (!standard) {
continue;
- }
- if (this->Makefile->IsLaterStandard(it->first, standard, it->second))
- {
+ }
+ if (this->Makefile->IsLaterStandard(it->first, standard, it->second)) {
std::ostringstream e;
- e << "The COMPILE_FEATURES property of target \""
- << target->GetName() << "\" was evaluated when computing the link "
- "implementation, and the \"" << it->first << "_STANDARD\" was \""
- << it->second << "\" for that computation. Computing the "
- "COMPILE_FEATURES based on the link implementation resulted in a "
- "higher \"" << it->first << "_STANDARD\" \"" << standard << "\". "
- "This is not permitted. The COMPILE_FEATURES may not both depend on "
- "and be depended on by the link implementation." << std::endl;
+ e << "The COMPILE_FEATURES property of target \"" << target->GetName()
+ << "\" was evaluated when computing the link "
+ "implementation, and the \""
+ << it->first << "_STANDARD\" was \"" << it->second
+ << "\" for that computation. Computing the "
+ "COMPILE_FEATURES based on the link implementation resulted in a "
+ "higher \""
+ << it->first << "_STANDARD\" \"" << standard
+ << "\". "
+ "This is not permitted. The COMPILE_FEATURES may not both depend "
+ "on "
+ "and be depended on by the link implementation."
+ << std::endl;
this->IssueMessage(cmake::FATAL_ERROR, e.str());
return;
- }
}
+ }
this->AddCompilerRequirementFlag(flags, target, lang);
}
@@ -1220,8 +1030,7 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs,
cmGeneratorTarget const* target,
const std::string& lang,
const std::string& config,
- bool stripImplicitInclDirs
- ) const
+ bool stripImplicitInclDirs) const
{
// Need to decide whether to automatically include the source and
// binary directories at the beginning of the include path.
@@ -1235,39 +1044,33 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs,
// file in a subdirectory of the current source directory but we
// cannot fix this because not all native build tools support
// per-source-file include paths.
- if(this->Makefile->IsOn("CMAKE_INCLUDE_CURRENT_DIR"))
- {
+ if (this->Makefile->IsOn("CMAKE_INCLUDE_CURRENT_DIR")) {
includeSourceDir = true;
includeBinaryDir = true;
- }
+ }
// Do not repeat an include path.
std::set<std::string> emitted;
// Store the automatic include paths.
- if(includeBinaryDir)
- {
+ if (includeBinaryDir) {
std::string binDir = this->StateSnapshot.GetDirectory().GetCurrentBinary();
- if(emitted.find(binDir) == emitted.end())
- {
+ if (emitted.find(binDir) == emitted.end()) {
dirs.push_back(binDir);
emitted.insert(binDir);
- }
}
- if(includeSourceDir)
- {
+ }
+ if (includeSourceDir) {
std::string srcDir = this->StateSnapshot.GetDirectory().GetCurrentSource();
- if(emitted.find(srcDir) == emitted.end())
- {
+ if (emitted.find(srcDir) == emitted.end()) {
dirs.push_back(srcDir);
emitted.insert(srcDir);
- }
}
+ }
- if(!target)
- {
+ if (!target) {
return;
- }
+ }
std::string rootPath = this->Makefile->GetSafeDefinition("CMAKE_SYSROOT");
@@ -1276,22 +1079,19 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs,
std::string impDirVar = "CMAKE_";
impDirVar += lang;
impDirVar += "_IMPLICIT_INCLUDE_DIRECTORIES";
- if(const char* value = this->Makefile->GetDefinition(impDirVar))
- {
+ if (const char* value = this->Makefile->GetDefinition(impDirVar)) {
std::vector<std::string> impDirVec;
cmSystemTools::ExpandListArgument(value, impDirVec);
- for(std::vector<std::string>::const_iterator i = impDirVec.begin();
- i != impDirVec.end(); ++i)
- {
+ for (std::vector<std::string>::const_iterator i = impDirVec.begin();
+ i != impDirVec.end(); ++i) {
std::string d = rootPath + *i;
cmSystemTools::ConvertToUnixSlashes(d);
emitted.insert(d);
- if (!stripImplicitInclDirs)
- {
+ if (!stripImplicitInclDirs) {
implicitDirs.push_back(*i);
- }
}
}
+ }
// Get the target-specific include directories.
std::vector<std::string> includes;
@@ -1300,74 +1100,61 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs,
// Support putting all the in-project include directories first if
// it is requested by the project.
- if(this->Makefile->IsOn("CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE"))
- {
+ if (this->Makefile->IsOn("CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE")) {
const char* topSourceDir = this->GetState()->GetSourceDirectory();
const char* topBinaryDir = this->GetState()->GetBinaryDirectory();
- for(std::vector<std::string>::const_iterator i = includes.begin();
- i != includes.end(); ++i)
- {
+ for (std::vector<std::string>::const_iterator i = includes.begin();
+ i != includes.end(); ++i) {
// Emit this directory only if it is a subdirectory of the
// top-level source or binary tree.
- if(cmSystemTools::ComparePath(*i, topSourceDir) ||
- cmSystemTools::ComparePath(*i, topBinaryDir) ||
- cmSystemTools::IsSubDirectory(*i, topSourceDir) ||
- cmSystemTools::IsSubDirectory(*i, topBinaryDir))
- {
- if(emitted.insert(*i).second)
- {
+ if (cmSystemTools::ComparePath(*i, topSourceDir) ||
+ cmSystemTools::ComparePath(*i, topBinaryDir) ||
+ cmSystemTools::IsSubDirectory(*i, topSourceDir) ||
+ cmSystemTools::IsSubDirectory(*i, topBinaryDir)) {
+ if (emitted.insert(*i).second) {
dirs.push_back(*i);
- }
}
}
}
+ }
// Construct the final ordered include directory list.
- for(std::vector<std::string>::const_iterator i = includes.begin();
- i != includes.end(); ++i)
- {
- if(emitted.insert(*i).second)
- {
+ for (std::vector<std::string>::const_iterator i = includes.begin();
+ i != includes.end(); ++i) {
+ if (emitted.insert(*i).second) {
dirs.push_back(*i);
- }
}
+ }
- for(std::vector<std::string>::const_iterator i = implicitDirs.begin();
- i != implicitDirs.end(); ++i)
- {
- if(std::find(includes.begin(), includes.end(), *i) != includes.end())
- {
+ for (std::vector<std::string>::const_iterator i = implicitDirs.begin();
+ i != implicitDirs.end(); ++i) {
+ if (std::find(includes.begin(), includes.end(), *i) != includes.end()) {
dirs.push_back(*i);
- }
}
+ }
}
void cmLocalGenerator::GetStaticLibraryFlags(std::string& flags,
std::string const& config,
cmGeneratorTarget* target)
{
- this->AppendFlags(flags,
- this->Makefile->GetSafeDefinition("CMAKE_STATIC_LINKER_FLAGS"));
- if(!config.empty())
- {
+ this->AppendFlags(
+ flags, this->Makefile->GetSafeDefinition("CMAKE_STATIC_LINKER_FLAGS"));
+ if (!config.empty()) {
std::string name = "CMAKE_STATIC_LINKER_FLAGS_" + config;
this->AppendFlags(flags, this->Makefile->GetSafeDefinition(name));
- }
+ }
this->AppendFlags(flags, target->GetProperty("STATIC_LIBRARY_FLAGS"));
- if(!config.empty())
- {
+ if (!config.empty()) {
std::string name = "STATIC_LIBRARY_FLAGS_" + config;
this->AppendFlags(flags, target->GetProperty(name));
- }
+ }
}
-void cmLocalGenerator::GetTargetFlags(std::string& linkLibs,
- std::string& flags,
- std::string& linkFlags,
- std::string& frameworkPath,
- std::string& linkPath,
- cmGeneratorTarget* target,
- bool useWatcomQuote)
+void cmLocalGenerator::GetTargetFlags(
+ std::string& linkLibs, std::string& flags, std::string& linkFlags,
+ std::string& frameworkPath, std::string& linkPath, cmGeneratorTarget* target,
+ bool useWatcomQuote)
{
std::string buildType =
this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
@@ -1375,140 +1162,115 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs,
const char* libraryLinkVariable =
"CMAKE_SHARED_LINKER_FLAGS"; // default to shared library
- switch(target->GetType())
- {
+ switch (target->GetType()) {
case cmState::STATIC_LIBRARY:
this->GetStaticLibraryFlags(linkFlags, buildType, target);
break;
case cmState::MODULE_LIBRARY:
libraryLinkVariable = "CMAKE_MODULE_LINKER_FLAGS";
- case cmState::SHARED_LIBRARY:
- {
+ case cmState::SHARED_LIBRARY: {
linkFlags = this->Makefile->GetSafeDefinition(libraryLinkVariable);
linkFlags += " ";
- if(!buildType.empty())
- {
+ if (!buildType.empty()) {
std::string build = libraryLinkVariable;
build += "_";
build += buildType;
linkFlags += this->Makefile->GetSafeDefinition(build);
linkFlags += " ";
- }
- if(this->Makefile->IsOn("WIN32") &&
- !(this->Makefile->IsOn("CYGWIN") || this->Makefile->IsOn("MINGW")))
- {
+ }
+ if (this->Makefile->IsOn("WIN32") &&
+ !(this->Makefile->IsOn("CYGWIN") || this->Makefile->IsOn("MINGW"))) {
std::vector<cmSourceFile*> sources;
target->GetSourceFiles(sources, buildType);
- for(std::vector<cmSourceFile*>::const_iterator i = sources.begin();
- i != sources.end(); ++i)
- {
+ for (std::vector<cmSourceFile*>::const_iterator i = sources.begin();
+ i != sources.end(); ++i) {
cmSourceFile* sf = *i;
- if(sf->GetExtension() == "def")
- {
+ if (sf->GetExtension() == "def") {
linkFlags +=
this->Makefile->GetSafeDefinition("CMAKE_LINK_DEF_FILE_FLAG");
- linkFlags += this->Convert(sf->GetFullPath(),
- FULL, SHELL);
+ linkFlags += this->Convert(sf->GetFullPath(), FULL, SHELL);
linkFlags += " ";
- }
}
}
+ }
const char* targetLinkFlags = target->GetProperty("LINK_FLAGS");
- if(targetLinkFlags)
- {
+ if (targetLinkFlags) {
linkFlags += targetLinkFlags;
linkFlags += " ";
- }
- if(!buildType.empty())
- {
+ }
+ if (!buildType.empty()) {
std::string configLinkFlags = "LINK_FLAGS_";
configLinkFlags += buildType;
targetLinkFlags = target->GetProperty(configLinkFlags);
- if(targetLinkFlags)
- {
+ if (targetLinkFlags) {
linkFlags += targetLinkFlags;
linkFlags += " ";
- }
}
- this->OutputLinkLibraries(linkLibs, frameworkPath, linkPath,
- *target, false, false, useWatcomQuote);
}
- break;
- case cmState::EXECUTABLE:
- {
- linkFlags +=
- this->Makefile->GetSafeDefinition("CMAKE_EXE_LINKER_FLAGS");
+ this->OutputLinkLibraries(linkLibs, frameworkPath, linkPath, *target,
+ false, false, useWatcomQuote);
+ } break;
+ case cmState::EXECUTABLE: {
+ linkFlags += this->Makefile->GetSafeDefinition("CMAKE_EXE_LINKER_FLAGS");
linkFlags += " ";
- if(!buildType.empty())
- {
+ if (!buildType.empty()) {
std::string build = "CMAKE_EXE_LINKER_FLAGS_";
build += buildType;
linkFlags += this->Makefile->GetSafeDefinition(build);
linkFlags += " ";
- }
+ }
std::string linkLanguage = target->GetLinkerLanguage(buildType);
- if(linkLanguage.empty())
- {
- cmSystemTools::Error
- ("CMake can not determine linker language for target: ",
- target->GetName().c_str());
+ if (linkLanguage.empty()) {
+ cmSystemTools::Error(
+ "CMake can not determine linker language for target: ",
+ target->GetName().c_str());
return;
- }
+ }
this->AddLanguageFlags(flags, linkLanguage, buildType);
- this->OutputLinkLibraries(linkLibs, frameworkPath, linkPath,
- *target, false, false, useWatcomQuote);
- if(cmSystemTools::IsOn
- (this->Makefile->GetDefinition("BUILD_SHARED_LIBS")))
- {
- std::string sFlagVar = std::string("CMAKE_SHARED_BUILD_")
- + linkLanguage + std::string("_FLAGS");
+ this->OutputLinkLibraries(linkLibs, frameworkPath, linkPath, *target,
+ false, false, useWatcomQuote);
+ if (cmSystemTools::IsOn(
+ this->Makefile->GetDefinition("BUILD_SHARED_LIBS"))) {
+ std::string sFlagVar = std::string("CMAKE_SHARED_BUILD_") +
+ linkLanguage + std::string("_FLAGS");
linkFlags += this->Makefile->GetSafeDefinition(sFlagVar);
linkFlags += " ";
- }
- if ( target->GetPropertyAsBool("WIN32_EXECUTABLE") )
- {
+ }
+ if (target->GetPropertyAsBool("WIN32_EXECUTABLE")) {
linkFlags +=
this->Makefile->GetSafeDefinition("CMAKE_CREATE_WIN32_EXE");
linkFlags += " ";
- }
- else
- {
+ } else {
linkFlags +=
this->Makefile->GetSafeDefinition("CMAKE_CREATE_CONSOLE_EXE");
linkFlags += " ";
- }
- if (target->IsExecutableWithExports())
- {
+ }
+ if (target->IsExecutableWithExports()) {
std::string exportFlagVar = "CMAKE_EXE_EXPORTS_";
exportFlagVar += linkLanguage;
exportFlagVar += "_FLAG";
- linkFlags +=
- this->Makefile->GetSafeDefinition(exportFlagVar);
+ linkFlags += this->Makefile->GetSafeDefinition(exportFlagVar);
linkFlags += " ";
- }
+ }
const char* targetLinkFlags = target->GetProperty("LINK_FLAGS");
- if(targetLinkFlags)
- {
+ if (targetLinkFlags) {
linkFlags += targetLinkFlags;
linkFlags += " ";
- }
- if(!buildType.empty())
- {
+ }
+ if (!buildType.empty()) {
std::string configLinkFlags = "LINK_FLAGS_";
configLinkFlags += buildType;
targetLinkFlags = target->GetProperty(configLinkFlags);
- if(targetLinkFlags)
- {
+ if (targetLinkFlags) {
linkFlags += targetLinkFlags;
linkFlags += " ";
- }
}
}
- break;
+ } break;
default:
break;
- }
+ }
}
std::string cmLocalGenerator::ConvertToLinkReference(std::string const& lib,
@@ -1516,27 +1278,24 @@ std::string cmLocalGenerator::ConvertToLinkReference(std::string const& lib,
{
#if defined(_WIN32) && !defined(__CYGWIN__)
// Work-ardound command line parsing limitations in MSVC 6.0
- if(this->Makefile->IsOn("MSVC60"))
- {
+ if (this->Makefile->IsOn("MSVC60")) {
// Search for the last space.
std::string::size_type pos = lib.rfind(' ');
- if(pos != lib.npos)
- {
+ if (pos != lib.npos) {
// Find the slash after the last space, if any.
pos = lib.find('/', pos);
// Convert the portion of the path with a space to a short path.
std::string sp;
- if(cmSystemTools::GetShortPath(lib.substr(0, pos).c_str(), sp))
- {
+ if (cmSystemTools::GetShortPath(lib.substr(0, pos).c_str(), sp)) {
// Append the rest of the path with no space.
sp += lib.substr(pos);
// Convert to an output path.
return this->Convert(sp.c_str(), NONE, format);
- }
}
}
+ }
#endif
// Normal behavior.
@@ -1551,21 +1310,19 @@ std::string cmLocalGenerator::ConvertToLinkReference(std::string const& lib,
void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries,
std::string& frameworkPath,
std::string& linkPath,
- cmGeneratorTarget &tgt,
- bool relink,
+ cmGeneratorTarget& tgt, bool relink,
bool forResponseFile,
bool useWatcomQuote)
{
- OutputFormat shellFormat = (forResponseFile) ? RESPONSE :
- ((useWatcomQuote) ? WATCOMQUOTE : SHELL);
+ OutputFormat shellFormat =
+ (forResponseFile) ? RESPONSE : ((useWatcomQuote) ? WATCOMQUOTE : SHELL);
bool escapeAllowMakeVars = !forResponseFile;
std::ostringstream fout;
std::string config = this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
cmComputeLinkInformation* pcli = tgt.GetLinkInformation(config);
- if(!pcli)
- {
+ if (!pcli) {
return;
- }
+ }
cmComputeLinkInformation& cli = *pcli;
// Collect library linking flags command line options.
@@ -1580,17 +1337,14 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries,
// Flags to link an executable to shared libraries.
if (tgt.GetType() == cmState::EXECUTABLE &&
- this->StateSnapshot.GetState()->
- GetGlobalPropertyAsBool("TARGET_SUPPORTS_SHARED_LIBS"))
- {
+ this->StateSnapshot.GetState()->GetGlobalPropertyAsBool(
+ "TARGET_SUPPORTS_SHARED_LIBS")) {
bool add_shlib_flags = false;
- switch(tgt.GetPolicyStatusCMP0065())
- {
+ switch (tgt.GetPolicyStatusCMP0065()) {
case cmPolicies::WARN:
- if(!tgt.GetPropertyAsBool("ENABLE_EXPORTS") &&
- this->Makefile->PolicyOptionalWarningEnabled(
- "CMAKE_POLICY_WARNING_CMP0065"))
- {
+ if (!tgt.GetPropertyAsBool("ENABLE_EXPORTS") &&
+ this->Makefile->PolicyOptionalWarningEnabled(
+ "CMAKE_POLICY_WARNING_CMP0065")) {
std::ostringstream w;
/* clang-format off */
w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0065) << "\n"
@@ -1599,7 +1353,7 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries,
"executables regardless of thier ENABLE_EXPORTS property.";
/* clang-format on */
this->IssueMessage(cmake::AUTHOR_WARNING, w.str());
- }
+ }
case cmPolicies::OLD:
// OLD behavior is to always add the flags
add_shlib_flags = true;
@@ -1608,190 +1362,164 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries,
case cmPolicies::REQUIRED_ALWAYS:
this->IssueMessage(
cmake::FATAL_ERROR,
- cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0065)
- );
+ cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0065));
case cmPolicies::NEW:
// NEW behavior is to only add the flags if ENABLE_EXPORTS is on
add_shlib_flags = tgt.GetPropertyAsBool("ENABLE_EXPORTS");
break;
- }
+ }
- if(add_shlib_flags)
- {
+ if (add_shlib_flags) {
std::string linkFlagsVar = "CMAKE_SHARED_LIBRARY_LINK_";
linkFlagsVar += linkLanguage;
linkFlagsVar += "_FLAGS";
linkLibs = this->Makefile->GetSafeDefinition(linkFlagsVar);
linkLibs += " ";
- }
}
+ }
// Append the framework search path flags.
std::string fwSearchFlagVar = "CMAKE_";
fwSearchFlagVar += linkLanguage;
fwSearchFlagVar += "_FRAMEWORK_SEARCH_FLAG";
- const char* fwSearchFlag =
- this->Makefile->GetDefinition(fwSearchFlagVar);
- if(fwSearchFlag && *fwSearchFlag)
- {
+ const char* fwSearchFlag = this->Makefile->GetDefinition(fwSearchFlagVar);
+ if (fwSearchFlag && *fwSearchFlag) {
std::vector<std::string> const& fwDirs = cli.GetFrameworkPaths();
- for(std::vector<std::string>::const_iterator fdi = fwDirs.begin();
- fdi != fwDirs.end(); ++fdi)
- {
+ for (std::vector<std::string>::const_iterator fdi = fwDirs.begin();
+ fdi != fwDirs.end(); ++fdi) {
frameworkPath += fwSearchFlag;
frameworkPath += this->Convert(*fdi, NONE, shellFormat);
frameworkPath += " ";
- }
}
+ }
// Append the library search path flags.
std::vector<std::string> const& libDirs = cli.GetDirectories();
- for(std::vector<std::string>::const_iterator libDir = libDirs.begin();
- libDir != libDirs.end(); ++libDir)
- {
- std::string libpath = this->ConvertToOutputForExisting(*libDir,
- START_OUTPUT,
- shellFormat);
+ for (std::vector<std::string>::const_iterator libDir = libDirs.begin();
+ libDir != libDirs.end(); ++libDir) {
+ std::string libpath =
+ this->ConvertToOutputForExisting(*libDir, START_OUTPUT, shellFormat);
linkPath += " " + libPathFlag;
linkPath += libpath;
linkPath += libPathTerminator;
linkPath += " ";
- }
+ }
// Append the link items.
typedef cmComputeLinkInformation::ItemVector ItemVector;
ItemVector const& items = cli.GetItems();
- for(ItemVector::const_iterator li = items.begin(); li != items.end(); ++li)
- {
- if(li->Target && li->Target->GetType() == cmState::INTERFACE_LIBRARY)
- {
+ for (ItemVector::const_iterator li = items.begin(); li != items.end();
+ ++li) {
+ if (li->Target && li->Target->GetType() == cmState::INTERFACE_LIBRARY) {
continue;
- }
- if(li->IsPath)
- {
+ }
+ if (li->IsPath) {
linkLibs += this->ConvertToLinkReference(li->Value, shellFormat);
- }
- else
- {
+ } else {
linkLibs += li->Value;
- }
- linkLibs += " ";
}
+ linkLibs += " ";
+ }
// Write the library flags to the build rule.
fout << linkLibs;
// Check what kind of rpath flags to use.
- if(cli.GetRuntimeSep().empty())
- {
+ if (cli.GetRuntimeSep().empty()) {
// Each rpath entry gets its own option ("-R a -R b -R c")
std::vector<std::string> runtimeDirs;
cli.GetRPath(runtimeDirs, relink);
std::string rpath;
- for(std::vector<std::string>::iterator ri = runtimeDirs.begin();
- ri != runtimeDirs.end(); ++ri)
- {
+ for (std::vector<std::string>::iterator ri = runtimeDirs.begin();
+ ri != runtimeDirs.end(); ++ri) {
rpath += cli.GetRuntimeFlag();
rpath += this->Convert(*ri, NONE, shellFormat);
rpath += " ";
- }
- fout << rpath;
}
- else
- {
+ fout << rpath;
+ } else {
// All rpath entries are combined ("-Wl,-rpath,a:b:c").
std::string rpath = cli.GetRPathString(relink);
// Store the rpath option in the stream.
- if(!rpath.empty())
- {
+ if (!rpath.empty()) {
fout << cli.GetRuntimeFlag();
fout << this->EscapeForShell(rpath, escapeAllowMakeVars);
fout << " ";
- }
}
+ }
// Add the linker runtime search path if any.
std::string rpath_link = cli.GetRPathLinkString();
- if(!cli.GetRPathLinkFlag().empty() && !rpath_link.empty())
- {
+ if (!cli.GetRPathLinkFlag().empty() && !rpath_link.empty()) {
fout << cli.GetRPathLinkFlag();
fout << this->EscapeForShell(rpath_link, escapeAllowMakeVars);
fout << " ";
- }
+ }
// Add standard libraries for this language.
std::string standardLibsVar = "CMAKE_";
standardLibsVar += cli.GetLinkLanguage();
standardLibsVar += "_STANDARD_LIBRARIES";
- if(const char* stdLibs =
- this->Makefile->GetDefinition(standardLibsVar))
- {
+ if (const char* stdLibs = this->Makefile->GetDefinition(standardLibsVar)) {
fout << stdLibs << " ";
- }
+ }
linkLibraries = fout.str();
}
-
void cmLocalGenerator::AddArchitectureFlags(std::string& flags,
cmGeneratorTarget const* target,
const std::string& lang,
const std::string& config)
{
// Only add Mac OS X specific flags on Darwin platforms (OSX and iphone):
- if(!this->Makefile->IsOn("APPLE"))
- {
+ if (!this->Makefile->IsOn("APPLE")) {
return;
- }
+ }
- if(this->EmitUniversalBinaryFlags)
- {
+ if (this->EmitUniversalBinaryFlags) {
std::vector<std::string> archs;
target->GetAppleArchs(config, archs);
const char* sysroot = this->Makefile->GetDefinition("CMAKE_OSX_SYSROOT");
- if(sysroot && sysroot[0] == '/' && !sysroot[1])
- { sysroot = 0; }
+ if (sysroot && sysroot[0] == '/' && !sysroot[1]) {
+ sysroot = 0;
+ }
std::string sysrootFlagVar =
std::string("CMAKE_") + lang + "_SYSROOT_FLAG";
- const char* sysrootFlag =
- this->Makefile->GetDefinition(sysrootFlagVar);
+ const char* sysrootFlag = this->Makefile->GetDefinition(sysrootFlagVar);
const char* deploymentTarget =
this->Makefile->GetDefinition("CMAKE_OSX_DEPLOYMENT_TARGET");
std::string deploymentTargetFlagVar =
std::string("CMAKE_") + lang + "_OSX_DEPLOYMENT_TARGET_FLAG";
const char* deploymentTargetFlag =
this->Makefile->GetDefinition(deploymentTargetFlagVar);
- if(!archs.empty() && !lang.empty() && (lang[0] =='C' || lang[0] == 'F'))
- {
- for(std::vector<std::string>::iterator i = archs.begin();
- i != archs.end(); ++i)
- {
+ if (!archs.empty() && !lang.empty() &&
+ (lang[0] == 'C' || lang[0] == 'F')) {
+ for (std::vector<std::string>::iterator i = archs.begin();
+ i != archs.end(); ++i) {
flags += " -arch ";
flags += *i;
- }
}
+ }
- if(sysrootFlag && *sysrootFlag && sysroot && *sysroot)
- {
+ if (sysrootFlag && *sysrootFlag && sysroot && *sysroot) {
flags += " ";
flags += sysrootFlag;
flags += " ";
flags += this->Convert(sysroot, NONE, SHELL);
- }
+ }
- if (deploymentTargetFlag && *deploymentTargetFlag &&
- deploymentTarget && *deploymentTarget)
- {
+ if (deploymentTargetFlag && *deploymentTargetFlag && deploymentTarget &&
+ *deploymentTarget) {
flags += " ";
flags += deploymentTargetFlag;
flags += deploymentTarget;
- }
}
+ }
}
-
void cmLocalGenerator::AddLanguageFlags(std::string& flags,
const std::string& lang,
const std::string& config)
@@ -1803,22 +1531,19 @@ void cmLocalGenerator::AddLanguageFlags(std::string& flags,
this->AddConfigVariableFlags(flags, flagsVar, config);
}
-cmGeneratorTarget*
-cmLocalGenerator::FindGeneratorTargetToUse(const std::string& name) const
+cmGeneratorTarget* cmLocalGenerator::FindGeneratorTargetToUse(
+ const std::string& name) const
{
- std::vector<cmGeneratorTarget*>::const_iterator
- imported = std::find_if(this->ImportedGeneratorTargets.begin(),
- this->ImportedGeneratorTargets.end(),
- NamedGeneratorTargetFinder(name));
- if(imported != this->ImportedGeneratorTargets.end())
- {
+ std::vector<cmGeneratorTarget*>::const_iterator imported = std::find_if(
+ this->ImportedGeneratorTargets.begin(),
+ this->ImportedGeneratorTargets.end(), NamedGeneratorTargetFinder(name));
+ if (imported != this->ImportedGeneratorTargets.end()) {
return *imported;
- }
+ }
- if(cmGeneratorTarget* t = this->FindLocalNonAliasGeneratorTarget(name))
- {
+ if (cmGeneratorTarget* t = this->FindLocalNonAliasGeneratorTarget(name)) {
return t;
- }
+ }
return this->GetGlobalGenerator()->FindGeneratorTarget(name);
}
@@ -1836,46 +1561,38 @@ bool cmLocalGenerator::GetRealDependency(const std::string& inName,
// If the input name is the empty string, there is no real
// dependency. Short-circuit the other checks:
- if(name == "")
- {
+ if (name == "") {
return false;
- }
+ }
- if(cmSystemTools::GetFilenameLastExtension(name) == ".exe")
- {
+ if (cmSystemTools::GetFilenameLastExtension(name) == ".exe") {
name = cmSystemTools::GetFilenameWithoutLastExtension(name);
- }
+ }
// Look for a CMake target with the given name.
- if(cmGeneratorTarget* target =
- this->FindGeneratorTargetToUse(name))
- {
+ if (cmGeneratorTarget* target = this->FindGeneratorTargetToUse(name)) {
// make sure it is not just a coincidence that the target name
// found is part of the inName
- if(cmSystemTools::FileIsFullPath(inName.c_str()))
- {
+ if (cmSystemTools::FileIsFullPath(inName.c_str())) {
std::string tLocation;
- if(target->GetType() >= cmState::EXECUTABLE &&
- target->GetType() <= cmState::MODULE_LIBRARY)
- {
+ if (target->GetType() >= cmState::EXECUTABLE &&
+ target->GetType() <= cmState::MODULE_LIBRARY) {
tLocation = target->GetLocation(config);
tLocation = cmSystemTools::GetFilenamePath(tLocation);
tLocation = cmSystemTools::CollapseFullPath(tLocation);
- }
- std::string depLocation = cmSystemTools::GetFilenamePath(
- std::string(inName));
+ }
+ std::string depLocation =
+ cmSystemTools::GetFilenamePath(std::string(inName));
depLocation = cmSystemTools::CollapseFullPath(depLocation);
- if(depLocation != tLocation)
- {
+ if (depLocation != tLocation) {
// it is a full path to a depend that has the same name
// as a target but is in a different location so do not use
// the target as the depend
dep = inName;
return true;
- }
}
- switch (target->GetType())
- {
+ }
+ switch (target->GetType()) {
case cmState::EXECUTABLE:
case cmState::STATIC_LIBRARY:
case cmState::SHARED_LIBRARY:
@@ -1896,24 +1613,22 @@ bool cmLocalGenerator::GetRealDependency(const std::string& inName,
// A utility target has no file on which to depend. This was listed
// only to get the target-level dependency.
return false;
- }
}
+ }
// The name was not that of a CMake target. It must name a file.
- if(cmSystemTools::FileIsFullPath(inName.c_str()))
- {
+ if (cmSystemTools::FileIsFullPath(inName.c_str())) {
// This is a full path. Return it as given.
dep = inName;
return true;
- }
+ }
// Check for a source file in this directory that matches the
// dependency.
- if(cmSourceFile* sf = this->Makefile->GetSource(inName))
- {
+ if (cmSourceFile* sf = this->Makefile->GetSource(inName)) {
dep = sf->GetFullPath();
return true;
- }
+ }
// Treat the name as relative to the source directory in which it
// was given.
@@ -1924,82 +1639,69 @@ bool cmLocalGenerator::GetRealDependency(const std::string& inName,
}
void cmLocalGenerator::AddSharedFlags(std::string& flags,
- const std::string& lang,
- bool shared)
+ const std::string& lang, bool shared)
{
std::string flagsVar;
// Add flags for dealing with shared libraries for this language.
- if(shared)
- {
+ if (shared) {
flagsVar = "CMAKE_SHARED_LIBRARY_";
flagsVar += lang;
flagsVar += "_FLAGS";
this->AppendFlags(flags, this->Makefile->GetDefinition(flagsVar));
- }
+ }
}
-void cmLocalGenerator::
-AddCompilerRequirementFlag(std::string &flags,
- cmGeneratorTarget const* target,
- const std::string& lang)
+void cmLocalGenerator::AddCompilerRequirementFlag(
+ std::string& flags, cmGeneratorTarget const* target, const std::string& lang)
{
- if (lang.empty())
- {
+ if (lang.empty()) {
return;
- }
- const char* defaultStd
- = this->Makefile->GetDefinition("CMAKE_" + lang + "_STANDARD_DEFAULT");
- if (!defaultStd || !*defaultStd)
- {
+ }
+ const char* defaultStd =
+ this->Makefile->GetDefinition("CMAKE_" + lang + "_STANDARD_DEFAULT");
+ if (!defaultStd || !*defaultStd) {
// This compiler has no notion of language standard levels.
return;
- }
+ }
std::string stdProp = lang + "_STANDARD";
- const char *standardProp = target->GetProperty(stdProp);
- if (!standardProp)
- {
+ const char* standardProp = target->GetProperty(stdProp);
+ if (!standardProp) {
return;
- }
+ }
std::string extProp = lang + "_EXTENSIONS";
std::string type = "EXTENSION";
bool ext = true;
- if (const char* extPropValue = target->GetProperty(extProp))
- {
- if (cmSystemTools::IsOff(extPropValue))
- {
+ if (const char* extPropValue = target->GetProperty(extProp)) {
+ if (cmSystemTools::IsOff(extPropValue)) {
ext = false;
type = "STANDARD";
- }
}
+ }
- if (target->GetPropertyAsBool(lang + "_STANDARD_REQUIRED"))
- {
+ if (target->GetPropertyAsBool(lang + "_STANDARD_REQUIRED")) {
std::string option_flag =
- "CMAKE_" + lang + standardProp
- + "_" + type + "_COMPILE_OPTION";
+ "CMAKE_" + lang + standardProp + "_" + type + "_COMPILE_OPTION";
- const char *opt = target->Target->GetMakefile()
- ->GetDefinition(option_flag);
- if (!opt)
- {
+ const char* opt =
+ target->Target->GetMakefile()->GetDefinition(option_flag);
+ if (!opt) {
std::ostringstream e;
e << "Target \"" << target->GetName() << "\" requires the language "
- "dialect \"" << lang << standardProp << "\" "
- << (ext ? "(with compiler extensions)" : "") << ", but CMake "
+ "dialect \""
+ << lang << standardProp << "\" "
+ << (ext ? "(with compiler extensions)" : "")
+ << ", but CMake "
"does not know the compile flags to use to enable it.";
this->IssueMessage(cmake::FATAL_ERROR, e.str());
- }
- else
- {
+ } else {
this->AppendFlagEscape(flags, opt);
- }
- return;
}
+ return;
+ }
static std::map<std::string, std::vector<std::string> > langStdMap;
- if (langStdMap.empty())
- {
+ if (langStdMap.empty()) {
// Maintain sorted order, most recent first.
langStdMap["CXX"].push_back("14");
langStdMap["CXX"].push_back("11");
@@ -2008,146 +1710,126 @@ AddCompilerRequirementFlag(std::string &flags,
langStdMap["C"].push_back("11");
langStdMap["C"].push_back("99");
langStdMap["C"].push_back("90");
- }
+ }
std::string standard(standardProp);
std::vector<std::string>& stds = langStdMap[lang];
std::vector<std::string>::const_iterator stdIt =
- std::find(stds.begin(), stds.end(), standard);
- if (stdIt == stds.end())
- {
+ std::find(stds.begin(), stds.end(), standard);
+ if (stdIt == stds.end()) {
std::string e =
lang + "_STANDARD is set to invalid value '" + standard + "'";
- this->GetGlobalGenerator()->GetCMakeInstance()
- ->IssueMessage(cmake::FATAL_ERROR, e, target->GetBacktrace());
+ this->GetGlobalGenerator()->GetCMakeInstance()->IssueMessage(
+ cmake::FATAL_ERROR, e, target->GetBacktrace());
return;
- }
+ }
std::vector<std::string>::const_iterator defaultStdIt =
std::find(stds.begin(), stds.end(), defaultStd);
- if (defaultStdIt == stds.end())
- {
- std::string e =
- "CMAKE_" + lang + "_STANDARD_DEFAULT is set to invalid value '" +
- std::string(defaultStd) + "'";
+ if (defaultStdIt == stds.end()) {
+ std::string e = "CMAKE_" + lang +
+ "_STANDARD_DEFAULT is set to invalid value '" + std::string(defaultStd) +
+ "'";
this->IssueMessage(cmake::INTERNAL_ERROR, e);
return;
- }
+ }
// Greater or equal because the standards are stored in
// backward chronological order.
- if (stdIt >= defaultStdIt)
- {
+ if (stdIt >= defaultStdIt) {
std::string option_flag =
- "CMAKE_" + lang + *stdIt
- + "_" + type + "_COMPILE_OPTION";
+ "CMAKE_" + lang + *stdIt + "_" + type + "_COMPILE_OPTION";
- const char *opt =
- target->Target->GetMakefile()->GetRequiredDefinition(option_flag);
+ const char* opt =
+ target->Target->GetMakefile()->GetRequiredDefinition(option_flag);
this->AppendFlagEscape(flags, opt);
return;
- }
+ }
- for ( ; stdIt < defaultStdIt; ++stdIt)
- {
+ for (; stdIt < defaultStdIt; ++stdIt) {
std::string option_flag =
- "CMAKE_" + lang + *stdIt
- + "_" + type + "_COMPILE_OPTION";
+ "CMAKE_" + lang + *stdIt + "_" + type + "_COMPILE_OPTION";
- if (const char *opt = target->Target
- ->GetMakefile()->GetDefinition(option_flag))
- {
+ if (const char* opt =
+ target->Target->GetMakefile()->GetDefinition(option_flag)) {
this->AppendFlagEscape(flags, opt);
return;
- }
}
+ }
}
-static void AddVisibilityCompileOption(std::string &flags,
+static void AddVisibilityCompileOption(std::string& flags,
cmGeneratorTarget const* target,
- cmLocalGenerator *lg,
+ cmLocalGenerator* lg,
const std::string& lang,
std::string* warnCMP0063)
{
std::string l(lang);
std::string compileOption = "CMAKE_" + l + "_COMPILE_OPTIONS_VISIBILITY";
- const char *opt = lg->GetMakefile()->GetDefinition(compileOption);
- if (!opt)
- {
+ const char* opt = lg->GetMakefile()->GetDefinition(compileOption);
+ if (!opt) {
return;
- }
+ }
std::string flagDefine = l + "_VISIBILITY_PRESET";
- const char *prop = target->GetProperty(flagDefine);
- if (!prop)
- {
+ const char* prop = target->GetProperty(flagDefine);
+ if (!prop) {
return;
- }
- if (warnCMP0063)
- {
+ }
+ if (warnCMP0063) {
*warnCMP0063 += " " + flagDefine + "\n";
return;
- }
- if (strcmp(prop, "hidden") != 0
- && strcmp(prop, "default") != 0
- && strcmp(prop, "protected") != 0
- && strcmp(prop, "internal") != 0 )
- {
+ }
+ if (strcmp(prop, "hidden") != 0 && strcmp(prop, "default") != 0 &&
+ strcmp(prop, "protected") != 0 && strcmp(prop, "internal") != 0) {
std::ostringstream e;
- e << "Target " << target->GetName() << " uses unsupported value \""
- << prop << "\" for " << flagDefine << ".";
+ e << "Target " << target->GetName() << " uses unsupported value \"" << prop
+ << "\" for " << flagDefine << ".";
cmSystemTools::Error(e.str().c_str());
return;
- }
+ }
std::string option = std::string(opt) + prop;
lg->AppendFlags(flags, option);
}
-static void AddInlineVisibilityCompileOption(std::string &flags,
- cmGeneratorTarget const* target,
- cmLocalGenerator *lg,
- std::string* warnCMP0063)
+static void AddInlineVisibilityCompileOption(std::string& flags,
+ cmGeneratorTarget const* target,
+ cmLocalGenerator* lg,
+ std::string* warnCMP0063)
{
- std::string compileOption
- = "CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN";
- const char *opt = lg->GetMakefile()->GetDefinition(compileOption);
- if (!opt)
- {
+ std::string compileOption =
+ "CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN";
+ const char* opt = lg->GetMakefile()->GetDefinition(compileOption);
+ if (!opt) {
return;
- }
+ }
bool prop = target->GetPropertyAsBool("VISIBILITY_INLINES_HIDDEN");
- if (!prop)
- {
+ if (!prop) {
return;
- }
- if (warnCMP0063)
- {
+ }
+ if (warnCMP0063) {
*warnCMP0063 += " VISIBILITY_INLINES_HIDDEN\n";
return;
- }
+ }
lg->AppendFlags(flags, opt);
}
-void cmLocalGenerator
-::AddVisibilityPresetFlags(std::string &flags, cmGeneratorTarget const* target,
- const std::string& lang)
+void cmLocalGenerator::AddVisibilityPresetFlags(
+ std::string& flags, cmGeneratorTarget const* target, const std::string& lang)
{
- if (lang.empty())
- {
+ if (lang.empty()) {
return;
- }
+ }
std::string warnCMP0063;
- std::string *pWarnCMP0063 = 0;
+ std::string* pWarnCMP0063 = 0;
if (target->GetType() != cmState::SHARED_LIBRARY &&
target->GetType() != cmState::MODULE_LIBRARY &&
- !target->IsExecutableWithExports())
- {
- switch (target->GetPolicyStatusCMP0063())
- {
+ !target->IsExecutableWithExports()) {
+ switch (target->GetPolicyStatusCMP0063()) {
case cmPolicies::OLD:
return;
case cmPolicies::WARN:
@@ -2155,19 +1837,16 @@ void cmLocalGenerator
break;
default:
break;
- }
}
+ }
AddVisibilityCompileOption(flags, target, this, lang, pWarnCMP0063);
- if(lang == "CXX")
- {
+ if (lang == "CXX") {
AddInlineVisibilityCompileOption(flags, target, this, pWarnCMP0063);
- }
+ }
- if (!warnCMP0063.empty() &&
- this->WarnCMP0063.insert(target).second)
- {
+ if (!warnCMP0063.empty() && this->WarnCMP0063.insert(target).second) {
std::ostringstream w;
/* clang-format off */
w <<
@@ -2178,13 +1857,12 @@ void cmLocalGenerator
warnCMP0063 <<
"For compatibility CMake is not honoring them for this target.";
/* clang-format on */
- target->GetLocalGenerator()->GetCMakeInstance()
- ->IssueMessage(cmake::AUTHOR_WARNING, w.str(),
- target->GetBacktrace());
- }
+ target->GetLocalGenerator()->GetCMakeInstance()->IssueMessage(
+ cmake::AUTHOR_WARNING, w.str(), target->GetBacktrace());
+ }
}
-void cmLocalGenerator::AddCMP0018Flags(std::string &flags,
+void cmLocalGenerator::AddCMP0018Flags(std::string& flags,
cmGeneratorTarget const* target,
std::string const& lang,
const std::string& config)
@@ -2192,60 +1870,50 @@ void cmLocalGenerator::AddCMP0018Flags(std::string &flags,
int targetType = target->GetType();
bool shared = ((targetType == cmState::SHARED_LIBRARY) ||
- (targetType == cmState::MODULE_LIBRARY));
+ (targetType == cmState::MODULE_LIBRARY));
- if (this->GetShouldUseOldFlags(shared, lang))
- {
+ if (this->GetShouldUseOldFlags(shared, lang)) {
this->AddSharedFlags(flags, lang, shared);
- }
- else
- {
- if (target->GetType() == cmState::OBJECT_LIBRARY)
- {
- if (target->GetPropertyAsBool("POSITION_INDEPENDENT_CODE"))
- {
+ } else {
+ if (target->GetType() == cmState::OBJECT_LIBRARY) {
+ if (target->GetPropertyAsBool("POSITION_INDEPENDENT_CODE")) {
this->AddPositionIndependentFlags(flags, lang, targetType);
- }
- return;
}
+ return;
+ }
if (target->GetLinkInterfaceDependentBoolProperty(
- "POSITION_INDEPENDENT_CODE",
- config))
- {
+ "POSITION_INDEPENDENT_CODE", config)) {
this->AddPositionIndependentFlags(flags, lang, targetType);
- }
- if (shared)
- {
+ }
+ if (shared) {
this->AppendFeatureOptions(flags, lang, "DLL");
- }
}
+ }
}
bool cmLocalGenerator::GetShouldUseOldFlags(bool shared,
- const std::string &lang) const
+ const std::string& lang) const
{
std::string originalFlags =
this->GlobalGenerator->GetSharedLibFlagsForLanguage(lang);
- if (shared)
- {
+ if (shared) {
std::string flagsVar = "CMAKE_SHARED_LIBRARY_";
flagsVar += lang;
flagsVar += "_FLAGS";
- const char* flags =
- this->Makefile->GetSafeDefinition(flagsVar);
-
- if (flags && flags != originalFlags)
- {
- switch (this->GetPolicyStatus(cmPolicies::CMP0018))
- {
- case cmPolicies::WARN:
- {
+ const char* flags = this->Makefile->GetSafeDefinition(flagsVar);
+
+ if (flags && flags != originalFlags) {
+ switch (this->GetPolicyStatus(cmPolicies::CMP0018)) {
+ case cmPolicies::WARN: {
std::ostringstream e;
- e << "Variable " << flagsVar << " has been modified. CMake "
- "will ignore the POSITION_INDEPENDENT_CODE target property for "
- "shared libraries and will use the " << flagsVar << " variable "
- "instead. This may cause errors if the original content of "
+ e << "Variable " << flagsVar
+ << " has been modified. CMake "
+ "will ignore the POSITION_INDEPENDENT_CODE target property for "
+ "shared libraries and will use the "
+ << flagsVar
+ << " variable "
+ "instead. This may cause errors if the original content of "
<< flagsVar << " was removed.\n"
<< cmPolicies::GetPolicyWarning(cmPolicies::CMP0018);
@@ -2258,9 +1926,9 @@ bool cmLocalGenerator::GetShouldUseOldFlags(bool shared,
case cmPolicies::REQUIRED_ALWAYS:
case cmPolicies::NEW:
return false;
- }
}
}
+ }
return false;
}
@@ -2270,30 +1938,26 @@ void cmLocalGenerator::AddPositionIndependentFlags(std::string& flags,
{
const char* picFlags = 0;
- if(targetType == cmState::EXECUTABLE)
- {
+ if (targetType == cmState::EXECUTABLE) {
std::string flagsVar = "CMAKE_";
flagsVar += lang;
flagsVar += "_COMPILE_OPTIONS_PIE";
picFlags = this->Makefile->GetSafeDefinition(flagsVar);
- }
- if (!picFlags)
- {
+ }
+ if (!picFlags) {
std::string flagsVar = "CMAKE_";
flagsVar += lang;
flagsVar += "_COMPILE_OPTIONS_PIC";
picFlags = this->Makefile->GetSafeDefinition(flagsVar);
- }
- if (picFlags)
- {
+ }
+ if (picFlags) {
std::vector<std::string> options;
cmSystemTools::ExpandListArgument(picFlags, options);
- for(std::vector<std::string>::const_iterator oi = options.begin();
- oi != options.end(); ++oi)
- {
+ for (std::vector<std::string>::const_iterator oi = options.begin();
+ oi != options.end(); ++oi) {
this->AppendFlagEscape(flags, *oi);
- }
}
+ }
}
void cmLocalGenerator::AddConfigVariableFlags(std::string& flags,
@@ -2304,34 +1968,29 @@ void cmLocalGenerator::AddConfigVariableFlags(std::string& flags,
std::string flagsVar = var;
this->AppendFlags(flags, this->Makefile->GetDefinition(flagsVar));
// Add the flags from the build-type specific variable.
- if(!config.empty())
- {
+ if (!config.empty()) {
flagsVar += "_";
flagsVar += cmSystemTools::UpperCase(config);
this->AppendFlags(flags, this->Makefile->GetDefinition(flagsVar));
- }
+ }
}
void cmLocalGenerator::AppendFlags(std::string& flags,
const std::string& newFlags)
{
- if(!newFlags.empty())
- {
- if(!flags.empty())
- {
+ if (!newFlags.empty()) {
+ if (!flags.empty()) {
flags += " ";
- }
- flags += newFlags;
}
+ flags += newFlags;
+ }
}
-void cmLocalGenerator::AppendFlags(std::string& flags,
- const char* newFlags)
+void cmLocalGenerator::AppendFlags(std::string& flags, const char* newFlags)
{
- if(newFlags && *newFlags)
- {
+ if (newFlags && *newFlags) {
this->AppendFlags(flags, std::string(newFlags));
- }
+ }
}
void cmLocalGenerator::AppendFlagEscape(std::string& flags,
@@ -2344,10 +2003,9 @@ void cmLocalGenerator::AppendDefines(std::set<std::string>& defines,
const char* defines_list)
{
// Short-circuit if there are no definitions.
- if(!defines_list)
- {
+ if (!defines_list) {
return;
- }
+ }
// Expand the list of definitions.
std::vector<std::string> defines_vec;
@@ -2355,48 +2013,42 @@ void cmLocalGenerator::AppendDefines(std::set<std::string>& defines,
this->AppendDefines(defines, defines_vec);
}
-void cmLocalGenerator::AppendDefines(std::set<std::string>& defines,
- const std::vector<std::string> &defines_vec)
+void cmLocalGenerator::AppendDefines(
+ std::set<std::string>& defines, const std::vector<std::string>& defines_vec)
{
- for(std::vector<std::string>::const_iterator di = defines_vec.begin();
- di != defines_vec.end(); ++di)
- {
+ for (std::vector<std::string>::const_iterator di = defines_vec.begin();
+ di != defines_vec.end(); ++di) {
// Skip unsupported definitions.
- if(!this->CheckDefinition(*di))
- {
+ if (!this->CheckDefinition(*di)) {
continue;
- }
- defines.insert(*di);
}
+ defines.insert(*di);
+ }
}
void cmLocalGenerator::JoinDefines(const std::set<std::string>& defines,
- std::string &definesString,
+ std::string& definesString,
const std::string& lang)
{
// Lookup the define flag for the current language.
std::string dflag = "-D";
- if(!lang.empty())
- {
+ if (!lang.empty()) {
std::string defineFlagVar = "CMAKE_";
defineFlagVar += lang;
defineFlagVar += "_DEFINE_FLAG";
const char* df = this->Makefile->GetDefinition(defineFlagVar);
- if(df && *df)
- {
+ if (df && *df) {
dflag = df;
- }
}
+ }
std::set<std::string>::const_iterator defineIt = defines.begin();
const std::set<std::string>::const_iterator defineEnd = defines.end();
const char* itemSeparator = definesString.empty() ? "" : " ";
- for( ; defineIt != defineEnd; ++defineIt)
- {
+ for (; defineIt != defineEnd; ++defineIt) {
// Append the definition with proper escaping.
std::string def = dflag;
- if(this->GetState()->UseWatcomWMake())
- {
+ if (this->GetState()->UseWatcomWMake()) {
// The Watcom compiler does its own command line parsing instead
// of using the windows shell rules. Definitions are one of
// -DNAME
@@ -2407,50 +2059,44 @@ void cmLocalGenerator::JoinDefines(const std::set<std::string>& defines,
// command line without any escapes. However we still have to
// get the '$' and '#' characters through WMake as '$$' and
// '$#'.
- for(const char* c = defineIt->c_str(); *c; ++c)
- {
- if(*c == '$' || *c == '#')
- {
+ for (const char* c = defineIt->c_str(); *c; ++c) {
+ if (*c == '$' || *c == '#') {
def += '$';
- }
- def += *c;
}
+ def += *c;
}
- else
- {
+ } else {
// Make the definition appear properly on the command line. Use
// -DNAME="value" instead of -D"NAME=value" for historical reasons.
std::string::size_type eq = defineIt->find("=");
def += defineIt->substr(0, eq);
- if(eq != defineIt->npos)
- {
+ if (eq != defineIt->npos) {
def += "=";
def += this->EscapeForShell(defineIt->c_str() + eq + 1, true);
- }
}
+ }
definesString += itemSeparator;
itemSeparator = " ";
definesString += def;
- }
+ }
}
-void cmLocalGenerator::AppendFeatureOptions(
- std::string& flags, const std::string& lang, const char* feature)
+void cmLocalGenerator::AppendFeatureOptions(std::string& flags,
+ const std::string& lang,
+ const char* feature)
{
std::string optVar = "CMAKE_";
optVar += lang;
optVar += "_COMPILE_OPTIONS_";
optVar += feature;
- if(const char* optionList = this->Makefile->GetDefinition(optVar))
- {
+ if (const char* optionList = this->Makefile->GetDefinition(optVar)) {
std::vector<std::string> options;
cmSystemTools::ExpandListArgument(optionList, options);
- for(std::vector<std::string>::const_iterator oi = options.begin();
- oi != options.end(); ++oi)
- {
+ for (std::vector<std::string>::const_iterator oi = options.begin();
+ oi != options.end(); ++oi) {
this->AppendFlagEscape(flags, *oi);
- }
}
+ }
}
const char* cmLocalGenerator::GetFeature(const std::string& feature,
@@ -2459,20 +2105,17 @@ const char* cmLocalGenerator::GetFeature(const std::string& feature,
std::string featureName = feature;
// TODO: Define accumulation policy for features (prepend, append, replace).
// Currently we always replace.
- if(!config.empty())
- {
+ if (!config.empty()) {
featureName += "_";
featureName += cmSystemTools::UpperCase(config);
- }
+ }
cmState::Snapshot snp = this->StateSnapshot;
- while(snp.IsValid())
- {
- if(const char* value = snp.GetDirectory().GetProperty(featureName))
- {
+ while (snp.IsValid()) {
+ if (const char* value = snp.GetDirectory().GetProperty(featureName)) {
return value;
- }
- snp = snp.GetBuildsystemDirectoryParent();
}
+ snp = snp.GetBuildsystemDirectoryParent();
+ }
return 0;
}
@@ -2481,135 +2124,118 @@ std::string cmLocalGenerator::GetProjectName() const
return this->StateSnapshot.GetProjectName();
}
-std::string
-cmLocalGenerator::ConstructComment(cmCustomCommandGenerator const& ccg,
- const char* default_comment)
+std::string cmLocalGenerator::ConstructComment(
+ cmCustomCommandGenerator const& ccg, const char* default_comment)
{
// Check for a comment provided with the command.
- if(ccg.GetComment())
- {
+ if (ccg.GetComment()) {
return ccg.GetComment();
- }
+ }
// Construct a reasonable default comment if possible.
- if(!ccg.GetOutputs().empty())
- {
+ if (!ccg.GetOutputs().empty()) {
std::string comment;
comment = "Generating ";
const char* sep = "";
- for(std::vector<std::string>::const_iterator o = ccg.GetOutputs().begin();
- o != ccg.GetOutputs().end(); ++o)
- {
+ for (std::vector<std::string>::const_iterator o = ccg.GetOutputs().begin();
+ o != ccg.GetOutputs().end(); ++o) {
comment += sep;
comment += this->Convert(*o, cmLocalGenerator::START_OUTPUT);
sep = ", ";
- }
- return comment;
}
+ return comment;
+ }
// Otherwise use the provided default.
return default_comment;
}
-class cmInstallTargetGeneratorLocal: public cmInstallTargetGenerator
+class cmInstallTargetGeneratorLocal : public cmInstallTargetGenerator
{
public:
cmInstallTargetGeneratorLocal(cmLocalGenerator* lg, std::string const& t,
- const char* dest, bool implib):
- cmInstallTargetGenerator(
- t, dest, implib, "", std::vector<std::string>(), "Unspecified",
- cmInstallGenerator::SelectMessageLevel(lg->GetMakefile()),
- false, false)
+ const char* dest, bool implib)
+ : cmInstallTargetGenerator(
+ t, dest, implib, "", std::vector<std::string>(), "Unspecified",
+ cmInstallGenerator::SelectMessageLevel(lg->GetMakefile()), false,
+ false)
{
this->Compute(lg);
}
};
-void
-cmLocalGenerator
-::GenerateTargetInstallRules(
+void cmLocalGenerator::GenerateTargetInstallRules(
std::ostream& os, const std::string& config,
std::vector<std::string> const& configurationTypes)
{
// Convert the old-style install specification from each target to
// an install generator and run it.
std::vector<cmGeneratorTarget*> tgts = this->GetGeneratorTargets();
- for(std::vector<cmGeneratorTarget*>::iterator l = tgts.begin();
- l != tgts.end(); ++l)
- {
- if ((*l)->GetType() == cmState::INTERFACE_LIBRARY)
- {
+ for (std::vector<cmGeneratorTarget*>::iterator l = tgts.begin();
+ l != tgts.end(); ++l) {
+ if ((*l)->GetType() == cmState::INTERFACE_LIBRARY) {
continue;
- }
+ }
// Include the user-specified pre-install script for this target.
- if(const char* preinstall = (*l)->GetProperty("PRE_INSTALL_SCRIPT"))
- {
+ if (const char* preinstall = (*l)->GetProperty("PRE_INSTALL_SCRIPT")) {
cmInstallScriptGenerator g(preinstall, false, 0, false);
g.Generate(os, config, configurationTypes);
- }
+ }
// Install this target if a destination is given.
- if((*l)->Target->GetInstallPath() != "")
- {
+ if ((*l)->Target->GetInstallPath() != "") {
// Compute the full install destination. Note that converting
// to unix slashes also removes any trailing slash.
// We also skip over the leading slash given by the user.
std::string destination = (*l)->Target->GetInstallPath().substr(1);
cmSystemTools::ConvertToUnixSlashes(destination);
- if(destination.empty())
- {
+ if (destination.empty()) {
destination = ".";
- }
+ }
// Generate the proper install generator for this target type.
- switch((*l)->GetType())
- {
+ switch ((*l)->GetType()) {
case cmState::EXECUTABLE:
case cmState::STATIC_LIBRARY:
- case cmState::MODULE_LIBRARY:
- {
+ case cmState::MODULE_LIBRARY: {
// Use a target install generator.
- cmInstallTargetGeneratorLocal
- g(this, (*l)->GetName(), destination.c_str(), false);
+ cmInstallTargetGeneratorLocal g(this, (*l)->GetName(),
+ destination.c_str(), false);
g.Generate(os, config, configurationTypes);
- }
- break;
- case cmState::SHARED_LIBRARY:
- {
+ } break;
+ case cmState::SHARED_LIBRARY: {
#if defined(_WIN32) || defined(__CYGWIN__)
// Special code to handle DLL. Install the import library
// to the normal destination and the DLL to the runtime
// destination.
- cmInstallTargetGeneratorLocal
- g1(this, (*l)->GetName(), destination.c_str(), true);
+ cmInstallTargetGeneratorLocal g1(this, (*l)->GetName(),
+ destination.c_str(), true);
g1.Generate(os, config, configurationTypes);
// We also skip over the leading slash given by the user.
destination = (*l)->Target->GetRuntimeInstallPath().substr(1);
cmSystemTools::ConvertToUnixSlashes(destination);
- cmInstallTargetGeneratorLocal
- g2(this, (*l)->GetName(), destination.c_str(), false);
+ cmInstallTargetGeneratorLocal g2(this, (*l)->GetName(),
+ destination.c_str(), false);
g2.Generate(os, config, configurationTypes);
#else
// Use a target install generator.
- cmInstallTargetGeneratorLocal
- g(this, (*l)->GetName(), destination.c_str(), false);
+ cmInstallTargetGeneratorLocal g(this, (*l)->GetName(),
+ destination.c_str(), false);
g.Generate(os, config, configurationTypes);
#endif
- }
- break;
+ } break;
default:
break;
- }
}
+ }
// Include the user-specified post-install script for this target.
- if(const char* postinstall = (*l)->GetProperty("POST_INSTALL_SCRIPT"))
- {
+ if (const char* postinstall = (*l)->GetProperty("POST_INSTALL_SCRIPT")) {
cmInstallScriptGenerator g(postinstall, false, 0, false);
g.Generate(os, config, configurationTypes);
- }
}
+ }
}
#if defined(CM_LG_ENCODE_OBJECT_NAMES)
@@ -2624,27 +2250,24 @@ static std::string cmLocalGeneratorMD5(const char* input)
return std::string(md5out, 32);
}
-static bool
-cmLocalGeneratorShortenObjectName(std::string& objName,
- std::string::size_type max_len)
+static bool cmLocalGeneratorShortenObjectName(std::string& objName,
+ std::string::size_type max_len)
{
// Replace the beginning of the path portion of the object name with
// its own md5 sum.
- std::string::size_type pos = objName.find('/', objName.size()-max_len+32);
- if(pos != objName.npos)
- {
+ std::string::size_type pos =
+ objName.find('/', objName.size() - max_len + 32);
+ if (pos != objName.npos) {
std::string md5name = cmLocalGeneratorMD5(objName.substr(0, pos).c_str());
md5name += objName.substr(pos);
objName = md5name;
// The object name is now short enough.
return true;
- }
- else
- {
+ } else {
// The object name could not be shortened enough.
return false;
- }
+ }
}
bool cmLocalGeneratorCheckObjectName(std::string& objName,
@@ -2653,41 +2276,32 @@ bool cmLocalGeneratorCheckObjectName(std::string& objName,
{
// Enforce the maximum file name length if possible.
std::string::size_type max_obj_len = max_total_len;
- if(dir_len < max_total_len)
- {
+ if (dir_len < max_total_len) {
max_obj_len = max_total_len - dir_len;
- if(objName.size() > max_obj_len)
- {
+ if (objName.size() > max_obj_len) {
// The current object file name is too long. Try to shorten it.
return cmLocalGeneratorShortenObjectName(objName, max_obj_len);
- }
- else
- {
+ } else {
// The object file name is short enough.
return true;
- }
}
- else
- {
+ } else {
// The build directory in which the object will be stored is
// already too deep.
return false;
- }
+ }
}
#endif
-std::string&
-cmLocalGenerator
-::CreateSafeUniqueObjectFileName(const std::string& sin,
- std::string const& dir_max)
+std::string& cmLocalGenerator::CreateSafeUniqueObjectFileName(
+ const std::string& sin, std::string const& dir_max)
{
// Look for an existing mapped name for this object file.
- std::map<std::string,std::string>::iterator it =
+ std::map<std::string, std::string>::iterator it =
this->UniqueObjectNamesMap.find(sin);
// If no entry exists create one.
- if(it == this->UniqueObjectNamesMap.end())
- {
+ if (it == this->UniqueObjectNamesMap.end()) {
// Start with the original name.
std::string ssin = sin;
@@ -2704,44 +2318,35 @@ cmLocalGenerator
cmSystemTools::ReplaceString(ssin, " ", "_");
// Mangle the name if necessary.
- if(this->Makefile->IsOn("CMAKE_MANGLE_OBJECT_FILE_NAMES"))
- {
+ if (this->Makefile->IsOn("CMAKE_MANGLE_OBJECT_FILE_NAMES")) {
bool done;
int cc = 0;
char rpstr[100];
sprintf(rpstr, "_p_");
cmSystemTools::ReplaceString(ssin, "+", rpstr);
std::string sssin = sin;
- do
- {
+ do {
done = true;
- for ( it = this->UniqueObjectNamesMap.begin();
- it != this->UniqueObjectNamesMap.end();
- ++ it )
- {
- if ( it->second == ssin )
- {
+ for (it = this->UniqueObjectNamesMap.begin();
+ it != this->UniqueObjectNamesMap.end(); ++it) {
+ if (it->second == ssin) {
done = false;
- }
}
- if ( done )
- {
+ }
+ if (done) {
break;
- }
+ }
sssin = ssin;
cmSystemTools::ReplaceString(ssin, "_p_", rpstr);
sprintf(rpstr, "_p%d_", cc++);
- }
- while ( !done );
- }
+ } while (!done);
+ }
#if defined(CM_LG_ENCODE_OBJECT_NAMES)
- if(!cmLocalGeneratorCheckObjectName(ssin, dir_max.size(),
- this->ObjectPathMax))
- {
+ if (!cmLocalGeneratorCheckObjectName(ssin, dir_max.size(),
+ this->ObjectPathMax)) {
// Warn if this is the first time the path has been seen.
- if(this->ObjectMaxPathViolations.insert(dir_max).second)
- {
+ if (this->ObjectMaxPathViolations.insert(dir_max).second) {
std::ostringstream m;
/* clang-format off */
m << "The object file directory\n"
@@ -2756,8 +2361,8 @@ cmLocalGenerator
<< "The build may not work correctly.";
/* clang-format on */
this->IssueMessage(cmake::WARNING, m.str());
- }
}
+ }
#else
(void)dir_max;
#endif
@@ -2765,17 +2370,15 @@ cmLocalGenerator
// Insert the newly mapped object file name.
std::map<std::string, std::string>::value_type e(sin, ssin);
it = this->UniqueObjectNamesMap.insert(e).first;
- }
+ }
// Return the map entry.
return it->second;
}
void cmLocalGenerator::ComputeObjectFilenames(
- std::map<cmSourceFile const*, std::string>&,
- cmGeneratorTarget const*)
+ std::map<cmSourceFile const*, std::string>&, cmGeneratorTarget const*)
{
-
}
bool cmLocalGenerator::IsWindowsShell() const
@@ -2798,11 +2401,9 @@ bool cmLocalGenerator::IsNMake() const
return this->GetState()->UseNMake();
}
-std::string
-cmLocalGenerator
-::GetObjectFileNameWithoutTarget(const cmSourceFile& source,
- std::string const& dir_max,
- bool* hasSourceExtension)
+std::string cmLocalGenerator::GetObjectFileNameWithoutTarget(
+ const cmSourceFile& source, std::string const& dir_max,
+ bool* hasSourceExtension)
{
// Construct the object file name using the full path to the source
// file which is its only unique identification.
@@ -2823,82 +2424,64 @@ cmLocalGenerator
// Select a nice-looking reference to the source file to construct
// the object file name.
std::string objectName;
- if((relSource && !relBinary) || (subSource && !subBinary))
- {
+ if ((relSource && !relBinary) || (subSource && !subBinary)) {
objectName = relFromSource;
- }
- else if((relBinary && !relSource) || (subBinary && !subSource))
- {
+ } else if ((relBinary && !relSource) || (subBinary && !subSource)) {
objectName = relFromBinary;
- }
- else if(relFromBinary.length() < relFromSource.length())
- {
+ } else if (relFromBinary.length() < relFromSource.length()) {
objectName = relFromBinary;
- }
- else
- {
+ } else {
objectName = relFromSource;
- }
+ }
// if it is still a full path check for the try compile case
// try compile never have in source sources, and should not
// have conflicting source file names in the same target
- if(cmSystemTools::FileIsFullPath(objectName.c_str()))
- {
- if(this->GetGlobalGenerator()->GetCMakeInstance()->GetIsInTryCompile())
- {
+ if (cmSystemTools::FileIsFullPath(objectName.c_str())) {
+ if (this->GetGlobalGenerator()->GetCMakeInstance()->GetIsInTryCompile()) {
objectName = cmSystemTools::GetFilenameName(source.GetFullPath());
- }
}
+ }
// Replace the original source file extension with the object file
// extension.
bool keptSourceExtension = true;
- if(!source.GetPropertyAsBool("KEEP_EXTENSION"))
- {
+ if (!source.GetPropertyAsBool("KEEP_EXTENSION")) {
// Decide whether this language wants to replace the source
// extension with the object extension. For CMake 2.4
// compatibility do this by default.
bool replaceExt = this->NeedBackwardsCompatibility_2_4();
- if(!replaceExt)
- {
+ if (!replaceExt) {
std::string lang = source.GetLanguage();
- if(!lang.empty())
- {
+ if (!lang.empty()) {
std::string repVar = "CMAKE_";
repVar += lang;
repVar += "_OUTPUT_EXTENSION_REPLACE";
replaceExt = this->Makefile->IsOn(repVar);
- }
}
+ }
// Remove the source extension if it is to be replaced.
- if(replaceExt)
- {
+ if (replaceExt) {
keptSourceExtension = false;
std::string::size_type dot_pos = objectName.rfind(".");
- if(dot_pos != std::string::npos)
- {
+ if (dot_pos != std::string::npos) {
objectName = objectName.substr(0, dot_pos);
- }
}
+ }
// Store the new extension.
- objectName +=
- this->GlobalGenerator->GetLanguageOutputExtension(source);
- }
- if(hasSourceExtension)
- {
+ objectName += this->GlobalGenerator->GetLanguageOutputExtension(source);
+ }
+ if (hasSourceExtension) {
*hasSourceExtension = keptSourceExtension;
- }
+ }
// Convert to a safe name.
return this->CreateSafeUniqueObjectFileName(objectName, dir_max);
}
-std::string
-cmLocalGenerator
-::GetSourceFileLanguage(const cmSourceFile& source)
+std::string cmLocalGenerator::GetSourceFileLanguage(const cmSourceFile& source)
{
return source.GetLanguage();
}
@@ -2928,8 +2511,8 @@ const char* cmLocalGenerator::GetCurrentSourceDirectory() const
return this->StateSnapshot.GetDirectory().GetCurrentSource();
}
-std::string
-cmLocalGenerator::GetTargetDirectory(const cmGeneratorTarget*) const
+std::string cmLocalGenerator::GetTargetDirectory(
+ const cmGeneratorTarget*) const
{
cmSystemTools::Error("GetTargetDirectory"
" called on cmLocalGenerator");
@@ -2940,24 +2523,27 @@ KWIML_INT_uint64_t cmLocalGenerator::GetBackwardsCompatibility()
{
// The computed version may change until the project is fully
// configured.
- if(!this->BackwardsCompatibilityFinal)
- {
+ if (!this->BackwardsCompatibilityFinal) {
unsigned int major = 0;
unsigned int minor = 0;
unsigned int patch = 0;
- if(const char* value
- = this->Makefile->GetDefinition("CMAKE_BACKWARDS_COMPATIBILITY"))
- {
- switch(sscanf(value, "%u.%u.%u", &major, &minor, &patch))
- {
- case 2: patch = 0; break;
- case 1: minor = 0; patch = 0; break;
- default: break;
- }
+ if (const char* value =
+ this->Makefile->GetDefinition("CMAKE_BACKWARDS_COMPATIBILITY")) {
+ switch (sscanf(value, "%u.%u.%u", &major, &minor, &patch)) {
+ case 2:
+ patch = 0;
+ break;
+ case 1:
+ minor = 0;
+ patch = 0;
+ break;
+ default:
+ break;
}
+ }
this->BackwardsCompatibility = CMake_VERSION_ENCODE(major, minor, patch);
this->BackwardsCompatibilityFinal = true;
- }
+ }
return this->BackwardsCompatibility;
}
@@ -2966,11 +2552,10 @@ bool cmLocalGenerator::NeedBackwardsCompatibility_2_4()
{
// Check the policy to decide whether to pay attention to this
// variable.
- switch(this->GetPolicyStatus(cmPolicies::CMP0001))
- {
+ switch (this->GetPolicyStatus(cmPolicies::CMP0001)) {
case cmPolicies::WARN:
- // WARN is just OLD without warning because user code does not
- // always affect whether this check is done.
+ // WARN is just OLD without warning because user code does not
+ // always affect whether this check is done.
case cmPolicies::OLD:
// Old behavior is to check the variable.
break;
@@ -2984,17 +2569,16 @@ bool cmLocalGenerator::NeedBackwardsCompatibility_2_4()
// 2.6 or higher. Once we add that requirement then this whole
// method can be removed anyway.
return false;
- }
+ }
// Compatibility is needed if CMAKE_BACKWARDS_COMPATIBILITY is set
// equal to or lower than the given version.
KWIML_INT_uint64_t actual_compat = this->GetBackwardsCompatibility();
- return (actual_compat &&
- actual_compat <= CMake_VERSION_ENCODE(2, 4, 255));
+ return (actual_compat && actual_compat <= CMake_VERSION_ENCODE(2, 4, 255));
}
-cmPolicies::PolicyStatus
-cmLocalGenerator::GetPolicyStatus(cmPolicies::PolicyID id) const
+cmPolicies::PolicyStatus cmLocalGenerator::GetPolicyStatus(
+ cmPolicies::PolicyID id) const
{
return this->Makefile->GetPolicyStatus(id);
}
@@ -3003,10 +2587,8 @@ bool cmLocalGenerator::CheckDefinition(std::string const& define) const
{
// Many compilers do not support -DNAME(arg)=sdf so we disable it.
std::string::size_type pos = define.find_first_of("(=");
- if (pos != std::string::npos)
- {
- if (define[pos] == '(')
- {
+ if (pos != std::string::npos) {
+ if (define[pos] == '(') {
std::ostringstream e;
/* clang-format off */
e << "WARNING: Function-style preprocessor definitions may not be "
@@ -3017,12 +2599,11 @@ bool cmLocalGenerator::CheckDefinition(std::string const& define) const
/* clang-format on */
cmSystemTools::Message(e.str().c_str());
return false;
- }
}
+ }
// Many compilers do not support # in the value so we disable it.
- if(define.find_first_of("#") != define.npos)
- {
+ if (define.find_first_of("#") != define.npos) {
std::ostringstream e;
/* clang-format off */
e << "WARNING: Preprocessor definitions containing '#' may not be "
@@ -3033,19 +2614,18 @@ bool cmLocalGenerator::CheckDefinition(std::string const& define) const
/* clang-format on */
cmSystemTools::Message(e.str().c_str());
return false;
- }
+ }
// Assume it is supported.
return true;
}
static void cmLGInfoProp(cmMakefile* mf, cmGeneratorTarget* target,
- const std::string& prop)
+ const std::string& prop)
{
- if(const char* val = target->GetProperty(prop))
- {
+ if (const char* val = target->GetProperty(prop)) {
mf->AddDefinition(prop, val);
- }
+ }
}
void cmLocalGenerator::GenerateAppleInfoPList(cmGeneratorTarget* target,
@@ -3054,23 +2634,20 @@ void cmLocalGenerator::GenerateAppleInfoPList(cmGeneratorTarget* target,
{
// Find the Info.plist template.
const char* in = target->GetProperty("MACOSX_BUNDLE_INFO_PLIST");
- std::string inFile = (in && *in)? in : "MacOSXBundleInfo.plist.in";
- if(!cmSystemTools::FileIsFullPath(inFile.c_str()))
- {
+ std::string inFile = (in && *in) ? in : "MacOSXBundleInfo.plist.in";
+ if (!cmSystemTools::FileIsFullPath(inFile.c_str())) {
std::string inMod = this->Makefile->GetModulesFile(inFile.c_str());
- if(!inMod.empty())
- {
+ if (!inMod.empty()) {
inFile = inMod;
- }
}
- if(!cmSystemTools::FileExists(inFile.c_str(), true))
- {
+ }
+ if (!cmSystemTools::FileExists(inFile.c_str(), true)) {
std::ostringstream e;
- e << "Target " << target->GetName() << " Info.plist template \""
- << inFile << "\" could not be found.";
+ e << "Target " << target->GetName() << " Info.plist template \"" << inFile
+ << "\" could not be found.";
cmSystemTools::Error(e.str().c_str());
return;
- }
+ }
// Convert target properties to variables in an isolated makefile
// scope to configure the file. If properties are set they will
@@ -3090,29 +2667,25 @@ void cmLocalGenerator::GenerateAppleInfoPList(cmGeneratorTarget* target,
mf->ConfigureFile(inFile.c_str(), fname, false, false, false);
}
-void cmLocalGenerator::GenerateFrameworkInfoPList(cmGeneratorTarget* target,
- const std::string& targetName,
- const char* fname)
+void cmLocalGenerator::GenerateFrameworkInfoPList(
+ cmGeneratorTarget* target, const std::string& targetName, const char* fname)
{
// Find the Info.plist template.
const char* in = target->GetProperty("MACOSX_FRAMEWORK_INFO_PLIST");
- std::string inFile = (in && *in)? in : "MacOSXFrameworkInfo.plist.in";
- if(!cmSystemTools::FileIsFullPath(inFile.c_str()))
- {
+ std::string inFile = (in && *in) ? in : "MacOSXFrameworkInfo.plist.in";
+ if (!cmSystemTools::FileIsFullPath(inFile.c_str())) {
std::string inMod = this->Makefile->GetModulesFile(inFile.c_str());
- if(!inMod.empty())
- {
+ if (!inMod.empty()) {
inFile = inMod;
- }
}
- if(!cmSystemTools::FileExists(inFile.c_str(), true))
- {
+ }
+ if (!cmSystemTools::FileExists(inFile.c_str(), true)) {
std::ostringstream e;
- e << "Target " << target->GetName() << " Info.plist template \""
- << inFile << "\" could not be found.";
+ e << "Target " << target->GetName() << " Info.plist template \"" << inFile
+ << "\" could not be found.";
cmSystemTools::Error(e.str().c_str());
return;
- }
+ }
// Convert target properties to variables in an isolated makefile
// scope to configure the file. If properties are set they will