Fix escapes in Fortran depend.make entries

Makefile dependencies must be escaped using cmLocalGenerator::Convert
with the cmLocalGenerator::MAKEFILE option.  This fixes Fortran module
dependencies with spaces in the path.  We test the fix by adding a space
to one of the module paths in the Fortran test.
This commit is contained in:
Brad King 2010-01-04 10:18:44 -05:00
parent 40641e3cba
commit cbfbb86b58
3 changed files with 18 additions and 9 deletions

View File

@ -442,9 +442,11 @@ cmDependsFortran
for(std::set<cmStdString>::const_iterator i = info.Includes.begin(); for(std::set<cmStdString>::const_iterator i = info.Includes.begin();
i != info.Includes.end(); ++i) i != info.Includes.end(); ++i)
{ {
makeDepends << obj << ": " makeDepends << obj << ": " <<
<< cmSystemTools::ConvertToOutputPath(i->c_str()).c_str() this->LocalGenerator->Convert(i->c_str(),
<< std::endl; cmLocalGenerator::HOME_OUTPUT,
cmLocalGenerator::MAKEFILE)
<< std::endl;
internalDepends << " " << i->c_str() << std::endl; internalDepends << " " << i->c_str() << std::endl;
} }
makeDepends << std::endl; makeDepends << std::endl;
@ -491,7 +493,7 @@ cmDependsFortran
std::string stampFile = std::string stampFile =
this->LocalGenerator->Convert(required->second.c_str(), this->LocalGenerator->Convert(required->second.c_str(),
cmLocalGenerator::HOME_OUTPUT, cmLocalGenerator::HOME_OUTPUT,
cmLocalGenerator::SHELL); cmLocalGenerator::MAKEFILE);
makeDepends << obj << ": " << stampFile << "\n"; makeDepends << obj << ": " << stampFile << "\n";
} }
else else
@ -504,7 +506,7 @@ cmDependsFortran
module = module =
this->LocalGenerator->Convert(module.c_str(), this->LocalGenerator->Convert(module.c_str(),
cmLocalGenerator::HOME_OUTPUT, cmLocalGenerator::HOME_OUTPUT,
cmLocalGenerator::SHELL); cmLocalGenerator::MAKEFILE);
makeDepends << obj << ": " << module << "\n"; makeDepends << obj << ": " << module << "\n";
} }
} }

View File

@ -171,13 +171,20 @@ if(TEST_MODULE_DEPENDS)
set(External_CONFIG_TYPE) set(External_CONFIG_TYPE)
set(External_BUILD_TYPE -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}) set(External_BUILD_TYPE -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE})
endif(CMAKE_CONFIGURATION_TYPES) endif(CMAKE_CONFIGURATION_TYPES)
set(External_SOURCE_DIR "${testf_SOURCE_DIR}/External")
set(External_BINARY_DIR "${testf_BINARY_DIR}/External")
if("${testf_BINARY_DIR}" MATCHES " ")
# Our build tree has a space, so the build tool supports spaces.
# Test using modules from a path with spaces.
set(External_BINARY_DIR "${External_BINARY_DIR} Build")
endif()
add_custom_command( add_custom_command(
OUTPUT ${testf_BINARY_DIR}/ExternalProject OUTPUT ${testf_BINARY_DIR}/ExternalProject
COMMAND ${CMAKE_CTEST_COMMAND} COMMAND ${CMAKE_CTEST_COMMAND}
ARGS ${External_CONFIG_TYPE} ARGS ${External_CONFIG_TYPE}
--build-and-test --build-and-test
${testf_SOURCE_DIR}/External ${External_SOURCE_DIR}
${testf_BINARY_DIR}/External ${External_BINARY_DIR}
--build-noclean --build-noclean
--build-two-config --build-two-config
--build-project ExtFort --build-project ExtFort

View File

@ -1,6 +1,6 @@
include_directories(${Library_MODDIR}) include_directories(${Library_MODDIR})
include_directories(${testf_BINARY_DIR}/External) include_directories(${External_BINARY_DIR})
link_directories(${testf_BINARY_DIR}/External) link_directories(${External_BINARY_DIR})
add_executable(subdir_exe2 main.f90) add_executable(subdir_exe2 main.f90)
target_link_libraries(subdir_exe2 subdir_mods) target_link_libraries(subdir_exe2 subdir_mods)