summaryrefslogtreecommitdiffstats
path: root/Modules/CMakeAddFortranSubdirectory.cmake
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2012-02-16 03:42:31 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2012-02-16 03:42:31 (GMT)
commit087bea35c158f336a3193a97b06bdce3d8ce35f8 (patch)
treedd7eedfee314e4e3af8e59491d15c8b1bcc762c8 /Modules/CMakeAddFortranSubdirectory.cmake
parenta8b57149351168425f4040c8b99167238cca041d (diff)
downloadCMake-087bea35c158f336a3193a97b06bdce3d8ce35f8.zip
CMake-087bea35c158f336a3193a97b06bdce3d8ce35f8.tar.gz
CMake-087bea35c158f336a3193a97b06bdce3d8ce35f8.tar.bz2
Allow two cmake_add_fortran_subdirectory calls in the same project.
Configure the build_mingw.cmake.in config_mingw.cmake.in files into the binary directory of the directory being built, not the top level binary directory for the project.
Diffstat (limited to 'Modules/CMakeAddFortranSubdirectory.cmake')
-rw-r--r--Modules/CMakeAddFortranSubdirectory.cmake12
1 files changed, 6 insertions, 6 deletions
diff --git a/Modules/CMakeAddFortranSubdirectory.cmake b/Modules/CMakeAddFortranSubdirectory.cmake
index ddb79fb..abd9100 100644
--- a/Modules/CMakeAddFortranSubdirectory.cmake
+++ b/Modules/CMakeAddFortranSubdirectory.cmake
@@ -50,7 +50,7 @@ include(CheckLanguage)
include(ExternalProject)
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.
find_program(MINGW_GFORTRAN
NAMES gfortran
@@ -91,11 +91,11 @@ function(_setup_mingw_config_and_build source_dir)
string(REPLACE "\\" "\\\\" MINGW_PATH "${MINGW_PATH}")
configure_file(
${_MS_MINGW_SOURCE_DIR}/CMakeAddFortranSubdirectory/config_mingw.cmake.in
- ${CMAKE_CURRENT_BINARY_DIR}/config_mingw.cmake
+ ${build_dir}/config_mingw.cmake
@ONLY)
configure_file(
${_MS_MINGW_SOURCE_DIR}/CMakeAddFortranSubdirectory/build_mingw.cmake.in
- ${CMAKE_CURRENT_BINARY_DIR}/build_mingw.cmake
+ ${build_dir}/build_mingw.cmake
@ONLY)
endfunction()
@@ -144,15 +144,15 @@ function(cmake_add_fortran_subdirectory subdir)
endif()
endforeach()
# 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
externalproject_add(${project_name}_build
SOURCE_DIR ${source_dir}
BINARY_DIR ${build_dir}
CONFIGURE_COMMAND ${CMAKE_COMMAND}
- -P ${CMAKE_CURRENT_BINARY_DIR}/config_mingw.cmake
+ -P ${build_dir}/config_mingw.cmake
BUILD_COMMAND ${CMAKE_COMMAND}
- -P ${CMAKE_CURRENT_BINARY_DIR}/build_mingw.cmake
+ -P ${build_dir}/build_mingw.cmake
INSTALL_COMMAND ""
)
# make the external project always run make with each build