From 6eafb5ac34ddfa9efe00bc1214a5d3640224ee5f Mon Sep 17 00:00:00 2001 From: Peter da Silva Date: Fri, 21 Aug 2026 17:56:33 +0000 Subject: [PATCH 1/3] Get TCL paths from cmake modules instead of reading them from tea leaves. --- CMakeLists.txt | 16 +++------------- COMMONmakefile | 2 +- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1ad5c84..e71748d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,8 +13,6 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) endif() message(INFO " cmake build type ${CMAKE_BUILD_TYPE}") -set(TCLSH_VERSION_STRING, "8.6") - # Determine if cpptcl is built as a subproject (using add_subdirectory) # or if it is the master project. set(CPPTCL_MASTER_PROJECT OFF) @@ -38,17 +36,9 @@ endif() include (CTest) -set(TCL_VERSION_MAJOR "8" CACHE STRING "TCL Major version") -set(TCL_VERSION_MINOR "6" CACHE STRING "TCL Minor version") -set(TCL_TCLSH "tclsh${TCL_VERSION_MAJOR}.${TCL_VERSION_MINOR}") -set(TCL_VER "${TCL_VERSION_MAJOR}.${TCL_VERSION_MINOR}") -set(TCL_VER_BSD "${TCL_VERSION_MAJOR}${TCL_VERSION_MINOR}") - -message(INFO " TCL_VER ${TCL_VER}") - -find_path(TCL_INCLUDE_PATH tcl.h PATHS /usr/local/include/tcl${TCL_VER} /usr/local/include /usr/include/tcl${TCL_VER} /usr/include NO_DEFAULT_PATH) -find_library(TCL_LIBRARY NAMES tcl${TCL_VER} tcl${TCL_VER_BSD} PATHS /usr/local/lib /usr/lib) -find_library(TCL_STUB_LIBRARY NAMES tclstub${TCL_VER} tclstub${TCL_VER_BSD} PATHS /usr/local/lib /usr/lib) +find_package(TCL) +find_package(TclStub) +find_package(Tclsh) message(INFO " Tcl include ${TCL_INCLUDE_PATH}") message(INFO " Tcl library ${TCL_LIBRARY}") diff --git a/COMMONmakefile b/COMMONmakefile index 3074936..a28aad5 100644 --- a/COMMONmakefile +++ b/COMMONmakefile @@ -3,7 +3,7 @@ CPPTCL_LIBRARY = build/libcpptcl.so all: $(CPPTCL_LIBRARY) build/Makefile: CMakeLists.txt - (mkdir -p build; cd build; cmake -DTCL_VERSION_MINOR:STRING=$${TCL_VERSION_MINOR:-6} ..) + (mkdir -p build; cd build; ..) debug: CMakeLists.txt (mkdir -p build; cd build; cmake -DCMAKE_BUILD_TYPE=Debug ..) From dff64ca98440a5c66d302a1b33a1042dce5d2bca Mon Sep 17 00:00:00 2001 From: Peter da Silva Date: Fri, 21 Aug 2026 18:06:01 +0000 Subject: [PATCH 2/3] Fix editing error --- COMMONmakefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/COMMONmakefile b/COMMONmakefile index a28aad5..396eb93 100644 --- a/COMMONmakefile +++ b/COMMONmakefile @@ -3,7 +3,7 @@ CPPTCL_LIBRARY = build/libcpptcl.so all: $(CPPTCL_LIBRARY) build/Makefile: CMakeLists.txt - (mkdir -p build; cd build; ..) + (mkdir -p build; cd build; cmake ..) debug: CMakeLists.txt (mkdir -p build; cd build; cmake -DCMAKE_BUILD_TYPE=Debug ..) From fab32f62bda76cefa1d517baaf75069d51952a8f Mon Sep 17 00:00:00 2001 From: Peter da Silva Date: Fri, 21 Aug 2026 18:37:34 +0000 Subject: [PATCH 3/3] tcl9 doesn't have make_safe TODO find out what the ramificatios are --- test/test1.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/test1.cc b/test/test1.cc index d848398..9796fdf 100644 --- a/test/test1.cc +++ b/test/test1.cc @@ -26,7 +26,9 @@ int fun5(char const *s) { return std::string(s).size(); } void test1() { Tcl_Interp * interp = Tcl_CreateInterp(); interpreter i(interp, true); +#if (TCL_MAJOR_VERSION < 9) i.make_safe(); +#endif std::string s = i.eval("return \"ala ma kota\""); assert(s == "ala ma kota");