From 83d273334a9a5643ecc59d37601295bd62ed1fb8 Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Tue, 12 Nov 2002 16:58:38 -0500 Subject: BUG: fix path problems --- Modules/CMakeDetermineCCompiler.cmake | 2 +- Modules/CMakeDetermineCXXCompiler.cmake | 2 +- Source/cmLocalUnixMakefileGenerator.cxx | 15 ++++++++++++--- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/Modules/CMakeDetermineCCompiler.cmake b/Modules/CMakeDetermineCCompiler.cmake index aac39a8..f4a037c 100644 --- a/Modules/CMakeDetermineCCompiler.cmake +++ b/Modules/CMakeDetermineCCompiler.cmake @@ -7,7 +7,7 @@ IF(NOT CMAKE_C_COMPILER) FIND_PROGRAM(CMAKE_C_COMPILER_FULLPATH NAMES $ENV{CC} ${CMAKE_GENERATOR_CC} gcc cc cl bcc ) - GET_FILENAME_COMPONENT(CMAKE_C_COMPILER ${CMAKE_C_COMPILER_FULLPATH} NAME_WE) + GET_FILENAME_COMPONENT(CMAKE_C_COMPILER ${CMAKE_C_COMPILER_FULLPATH} NAME) # set this to notfound right after so that it is searched for each time this # file is included SET(CMAKE_C_COMPILER_FULLPATH NOTFOUND CACHE INTERNAL "full path to c compiler" FORCE) diff --git a/Modules/CMakeDetermineCXXCompiler.cmake b/Modules/CMakeDetermineCXXCompiler.cmake index 823877f..494f016 100644 --- a/Modules/CMakeDetermineCXXCompiler.cmake +++ b/Modules/CMakeDetermineCXXCompiler.cmake @@ -7,7 +7,7 @@ IF(NOT CMAKE_CXX_COMPILER) FIND_PROGRAM(CMAKE_CXX_COMPILER_FULLPATH NAMES $ENV{CXX} ${CMAKE_GENERATOR_CXX} c++ g++ CC aCC cl bcc ) - GET_FILENAME_COMPONENT(CMAKE_CXX_COMPILER ${CMAKE_CXX_COMPILER_FULLPATH} NAME_WE) + GET_FILENAME_COMPONENT(CMAKE_CXX_COMPILER ${CMAKE_CXX_COMPILER_FULLPATH} NAME) SET(CMAKE_CXX_COMPILER ${CMAKE_CXX_COMPILER} CACHE STRING "C++ compiler") ENDIF(NOT CMAKE_CXX_COMPILER) MARK_AS_ADVANCED(CMAKE_CXX_COMPILER) diff --git a/Source/cmLocalUnixMakefileGenerator.cxx b/Source/cmLocalUnixMakefileGenerator.cxx index ea6b6c5..55dea6a 100644 --- a/Source/cmLocalUnixMakefileGenerator.cxx +++ b/Source/cmLocalUnixMakefileGenerator.cxx @@ -668,12 +668,10 @@ struct RuleVariables static RuleVariables ruleReplaceVars[] = { - {"", "CMAKE_CXX_COMPILER"}, {"", "CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS"}, {"", "CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS"}, {"", "CMAKE_CXX_LINK_FLAGS"}, - {"", "CMAKE_C_COMPILER"}, {"", "CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS"}, {"", "CMAKE_SHARED_MODULE_CREATE_C_FLAGS"}, {"", "CMAKE_C_LINK_FLAGS"}, @@ -698,6 +696,12 @@ cmLocalUnixMakefileGenerator::ExpandRuleVariables(std::string& s, const char* targetBase, const char* linkFlags) { + std::string cxxcompiler = this->ConvertToOutputForExisting( + this->GetSafeDefinition("CMAKE_CXX_COMPILER")); + std::string ccompiler = this->ConvertToOutputForExisting( + this->GetSafeDefinition("CMAKE_C_COMPILER")); + cmSystemTools::ReplaceString(s, "", cxxcompiler.c_str()); + cmSystemTools::ReplaceString(s, "", ccompiler.c_str()); if(linkFlags) { cmSystemTools::ReplaceString(s, "", linkFlags); @@ -1767,7 +1771,12 @@ std::string cmLocalUnixMakefileGenerator::ConvertToOutputForExisting(const char* p) { std::string ret = cmSystemTools::ConvertToOutputPath(p); - cmSystemTools::GetShortPath(ret.c_str(), ret); + // if there are spaces in the path, then get the short path version + // if there is one + if(ret.find(' ') != std::string::npos) + { + cmSystemTools::GetShortPath(ret.c_str(), ret); + } return ret; } -- cgit v0.12