diff --git a/Source/cmLinkLibrariesCommand.cxx b/Source/cmLinkLibrariesCommand.cxx index d45f24667ed93298cb7cfd4aaa631216ea3ff1bb..56d4937167e414c040a84dbf59341b55de65b3bc 100644 --- a/Source/cmLinkLibrariesCommand.cxx +++ b/Source/cmLinkLibrariesCommand.cxx @@ -50,7 +50,7 @@ bool cmLinkLibrariesCommand::InitialPass(std::vector<std::string> const& args) { std::string libPath = *i + "_CMAKE_PATH"; const char* dir = m_Makefile->GetDefinition(libPath.c_str()); - if( dir ) + if( dir && *dir ) { m_Makefile->AddLinkDirectory( dir ); } diff --git a/Source/cmLocalUnixMakefileGenerator.cxx b/Source/cmLocalUnixMakefileGenerator.cxx index d656860cb22c052d1f56ac913d150b977430b1af..b9de31779ed7136616f2f7a146187d3a3d4540ef 100644 --- a/Source/cmLocalUnixMakefileGenerator.cxx +++ b/Source/cmLocalUnixMakefileGenerator.cxx @@ -1575,9 +1575,10 @@ void cmLocalUnixMakefileGenerator::OutputDependLibs(std::ostream& fout) // if cache and not the current directory add a rule, to // jump into the directory and build for the first time - if(cacheValue && + if(cacheValue && *cacheValue && (!this->SamePath(m_Makefile->GetCurrentOutputDirectory(), cacheValue))) { + std::cout << "Cache Value: " << cacheValue << std::endl; // add the correct extension std::string ltname = *lib+"_LIBRARY_TYPE"; const char* libType @@ -1726,7 +1727,7 @@ void cmLocalUnixMakefileGenerator::OutputLibDepend(std::ostream& fout, std::string libPath = name; libPath += "_CMAKE_PATH"; const char* cacheValue = m_Makefile->GetDefinition(libPath.c_str()); - if(cacheValue ) + if( cacheValue && *cacheValue ) { // if there is a cache value, then this is a library that cmake // knows how to build, so we can depend on it @@ -1783,7 +1784,7 @@ void cmLocalUnixMakefileGenerator::OutputExeDepend(std::ostream& fout, std::string exePath = name; exePath += "_CMAKE_PATH"; const char* cacheValue = m_Makefile->GetDefinition(exePath.c_str()); - if(cacheValue ) + if( cacheValue && *cacheValue ) { // if there is a cache value, then this is a executable/utility that cmake // knows how to build, so we can depend on it @@ -2168,7 +2169,7 @@ void cmLocalUnixMakefileGenerator::OutputCustomRules(std::ostream& fout) // watch for target dependencies, std::string libPath = dep + "_CMAKE_PATH"; const char* cacheValue = m_Makefile->GetDefinition(libPath.c_str()); - if (cacheValue) + if ( cacheValue && *cacheValue ) { libPath = cacheValue; if (m_Makefile->GetDefinition("EXECUTABLE_OUTPUT_PATH") && diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index af47b2ef88a1177b6c8db9bca688c93e0c274aed..6481d472e27049d6dfb39125ebea477315d1df18 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -165,7 +165,7 @@ void cmTarget::TraceVSDependencies(std::string projFile, // watch for target dependencies, std::string libPath = dep + "_CMAKE_PATH"; const char* cacheValue = makefile->GetDefinition(libPath.c_str()); - if (cacheValue) + if (cacheValue && *cacheValue) { // add the depend as a utility on the target this->AddUtility(dep.c_str()); diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx index 6b3e50ff1f316c46d4afe87477bad81e57208236..1237fac7e92b996d2abe64ea329af8e25e8f3d74 100644 --- a/Source/cmTargetLinkLibrariesCommand.cxx +++ b/Source/cmTargetLinkLibrariesCommand.cxx @@ -64,7 +64,7 @@ bool cmTargetLinkLibrariesCommand::InitialPass(std::vector<std::string> const& a std::string libPath = *i + "_CMAKE_PATH"; const char* dir = m_Makefile->GetDefinition(libPath.c_str()); - if( dir ) + if( dir && *dir ) { m_Makefile->AddLinkDirectoryForTarget(args[0].c_str(), dir ); } @@ -91,7 +91,7 @@ void cmTargetLinkLibrariesCommand::FinalPass() { libPath = m_HasLocation[cc] + "_CMAKE_PATH"; const char* dir = m_Makefile->GetDefinition(libPath.c_str()); - if ( dir ) + if ( dir && *dir ) { std::string str = "Library " + m_HasLocation[cc] + " is defined using ADD_LIBRARY after the library is used "