Skip to content

Commit abc3508

Browse files
committed
Fix Fypp chemistry flag evaluation by setting it locally
Move chemistry flag evaluation inside the HANDLE_SOURCES loop to ensure it's correctly set to 0/1 (not False/True strings) for Fypp preprocessing. This fixes the issue where Fypp was receiving chemistry=False instead of chemistry=0, causing it to incorrectly evaluate the flag as truthy.
1 parent b017821 commit abc3508

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

CMakeLists.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,13 @@ macro(HANDLE_SOURCES target useCommon)
366366
cmake_path(GET fpp FILENAME fpp_filename)
367367
set(f90 "${CMAKE_BINARY_DIR}/fypp/${target}/${fpp_filename}.f90")
368368

369+
# Set chemistry flag for Fypp: use 0/1 (not False/True) so Fypp evaluates as boolean
370+
if (MFC_CHEMISTRY)
371+
set(_chem_flag "1")
372+
else()
373+
set(_chem_flag "0")
374+
endif()
375+
369376
add_custom_command(
370377
OUTPUT ${f90}
371378
COMMAND ${FYPP_EXE} -m re
@@ -377,7 +384,7 @@ macro(HANDLE_SOURCES target useCommon)
377384
-D MFC_${${target}_UPPER}
378385
-D MFC_COMPILER="${CMAKE_Fortran_COMPILER_ID}"
379386
-D MFC_CASE_OPTIMIZATION=False
380-
-D chemistry=${_chem_str}
387+
-D chemistry=${_chem_flag}
381388
--line-numbering
382389
--no-folding
383390
--line-length=999

0 commit comments

Comments
 (0)