summaryrefslogtreecommitdiffstats
path: root/Source/cmLoadCommandCommand.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2005-02-22 19:52:55 (GMT)
committerBrad King <brad.king@kitware.com>2005-02-22 19:52:55 (GMT)
commitec497c7a233d4196e227110604267b922da292b4 (patch)
treefaa13a90abfb3b63270aac58a7f2a1c3c2d02d85 /Source/cmLoadCommandCommand.cxx
parentb9b4ea0f7bbf0313d8aa5e354ee56f912969763c (diff)
downloadCMake-ec497c7a233d4196e227110604267b922da292b4.zip
CMake-ec497c7a233d4196e227110604267b922da292b4.tar.gz
CMake-ec497c7a233d4196e227110604267b922da292b4.tar.bz2
ENH: LOAD_COMMAND command will now set a variable called CMAKE_LOADED_COMMAND_<COMMAND_NAME> to the full path of the loaded module if loading was successful. Otherwise the variable is not set (will evaluate to empty string). This is useful both in testing whether loading worked and for installing loaded command modules.
Diffstat (limited to 'Source/cmLoadCommandCommand.cxx')
-rw-r--r--Source/cmLoadCommandCommand.cxx13
1 files changed, 11 insertions, 2 deletions
diff --git a/Source/cmLoadCommandCommand.cxx b/Source/cmLoadCommandCommand.cxx
index 60edd56..fcdc045 100644
--- a/Source/cmLoadCommandCommand.cxx
+++ b/Source/cmLoadCommandCommand.cxx
@@ -226,7 +226,13 @@ bool cmLoadCommandCommand::InitialPass(std::vector<std::string> const& args)
{
return true;
}
-
+
+ // Construct a variable to report what file was loaded, if any.
+ // Start by removing the definition in case of failure.
+ std::string reportVar = "CMAKE_LOADED_COMMAND_";
+ reportVar += args[0];
+ m_Makefile->RemoveDefinition(reportVar.c_str());
+
// the file must exist
std::string fullPath = cmDynamicLoader::LibPrefix();
fullPath += "cm" + args[0] + cmDynamicLoader::LibExtension();
@@ -269,7 +275,10 @@ bool cmLoadCommandCommand::InitialPass(std::vector<std::string> const& args)
this->SetError(err.c_str());
return false;
}
-
+
+ // Report what file was loaded for this command.
+ m_Makefile->AddDefinition(reportVar.c_str(), fullPath.c_str());
+
// find the init function
std::string initFuncName = args[0] + "Init";
CM_INIT_FUNCTION initFunction