diff options
author | Ken Martin <ken.martin@kitware.com> | 2002-10-15 15:45:04 (GMT) |
---|---|---|
committer | Ken Martin <ken.martin@kitware.com> | 2002-10-15 15:45:04 (GMT) |
commit | e4e920ef6cb2064f929f85626cd4d351e30803d1 (patch) | |
tree | 1459a92c2de2e8beabeef423b8016bef43a81bc6 /Source/cmLoadCommandCommand.cxx | |
parent | f70a759446c4be2e9dc6c797cac84acadc9ed6ac (diff) | |
download | CMake-e4e920ef6cb2064f929f85626cd4d351e30803d1.zip CMake-e4e920ef6cb2064f929f85626cd4d351e30803d1.tar.gz CMake-e4e920ef6cb2064f929f85626cd4d351e30803d1.tar.bz2 |
better warning message
Diffstat (limited to 'Source/cmLoadCommandCommand.cxx')
-rw-r--r-- | Source/cmLoadCommandCommand.cxx | 59 |
1 files changed, 32 insertions, 27 deletions
diff --git a/Source/cmLoadCommandCommand.cxx b/Source/cmLoadCommandCommand.cxx index d3bf67a..70107cf 100644 --- a/Source/cmLoadCommandCommand.cxx +++ b/Source/cmLoadCommandCommand.cxx @@ -202,34 +202,39 @@ bool cmLoadCommandCommand::InitialPass(std::vector<std::string> const& argsIn) // try loading the shared library / dll cmLibHandle lib = cmDynamicLoader::OpenLibrary(fullPath.c_str()); - if(lib) - { - // find the init function - std::string initFuncName = args[0] + "Init"; - CM_INIT_FUNCTION initFunction - = (CM_INIT_FUNCTION) - cmDynamicLoader::GetSymbolAddress(lib, initFuncName.c_str()); - if ( !initFunction ) - { - 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 - if(initFunction) - { - // create a function blocker and set it up - cmLoadedCommand *f = new cmLoadedCommand(); - (*initFunction)(&f->info); - m_Makefile->AddCommand(f); - return true; - } - this->SetError("Attempt to load command failed. " - "No init function found."); + if(!lib) + { + std::string err = "Attempt to load the library "; + err += fullPath + " failed"; + this->SetError(err.c_str()); + return false; + } + + // find the init function + std::string initFuncName = args[0] + "Init"; + CM_INIT_FUNCTION initFunction + = (CM_INIT_FUNCTION) + cmDynamicLoader::GetSymbolAddress(lib, initFuncName.c_str()); + if ( !initFunction ) + { + 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 + if(initFunction) + { + // create a function blocker and set it up + cmLoadedCommand *f = new cmLoadedCommand(); + (*initFunction)(&f->info); + m_Makefile->AddCommand(f); + return true; } + this->SetError("Attempt to load command failed. " + "No init function found."); return false; } |