Merge topic 'fix_fortran_dir_two_dirs'

087bea3 Allow two cmake_add_fortran_subdirectory calls in the same project.
This commit is contained in:
David Cole 2012-02-21 15:54:29 -05:00 committed by CMake Topic Stage
commit 1b1eb9740b
1 changed files with 6 additions and 6 deletions

View File

@ -50,7 +50,7 @@ include(CheckLanguage)
include(ExternalProject) include(ExternalProject)
include(CMakeParseArguments) include(CMakeParseArguments)
function(_setup_mingw_config_and_build source_dir) function(_setup_mingw_config_and_build source_dir build_dir)
# Look for a MinGW gfortran. # Look for a MinGW gfortran.
find_program(MINGW_GFORTRAN find_program(MINGW_GFORTRAN
NAMES gfortran NAMES gfortran
@ -91,11 +91,11 @@ function(_setup_mingw_config_and_build source_dir)
string(REPLACE "\\" "\\\\" MINGW_PATH "${MINGW_PATH}") string(REPLACE "\\" "\\\\" MINGW_PATH "${MINGW_PATH}")
configure_file( configure_file(
${_MS_MINGW_SOURCE_DIR}/CMakeAddFortranSubdirectory/config_mingw.cmake.in ${_MS_MINGW_SOURCE_DIR}/CMakeAddFortranSubdirectory/config_mingw.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/config_mingw.cmake ${build_dir}/config_mingw.cmake
@ONLY) @ONLY)
configure_file( configure_file(
${_MS_MINGW_SOURCE_DIR}/CMakeAddFortranSubdirectory/build_mingw.cmake.in ${_MS_MINGW_SOURCE_DIR}/CMakeAddFortranSubdirectory/build_mingw.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/build_mingw.cmake ${build_dir}/build_mingw.cmake
@ONLY) @ONLY)
endfunction() endfunction()
@ -144,15 +144,15 @@ function(cmake_add_fortran_subdirectory subdir)
endif() endif()
endforeach() endforeach()
# create build and configure wrapper scripts # create build and configure wrapper scripts
_setup_mingw_config_and_build(${source_dir}) _setup_mingw_config_and_build("${source_dir}" "${build_dir}")
# create the external project # create the external project
externalproject_add(${project_name}_build externalproject_add(${project_name}_build
SOURCE_DIR ${source_dir} SOURCE_DIR ${source_dir}
BINARY_DIR ${build_dir} BINARY_DIR ${build_dir}
CONFIGURE_COMMAND ${CMAKE_COMMAND} CONFIGURE_COMMAND ${CMAKE_COMMAND}
-P ${CMAKE_CURRENT_BINARY_DIR}/config_mingw.cmake -P ${build_dir}/config_mingw.cmake
BUILD_COMMAND ${CMAKE_COMMAND} BUILD_COMMAND ${CMAKE_COMMAND}
-P ${CMAKE_CURRENT_BINARY_DIR}/build_mingw.cmake -P ${build_dir}/build_mingw.cmake
INSTALL_COMMAND "" INSTALL_COMMAND ""
) )
# make the external project always run make with each build # make the external project always run make with each build