ENH: working directory working for XCode

This commit is contained in:
Bill Hoffman 2006-02-08 14:12:34 -05:00
parent c6741363de
commit 55dd61946b
2 changed files with 15 additions and 6 deletions

View File

@ -365,7 +365,7 @@ IF(BUILD_TESTING)
--build-exe-dir "${CMake_BINARY_DIR}/Tests/CustomCommand/bin" --build-exe-dir "${CMake_BINARY_DIR}/Tests/CustomCommand/bin"
--test-command CustomCommand --test-command CustomCommand
) )
IF(FALSE)
ADD_TEST(CustomCommandWorkingDirectory ${CMAKE_CTEST_COMMAND} ADD_TEST(CustomCommandWorkingDirectory ${CMAKE_CTEST_COMMAND}
--build-and-test --build-and-test
"${CMake_SOURCE_DIR}/Tests/CustomCommandWorkingDirectory" "${CMake_SOURCE_DIR}/Tests/CustomCommandWorkingDirectory"
@ -377,7 +377,7 @@ IF(FALSE)
--build-exe-dir "${CMake_BINARY_DIR}/Tests/CustomCommandWorkingDirectory" --build-exe-dir "${CMake_BINARY_DIR}/Tests/CustomCommandWorkingDirectory"
--test-command working --test-command working
) )
ENDIF(FALSE)
ADD_TEST(FindPackageTest ${CMAKE_CTEST_COMMAND} ADD_TEST(FindPackageTest ${CMAKE_CTEST_COMMAND}
--build-and-test --build-and-test
"${CMake_SOURCE_DIR}/Tests/FindPackageTest" "${CMake_SOURCE_DIR}/Tests/FindPackageTest"

View File

@ -342,8 +342,9 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root,
} }
cmCustomCommandLines commandLines; cmCustomCommandLines commandLines;
commandLines.push_back(makecommand); 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_working_directory,
no_depends,
commandLines); commandLines);
// Add Re-Run CMake rules // Add Re-Run CMake rules
@ -966,9 +967,17 @@ cmGlobalXCodeGenerator::AddCommandsToBuildPhase(cmXCodeObject* buildphase,
{ {
// Build the command line in a single string. // Build the command line in a single string.
const cmCustomCommandLine& commandLine = *cl; const cmCustomCommandLine& commandLine = *cl;
std::string cmd = commandLine[0]; std::string cmd2 = commandLine[0];
cmSystemTools::ReplaceString(cmd, "/./", "/"); cmSystemTools::ReplaceString(cmd2, "/./", "/");
cmd = this->ConvertToRelativeForMake(cmd.c_str()); 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) for(unsigned int j=1; j < commandLine.size(); ++j)
{ {
cmd += " "; cmd += " ";