Skip to content

Commit 9e9ae2b

Browse files
authored
early warn TCL support deprecate and Tcl 9.x warning (parflow#716)
## Summary Marks TCL support as deprecated and adds early version-gating for the Tcl 9.x incompatibility for generating PFIDB, replacing silent runtime failures with configure-time warnings. ## Changes - Issue a deprecation `WARNING` when TCL is found, directing users to Python-based pftools and tracking issue parflow#707 - Raise a `WARNING` when Tcl ≥ 9.0 is detected as generating PFIDB is unsupported on that version ## Motivation Tcl 9.x silently breaks at runtime and does not generate PFIDB, with no configure-time indication, leading to hard-to-diagnose failures. This change surfaces the incompatibility immediately at configure time and consistently nudges remaining TCL users toward the Python migration path ahead of eventual removal. ## Testing - [x] **Configured with Tcl 8.6:** deprecation warning issued, build proceeds normally - [x] **Configured with Tcl 9.0:** both warnings issued, build proceeds with known limitations noted ## Related issues - parflow#641 - parflow#707
1 parent 41a1357 commit 9e9ae2b

1 file changed

Lines changed: 34 additions & 7 deletions

File tree

CMakeLists.txt

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -281,14 +281,41 @@ if ( ${PARFLOW_AMPS_LAYER} IN_LIST PARFLOW_AMPS_LAYER_REQUIRE_MPI )
281281
endif ( ${PARFLOW_AMPS_LAYER} IN_LIST PARFLOW_AMPS_LAYER_REQUIRE_MPI )
282282

283283
find_package(TCL QUIET)
284-
if (${TCL_FOUND})
285-
set(PARFLOW_HAVE_TCL "yes")
286-
set(HAVE_TCL ${PARFLOW_HAVE_TCL})
287-
else (${TCL_FOUND})
288-
if (${PARFLOW_ENABLE_TOOLS})
284+
if(TCL_FOUND)
285+
# Warn: TCL support is deprecated and will be removed in a future release.
286+
# Tracking issue: https://github.com/parflow/parflow/issues/707<N>
287+
message(WARNING
288+
"TCL support in ParFlow is deprecated and will be removed in a future release. "
289+
"Users are encouraged to migrate to the Python-based pftools. "
290+
"See https://github.com/parflow/parflow/issues/707 for migration guidance."
291+
)
292+
set(PARFLOW_HAVE_TCL TRUE)
293+
set(HAVE_TCL "${PARFLOW_HAVE_TCL}")
294+
295+
# Determine TCL version
296+
# TCL_VERSION is the canonical macro in tcl.h across all supported versions.
297+
if(TCL_INCLUDE_PATH AND EXISTS "${TCL_INCLUDE_PATH}/tcl.h")
298+
file(STRINGS "${TCL_INCLUDE_PATH}/tcl.h" _tcl_version_line
299+
REGEX "^#[ \t]*define[ \t]+TCL_VERSION[ \t]+\"[^\"]+\"")
300+
if(_tcl_version_line)
301+
string(REGEX REPLACE ".*\"([^\"]+)\".*" "\\1" PARFLOW_TCL_VERSION "${_tcl_version_line}")
302+
unset(_tcl_version_line)
303+
endif(_tcl_version_line)
304+
endif(TCL_INCLUDE_PATH AND EXISTS "${TCL_INCLUDE_PATH}/tcl.h")
305+
# Tcl 9.x removed PFIDB support. Warn early rather than fail at runtime
306+
if(PARFLOW_TCL_VERSION VERSION_GREATER_EQUAL "9.0")
307+
message(WARNING
308+
"TCL ${PARFLOW_TCL_VERSION} detected (>= 9.0). "
309+
"ParFlow will compile, but creating or running PFIDB files is not supported with Tcl 9.x. "
310+
"Migrate to Python-based pftools or use Tcl 8.x."
311+
)
312+
endif()
313+
314+
else(TCL_FOUND)
315+
if(PARFLOW_ENABLE_TOOLS)
289316
message(FATAL_ERROR "TCL is required for building pftools")
290-
endif (${PARFLOW_ENABLE_TOOLS})
291-
endif (${TCL_FOUND})
317+
endif()
318+
endif(TCL_FOUND)
292319

293320
#-----------------------------------------------------------------------------
294321
# SILO

0 commit comments

Comments
 (0)