diff options
author | Michael Hirsch <scivision@users.noreply.gitlab.kitware.com> | 2020-10-15 12:46:03 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2020-10-15 13:33:59 (GMT) |
commit | 1e519df0259677df67b5e7d21e1f189d655ddbd3 (patch) | |
tree | 3633cbfd48f5db5c1c3d0191cc3fff240e46e0ae /Modules | |
parent | b1d9a25f35a22f41b2c1b87725f091936711a28c (diff) | |
download | CMake-1e519df0259677df67b5e7d21e1f189d655ddbd3.zip CMake-1e519df0259677df67b5e7d21e1f189d655ddbd3.tar.gz CMake-1e519df0259677df67b5e7d21e1f189d655ddbd3.tar.bz2 |
CheckSource{Runs,Compiles}: Fix default Fortran source extension
In commit 357e2ef429 (CheckSoureRuns: Add a unified way to check if a
source runs, 2020-09-14, v3.19.0-rc1~118^2), the default Fortran source
file extension was accidentally changed from `.F90` to `.F`. Fix that.
In commit 10ae907de0 (CheckSoureCompiles: Add a unified way to check if
a source compiles, 2020-09-14, v3.19.0-rc1~118^2~1), the default Fortran
source extension was correctly preserved as `.F`, but `.F90` is a better
default both for consistency and modern usage. Use that for direct
calls to the `check_source_compiles` macro. Update our original
`check_fortran_source_compiles` implementation to use `.F` by default
as it did before.
Fixes: #21307
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/CheckFortranSourceCompiles.cmake | 4 | ||||
-rw-r--r-- | Modules/CheckFortranSourceRuns.cmake | 4 | ||||
-rw-r--r-- | Modules/CheckSourceCompiles.cmake | 9 | ||||
-rw-r--r-- | Modules/CheckSourceRuns.cmake | 11 |
4 files changed, 19 insertions, 9 deletions
diff --git a/Modules/CheckFortranSourceCompiles.cmake b/Modules/CheckFortranSourceCompiles.cmake index 2bcc343..169b829 100644 --- a/Modules/CheckFortranSourceCompiles.cmake +++ b/Modules/CheckFortranSourceCompiles.cmake @@ -90,5 +90,7 @@ include_guard(GLOBAL) include(CheckSourceCompiles) macro(CHECK_Fortran_SOURCE_COMPILES SOURCE VAR) - check_source_compiles(Fortran "${SOURCE}" ${VAR} ${ARGN}) + # Pass the SRC_EXT we used by default historically. + # A user-provided SRC_EXT argument in ARGN will override ours. + check_source_compiles(Fortran "${SOURCE}" ${VAR} SRC_EXT "F" ${ARGN}) endmacro() diff --git a/Modules/CheckFortranSourceRuns.cmake b/Modules/CheckFortranSourceRuns.cmake index 29f4a98..5276709 100644 --- a/Modules/CheckFortranSourceRuns.cmake +++ b/Modules/CheckFortranSourceRuns.cmake @@ -86,5 +86,7 @@ include_guard(GLOBAL) include(CheckSourceRuns) macro(CHECK_Fortran_SOURCE_RUNS SOURCE VAR) - check_source_runs(Fortran "${SOURCE}" ${VAR} ${ARGN}) + # Pass the SRC_EXT we used by default historically. + # A user-provided SRC_EXT argument in ARGN will override ours. + check_source_runs(Fortran "${SOURCE}" ${VAR} SRC_EXT "F90" ${ARGN}) endmacro() diff --git a/Modules/CheckSourceCompiles.cmake b/Modules/CheckSourceCompiles.cmake index 08fc153..4ed9a5c 100644 --- a/Modules/CheckSourceCompiles.cmake +++ b/Modules/CheckSourceCompiles.cmake @@ -94,7 +94,7 @@ function(CHECK_SOURCE_COMPILES _lang _source _var) set(_lang_ext "cu") elseif(_lang STREQUAL Fortran) set(_lang_textual "Fortran") - set(_lang_ext "F") + set(_lang_ext "F90") elseif(_lang STREQUAL ISPC) set(_lang_textual "ISPC") set(_lang_ext "ispc") @@ -121,8 +121,11 @@ function(CHECK_SOURCE_COMPILES _lang _source _var) foreach(arg ${ARGN}) if("${arg}" MATCHES "^(FAIL_REGEX|SRC_EXT)$") set(_key "${arg}") - elseif(_key) - list(APPEND _${_key} "${arg}") + elseif(_key STREQUAL "FAIL_REGEX") + list(APPEND _FAIL_REGEX "${arg}") + elseif(_key STREQUAL "SRC_EXT") + set(_SRC_EXT "${arg}") + set(_key "") else() message(FATAL_ERROR "Unknown argument:\n ${arg}\n") endif() diff --git a/Modules/CheckSourceRuns.cmake b/Modules/CheckSourceRuns.cmake index 20f3e1e..033793d 100644 --- a/Modules/CheckSourceRuns.cmake +++ b/Modules/CheckSourceRuns.cmake @@ -92,7 +92,7 @@ function(CHECK_SOURCE_RUNS _lang _source _var) set(_lang_ext "cu") elseif(_lang STREQUAL Fortran) set(_lang_textual "Fortran") - set(_lang_ext "F") + set(_lang_ext "F90") elseif(_lang STREQUAL OBJC) set(_lang_textual "Objective-C") set(_lang_ext "m") @@ -114,10 +114,13 @@ function(CHECK_SOURCE_RUNS _lang _source _var) set(_SRC_EXT) set(_key) foreach(arg ${ARGN}) - if("${arg}" MATCHES "^(SRC_EXT)$") + if("${arg}" MATCHES "^(FAIL_REGEX|SRC_EXT)$") set(_key "${arg}") - elseif(_key) - list(APPEND _${_key} "${arg}") + elseif(_key STREQUAL "FAIL_REGEX") + list(APPEND _FAIL_REGEX "${arg}") + elseif(_key STREQUAL "SRC_EXT") + set(_SRC_EXT "${arg}") + set(_key "") else() message(FATAL_ERROR "Unknown argument:\n ${arg}\n") endif() |