From fd3688fa7260e06c9bd8e23bb6f08e430bff4301 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 8 Mar 2007 13:05:02 -0500 Subject: ENH: Fixed recursive make call target escaping for Borland to support SubDirSpaces test. --- Source/CMakeLists.txt | 4 ++-- Source/cmGlobalBorlandMakefileGenerator.cxx | 1 + Source/cmLocalUnixMakefileGenerator3.cxx | 7 +++++++ Source/cmLocalUnixMakefileGenerator3.h | 8 ++++++++ 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index faf8112..c96e360 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -1012,7 +1012,7 @@ IF(BUILD_TESTING) # some old versions of make simply cannot handle spaces in paths IF (MAKE_IS_GNU OR "${CMAKE_TEST_MAKEPROGRAM}" MATCHES "nmake|gmake|wmake" OR - "${CMAKE_TEST_GENERATOR}" MATCHES "Visual Studio|XCode") + "${CMAKE_TEST_GENERATOR}" MATCHES "Visual Studio|XCode|Borland") ADD_TEST(SubDirSpaces ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/SubDirSpaces" @@ -1028,7 +1028,7 @@ IF(BUILD_TESTING) ) ENDIF (MAKE_IS_GNU OR "${CMAKE_TEST_MAKEPROGRAM}" MATCHES "nmake|gmake|wmake" OR - "${CMAKE_TEST_GENERATOR}" MATCHES "Visual Studio|XCode") + "${CMAKE_TEST_GENERATOR}" MATCHES "Visual Studio|XCode|Borland") IF (WIN32) ADD_TEST(SubDir ${CMAKE_CTEST_COMMAND} diff --git a/Source/cmGlobalBorlandMakefileGenerator.cxx b/Source/cmGlobalBorlandMakefileGenerator.cxx index bba00ae..1f44c73 100644 --- a/Source/cmGlobalBorlandMakefileGenerator.cxx +++ b/Source/cmGlobalBorlandMakefileGenerator.cxx @@ -50,6 +50,7 @@ cmLocalGenerator *cmGlobalBorlandMakefileGenerator::CreateLocalGenerator() lg->SetPassMakeflags(true); lg->SetGlobalGenerator(this); lg->SetUnixCD(false); + lg->SetMakeCommandEscapeTargetTwice(true); return lg; } diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index a9c9c68..2d45ee9 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -53,6 +53,7 @@ cmLocalUnixMakefileGenerator3::cmLocalUnixMakefileGenerator3() this->SkipAssemblySourceRules = false; this->NativeEchoCommand = "@echo "; this->NativeEchoWindows = true; + this->MakeCommandEscapeTargetTwice = false; } //---------------------------------------------------------------------------- @@ -1751,6 +1752,12 @@ cmLocalUnixMakefileGenerator3 // The target may have been written with windows paths. cmSystemTools::ConvertToOutputSlashes(tgt2); + // Escape one extra time if the make tool requires it. + if(this->MakeCommandEscapeTargetTwice) + { + tgt2 = this->EscapeForShell(tgt2.c_str(), true, false); + } + // The target name is now a string that should be passed verbatim // on the command line. cmd += this->EscapeForShell(tgt2.c_str(), true, false); diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index bf90605..0d0a37f 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -158,6 +158,13 @@ public: */ void SetIgnoreLibPrefix(bool s) { this->IgnoreLibPrefix = s; } + /** + * Set whether passing a make target on a command line requires an + * extra level of escapes. + */ + void SetMakeCommandEscapeTargetTwice(bool b) + { this->MakeCommandEscapeTargetTwice = b; } + // used in writing out Cmake files such as WriteDirectoryInformation static void WriteCMakeArgument(std::ostream& os, const char* s); @@ -334,6 +341,7 @@ private: bool UnixCD; bool PassMakeflags; bool SilentNoColon; + bool MakeCommandEscapeTargetTwice; //========================================================================== std::string HomeRelativeOutputPath; -- cgit v0.12