Skip to content

Commit 0b5fa23

Browse files
committed
Update f90/CMakeLists.txt to only use Fortran flags for Fortran files
Before, several flags were being specified for the ModEM target that were not properly being wrapped in a CMake generator expression. Currently this is not a problem at all, but it would prevent any C files to be included, as CMake will try to use these flags when compiling a C file. This will prevent that issue occurring if a C file is added in the future.
1 parent d71af18 commit 0b5fa23

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

f90/CMakeLists.txt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,10 @@ if (CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")
2020
target_compile_options(
2121
${MODEM_EXE}
2222
PRIVATE
23-
-cpp -ffree-line-length-none -fallow-argument-mismatch
23+
$<$<COMPILE_LANGUAGE:Fortran>:-cpp>
24+
$<$<COMPILE_LANGUAGE:Fortran>:-ffree-line-length-none>
25+
$<$<COMPILE_LANGUAGE:Fortran>:-fallow-argument-mismatch>
2426
$<$<CONFIG:RELEASE>:-O3>
25-
2627
$<$<CONFIG:DEBUG>:-O0>
2728
$<$<CONFIG:DEBUG>:-g>
2829
$<$<CONFIG:DEBUG>:-fbacktrace>
@@ -38,8 +39,8 @@ elseif (CMAKE_Fortran_COMPILER_ID STREQUAL "Intel")
3839
target_compile_options(
3940
${MODEM_EXE}
4041
PRIVATE
41-
-fpp
42-
-parallel
42+
$<$<COMPILE_LANGUAGE:Fortran>-fpp>
43+
$<$<COMPILE_LANGUAGE:Fortran>-parallel>
4344
$<$<CONFIG:RELEASE>:-O3>
4445
$<$<CONFIG:RELEASE>:-w>
4546
$<$<CONFIG:DEBUG>:-O0>

0 commit comments

Comments
 (0)