summaryrefslogtreecommitdiffstats
path: root/Source/cmMakefile.cxx
diff options
context:
space:
mode:
authorDavid Cole <david.cole@kitware.com>2010-10-19 19:53:16 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2010-10-19 19:53:16 (GMT)
commitb0fb2ad3e14adfee62d16439f509a65eee341f81 (patch)
treed09ffbb4d629f2764bbbedae5629b291ebaa8706 /Source/cmMakefile.cxx
parent915e5805d997eb748688a093519c8fa548118aa7 (diff)
parentb01184022be821adc3fee277365d4f7bb6244ff2 (diff)
downloadCMake-b0fb2ad3e14adfee62d16439f509a65eee341f81.zip
CMake-b0fb2ad3e14adfee62d16439f509a65eee341f81.tar.gz
CMake-b0fb2ad3e14adfee62d16439f509a65eee341f81.tar.bz2
Merge topic 'AddCMAKE_CURRENT_LIST_DIR'
b011840 Use absolute path to FindPackageHandleStandardArgs.cmake everywhere 41e4f1a Add automatic variable CMAKE_CURRENT_LIST_DIR(dir of CMAKE_CURRENT_LIST_FILE) f9fc79c Remove trailing whitespace
Diffstat (limited to 'Source/cmMakefile.cxx')
-rw-r--r--Source/cmMakefile.cxx46
1 files changed, 26 insertions, 20 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index ef15113..56e0ed9 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -353,7 +353,7 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff,
// No error.
return result;
}
-
+
std::string name = lff.Name;
// Place this call on the call stack.
@@ -377,7 +377,7 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff,
cmOStringStream msg;
msg << lff.FilePath << "(" << lff.Line << "): ";
msg << lff.Name << "(";
- for(std::vector<cmListFileArgument>::const_iterator i =
+ for(std::vector<cmListFileArgument>::const_iterator i =
lff.Arguments.begin(); i != lff.Arguments.end(); ++i)
{
msg << i->Value;
@@ -610,6 +610,8 @@ bool cmMakefile::ReadListFile(const char* filename_in,
}
this->AddDefinition("CMAKE_CURRENT_LIST_FILE", filenametoread);
+ this->AddDefinition("CMAKE_CURRENT_LIST_DIR",
+ cmSystemTools::GetFilenamePath(filenametoread).c_str());
// try to see if the list file is the top most
// list file for a project, and if it is, then it
@@ -643,6 +645,8 @@ bool cmMakefile::ReadListFile(const char* filename_in,
}
this->AddDefinition("CMAKE_PARENT_LIST_FILE", currentParentFile.c_str());
this->AddDefinition("CMAKE_CURRENT_LIST_FILE", currentFile.c_str());
+ this->AddDefinition("CMAKE_CURRENT_LIST_DIR",
+ cmSystemTools::GetFilenamePath(currentFile).c_str());
return false;
}
// add this list file to the list of dependencies
@@ -683,6 +687,8 @@ bool cmMakefile::ReadListFile(const char* filename_in,
this->AddDefinition("CMAKE_PARENT_LIST_FILE", currentParentFile.c_str());
this->AddDefinition("CMAKE_CURRENT_LIST_FILE", currentFile.c_str());
+ this->AddDefinition("CMAKE_CURRENT_LIST_DIR",
+ cmSystemTools::GetFilenamePath(currentFile).c_str());
// pop the listfile off the stack
this->ListFileStack.pop_back();
@@ -1742,8 +1748,8 @@ void cmMakefile::AddLibrary(const char* lname, cmTarget::TargetType type,
bool excludeFromAll)
{
// wrong type ? default to STATIC
- if ( (type != cmTarget::STATIC_LIBRARY)
- && (type != cmTarget::SHARED_LIBRARY)
+ if ( (type != cmTarget::STATIC_LIBRARY)
+ && (type != cmTarget::SHARED_LIBRARY)
&& (type != cmTarget::MODULE_LIBRARY))
{
type = cmTarget::STATIC_LIBRARY;
@@ -2325,14 +2331,14 @@ void cmMakefile::AddDefaultDefinitions()
{
/* Up to CMake 2.4 here only WIN32, UNIX and APPLE were set.
With CMake must separate between target and host platform. In most cases
- the tests for WIN32, UNIX and APPLE will be for the target system, so an
+ the tests for WIN32, UNIX and APPLE will be for the target system, so an
additional set of variables for the host system is required ->
CMAKE_HOST_WIN32, CMAKE_HOST_UNIX, CMAKE_HOST_APPLE.
- WIN32, UNIX and APPLE are now set in the platform files in
+ WIN32, UNIX and APPLE are now set in the platform files in
Modules/Platforms/.
To keep cmake scripts (-P) and custom language and compiler modules
working, these variables are still also set here in this place, but they
- will be reset in CMakeSystemSpecificInformation.cmake before the platform
+ will be reset in CMakeSystemSpecificInformation.cmake before the platform
files are executed. */
#if defined(_WIN32) || defined(__CYGWIN__)
this->AddDefinition("WIN32", "1");
@@ -2643,13 +2649,13 @@ cmSourceFile* cmMakefile::GetOrCreateSource(const char* sourceName,
}
}
-void cmMakefile::EnableLanguage(std::vector<std::string> const & lang,
+void cmMakefile::EnableLanguage(std::vector<std::string> const & lang,
bool optional)
{
this->AddDefinition("CMAKE_CFG_INTDIR",
this->LocalGenerator->GetGlobalGenerator()
->GetCMakeCFGInitDirectory());
- this->LocalGenerator->GetGlobalGenerator()->EnableLanguage(lang, this,
+ this->LocalGenerator->GetGlobalGenerator()->EnableLanguage(lang, this,
optional);
}
@@ -2725,7 +2731,7 @@ int cmMakefile::TryCompile(const char *srcdir, const char *bindir,
{
cm.AddCacheEntry("CMAKE_SUPPRESS_DEVELOPER_WARNINGS",
"FALSE", "", cmCacheManager::INTERNAL);
- }
+ }
if (cm.Configure() != 0)
{
cmSystemTools::Error(
@@ -3013,7 +3019,7 @@ void cmMakefile::SetProperty(const char* prop, const char* value)
{
return;
}
-
+
// handle special props
std::string propname = prop;
if ( propname == "INCLUDE_DIRECTORIES" )
@@ -3037,7 +3043,7 @@ void cmMakefile::SetProperty(const char* prop, const char* value)
this->SetLinkDirectories(varArgsExpanded);
return;
}
-
+
if ( propname == "INCLUDE_REGULAR_EXPRESSION" )
{
this->SetIncludeRegularExpression(value);
@@ -3047,7 +3053,7 @@ void cmMakefile::SetProperty(const char* prop, const char* value)
if ( propname == "ADDITIONAL_MAKE_CLEAN_FILES" )
{
// This property is not inherrited
- if ( strcmp(this->GetCurrentDirectory(),
+ if ( strcmp(this->GetCurrentDirectory(),
this->GetStartDirectory()) != 0 )
{
return;
@@ -3168,14 +3174,14 @@ const char *cmMakefile::GetProperty(const char* prop,
return output.c_str();
}
else if (!strcmp("DEFINITIONS",prop))
- {
+ {
output += this->DefineFlagsOrig;
return output.c_str();
}
else if (!strcmp("INCLUDE_DIRECTORIES",prop) )
{
cmOStringStream str;
- for (std::vector<std::string>::const_iterator
+ for (std::vector<std::string>::const_iterator
it = this->GetIncludeDirectories().begin();
it != this->GetIncludeDirectories().end();
++ it )
@@ -3192,7 +3198,7 @@ const char *cmMakefile::GetProperty(const char* prop,
else if (!strcmp("LINK_DIRECTORIES",prop))
{
cmOStringStream str;
- for (std::vector<std::string>::const_iterator
+ for (std::vector<std::string>::const_iterator
it = this->GetLinkDirectories().begin();
it != this->GetLinkDirectories().end();
++ it )
@@ -3606,7 +3612,7 @@ bool cmMakefile::EnforceUniqueName(std::string const& name, std::string& msg,
msg = e.str();
return false;
}
- else
+ else
{
// target names must be globally unique
switch (this->GetPolicyStatus(cmPolicies::CMP0002))
@@ -3625,7 +3631,7 @@ bool cmMakefile::EnforceUniqueName(std::string const& name, std::string& msg,
case cmPolicies::NEW:
break;
}
-
+
// The conflict is with a non-imported target.
// Allow this if the user has requested support.
cmake* cm =
@@ -3774,7 +3780,7 @@ cmMakefile::GetPolicyStatusInternal(cmPolicies::PolicyID id)
return this->GetPolicies()->GetPolicyStatus(id);
}
-bool cmMakefile::SetPolicy(const char *id,
+bool cmMakefile::SetPolicy(const char *id,
cmPolicies::PolicyStatus status)
{
cmPolicies::PolicyID pid;
@@ -3904,7 +3910,7 @@ bool cmMakefile::SetPolicyVersion(const char *version)
}
cmPolicies *cmMakefile::GetPolicies()
-{
+{
if (!this->GetCMakeInstance())
{
return 0;