summaryrefslogtreecommitdiffstats
path: root/Source/cmLoadCommandCommand.cxx
diff options
context:
space:
mode:
authorKen Martin <ken.martin@kitware.com>2002-10-08 19:55:04 (GMT)
committerKen Martin <ken.martin@kitware.com>2002-10-08 19:55:04 (GMT)
commitabf33378888971b2b18cacef8e77977c4d81a860 (patch)
tree940411084b92f85439ec6abdd12ca2a76cbc215a /Source/cmLoadCommandCommand.cxx
parent8cdb9a316febc56007c35df49ffc80316bbf1dd9 (diff)
downloadCMake-abf33378888971b2b18cacef8e77977c4d81a860.zip
CMake-abf33378888971b2b18cacef8e77977c4d81a860.tar.gz
CMake-abf33378888971b2b18cacef8e77977c4d81a860.tar.bz2
some mods to the plugin API
Diffstat (limited to 'Source/cmLoadCommandCommand.cxx')
-rw-r--r--Source/cmLoadCommandCommand.cxx31
1 files changed, 25 insertions, 6 deletions
diff --git a/Source/cmLoadCommandCommand.cxx b/Source/cmLoadCommandCommand.cxx
index c01fa46..d3bf67a 100644
--- a/Source/cmLoadCommandCommand.cxx
+++ b/Source/cmLoadCommandCommand.cxx
@@ -110,6 +110,12 @@ bool cmLoadedCommand::InitialPass(std::vector<std::string> const& args)
{
return true;
}
+
+ // clear the error string
+ if (this->info.Error)
+ {
+ free(this->info.Error);
+ }
// create argc and argv and then invoke the command
int argc = static_cast<int> (args.size());
@@ -125,10 +131,17 @@ bool cmLoadedCommand::InitialPass(std::vector<std::string> const& args)
}
int result = info.InitialPass((void *)&info,(void *)this->m_Makefile,argc,argv);
cmFreeArguments(argc,argv);
+
if (result)
{
return true;
}
+
+ /* Initial Pass must have failed so set the error string */
+ if (this->info.Error)
+ {
+ this->SetError(this->info.Error);
+ }
return false;
}
@@ -146,6 +159,10 @@ cmLoadedCommand::~cmLoadedCommand()
{
this->info.Destructor((void *)&this->info);
}
+ if (this->info.Error)
+ {
+ free(this->info.Error);
+ }
}
// cmLoadCommandCommand
@@ -187,16 +204,18 @@ bool cmLoadCommandCommand::InitialPass(std::vector<std::string> const& argsIn)
cmLibHandle lib = cmDynamicLoader::OpenLibrary(fullPath.c_str());
if(lib)
{
- // Look for the symbol cmLoad, cmGetFactoryCompilerUsed,
- // and cmGetFactoryVersion in the library
+ // find the init function
+ std::string initFuncName = args[0] + "Init";
CM_INIT_FUNCTION initFunction
= (CM_INIT_FUNCTION)
- cmDynamicLoader::GetSymbolAddress(lib, "cmInitializeCommand");
+ cmDynamicLoader::GetSymbolAddress(lib, initFuncName.c_str());
if ( !initFunction )
{
- initFunction =
- (CM_INIT_FUNCTION)(
- cmDynamicLoader::GetSymbolAddress(lib, "_cmInitializeCommand"));
+ initFuncName = "_";
+ initFuncName += args[0];
+ initFuncName += "Init";
+ initFunction = (CM_INIT_FUNCTION)(
+ cmDynamicLoader::GetSymbolAddress(lib, initFuncName.c_str()));
}
// if the symbol is found call it to set the name on the
// function blocker