mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-08 23:29:55 -05:00
CheckSource{Runs,Compiles}: Fix default Fortran source extension
In commit357e2ef429(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 commit10ae907de0(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
This commit is contained in:
committed by
Brad King
parent
b1d9a25f35
commit
1e519df025
@@ -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()
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user