From 55dd61946b6957e27c65690a0fe20ad4480a4cd5 Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Wed, 8 Feb 2006 14:12:34 -0500 Subject: ENH: working directory working for XCode --- Source/CMakeLists.txt | 4 ++-- Source/cmGlobalXCodeGenerator.cxx | 17 +++++++++++++---- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 2c24282..c5d05f1 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -365,7 +365,7 @@ IF(BUILD_TESTING) --build-exe-dir "${CMake_BINARY_DIR}/Tests/CustomCommand/bin" --test-command CustomCommand ) -IF(FALSE) + ADD_TEST(CustomCommandWorkingDirectory ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/CustomCommandWorkingDirectory" @@ -377,7 +377,7 @@ IF(FALSE) --build-exe-dir "${CMake_BINARY_DIR}/Tests/CustomCommandWorkingDirectory" --test-command working ) -ENDIF(FALSE) + ADD_TEST(FindPackageTest ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/FindPackageTest" diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 7e2a828..7ab9720 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -342,8 +342,9 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root, } cmCustomCommandLines commandLines; commandLines.push_back(makecommand); - mf->AddUtilityCommand("XCODE_DEPEND_HELPER", false, no_output, no_depends, + mf->AddUtilityCommand("XCODE_DEPEND_HELPER", false, no_output, no_working_directory, + no_depends, commandLines); // Add Re-Run CMake rules @@ -966,9 +967,17 @@ cmGlobalXCodeGenerator::AddCommandsToBuildPhase(cmXCodeObject* buildphase, { // Build the command line in a single string. const cmCustomCommandLine& commandLine = *cl; - std::string cmd = commandLine[0]; - cmSystemTools::ReplaceString(cmd, "/./", "/"); - cmd = this->ConvertToRelativeForMake(cmd.c_str()); + std::string cmd2 = commandLine[0]; + cmSystemTools::ReplaceString(cmd2, "/./", "/"); + cmd2 = this->ConvertToRelativeForMake(cmd2.c_str()); + std::string cmd; + if(cc.GetWorkingDirectory()) + { + cmd += "cd "; + cmd += this->ConvertToRelativeForMake(cc.GetWorkingDirectory()); + cmd += " && "; + } + cmd += cmd2; for(unsigned int j=1; j < commandLine.size(); ++j) { cmd += " "; -- cgit v0.12