Skip to content

Commit 5296325

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 63c37e7 commit 5296325

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

CMakeLists.txt

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,7 @@ else()
4545
endif()
4646

4747
# Chemistry configuration
48-
# Pass 0/1 to Fypp so it interprets correctly as boolean (not string "False"/"True")
49-
set(_chem_str "0")
50-
if (MFC_CHEMISTRY)
51-
set(_chem_str "1")
52-
endif()
48+
# The chemistry flag is set locally in HANDLE_SOURCES macro to pass 0/1 to Fypp
5349

5450
# Optional: mechanism file name/path for Cantera
5551
set(MFC_MECH_FILE "" CACHE STRING "Cantera mechanism (YAML) file name or path")
@@ -372,6 +368,13 @@ macro(HANDLE_SOURCES target useCommon)
372368
cmake_path(GET fpp FILENAME fpp_filename)
373369
set(f90 "${CMAKE_BINARY_DIR}/fypp/${target}/${fpp_filename}.f90")
374370

371+
# Set chemistry flag for Fypp: use 0/1 (not False/True) so Fypp evaluates as boolean
372+
if (MFC_CHEMISTRY)
373+
set(_chem_flag "1")
374+
else()
375+
set(_chem_flag "0")
376+
endif()
377+
375378
add_custom_command(
376379
OUTPUT ${f90}
377380
COMMAND ${FYPP_EXE} -m re
@@ -383,7 +386,7 @@ macro(HANDLE_SOURCES target useCommon)
383386
-D MFC_${${target}_UPPER}
384387
-D MFC_COMPILER="${CMAKE_Fortran_COMPILER_ID}"
385388
-D MFC_CASE_OPTIMIZATION=False
386-
-D chemistry=${_chem_str}
389+
-D chemistry=${_chem_flag}
387390
--line-numbering
388391
--no-folding
389392
--line-length=999

0 commit comments

Comments
 (0)