mirror of
https://github.com/Kitware/CMake.git
synced 2026-11-06 05:16:58 +00:00
FindTclStub: Do not require the Tk and ttk stub libraries
TclStub_FOUND also required TTK_STUB_LIBRARY, but Tk puts its ttk stubs in the Tk stub library and has no separate one, so it was false on standard installs. It now needs only TCL_STUB_LIBRARY, which is what the docs say it reports. Fixes: #28134
This commit is contained in:
1 parent
d291927f5d
commit
2e76eec10d
5 files changed
+96
-3
No files matched your search
@@ -32,6 +32,9 @@ This module defines the following variables:
|
||||
|
||||
Boolean indicating whether the Tcl Stub Library was found.
|
||||
|
||||
.. versionchanged:: 4.5
|
||||
This no longer depends on the Tk and ttk stub libraries being found.
|
||||
|
||||
Cache Variables
|
||||
^^^^^^^^^^^^^^^
|
||||
|
||||
@@ -40,9 +43,10 @@ The following cache variables may also be set:
|
||||
``TCL_STUB_LIBRARY``
|
||||
The path to the Tcl stub library.
|
||||
``TK_STUB_LIBRARY``
|
||||
The path to the Tk stub library.
|
||||
The path to the Tk stub library, needed by extensions that use the Tk API.
|
||||
``TTK_STUB_LIBRARY``
|
||||
The path to the ttk stub library.
|
||||
The path to a separate ttk stub library, if any. Standard Tk builds put
|
||||
the ttk stubs in the Tk stub library.
|
||||
|
||||
Examples
|
||||
^^^^^^^^
|
||||
@@ -161,7 +165,7 @@ mark_as_advanced(
|
||||
TK_STUB_LIBRARY
|
||||
)
|
||||
|
||||
if(TCL_STUB_LIBRARY AND TK_STUB_LIBRARY AND TTK_STUB_LIBRARY)
|
||||
if(TCL_STUB_LIBRARY)
|
||||
set(TclStub_FOUND TRUE)
|
||||
else()
|
||||
set(TclStub_FOUND FALSE)
|
||||
|
||||
@@ -550,6 +550,7 @@ if(CMake_TEST_FindRuby)
|
||||
)
|
||||
endif()
|
||||
add_RunCMake_test(FindOpenGL)
|
||||
add_RunCMake_test(FindTclStub)
|
||||
add_RunCMake_test(InitialFlags)
|
||||
if(CMake_TEST_FindOpenSSL)
|
||||
add_RunCMake_test(FindOpenSSL)
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
cmake_minimum_required(VERSION 4.0)
|
||||
project(${RunCMake_TEST} NONE)
|
||||
include(${RunCMake_TEST}.cmake)
|
||||
@@ -0,0 +1,82 @@
|
||||
# Ignore default and hard-coded paths to avoid finding a system Tcl
|
||||
set(CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH OFF)
|
||||
set(CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH OFF)
|
||||
set(CMAKE_FIND_USE_CMAKE_SYSTEM_PATH OFF)
|
||||
set(CMAKE_FIND_FRAMEWORK NEVER)
|
||||
set(CMAKE_IGNORE_PATH
|
||||
"C:/Tcl/lib" "C:/Program Files/Tcl/lib" "$ENV{ProgramFiles}/Tcl/Lib")
|
||||
set(CMAKE_FIND_LIBRARY_PREFIXES "")
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES .lib)
|
||||
|
||||
function(check_layout name)
|
||||
cmake_parse_arguments(PARSE_ARGV 1 arg ""
|
||||
"FOUND;TCL_STUB_LIBRARY;TK_STUB_LIBRARY;TTK_STUB_LIBRARY" "FILES")
|
||||
|
||||
set(prefix "${CMAKE_CURRENT_BINARY_DIR}/${name}")
|
||||
file(REMOVE_RECURSE "${prefix}")
|
||||
foreach(f IN LISTS arg_FILES)
|
||||
get_filename_component(dir "${prefix}/${f}" DIRECTORY)
|
||||
file(MAKE_DIRECTORY "${dir}")
|
||||
file(WRITE "${prefix}/${f}" "")
|
||||
endforeach()
|
||||
|
||||
set(CMAKE_PREFIX_PATH "${prefix}")
|
||||
# Empty skips the host tclsh/wish search, and FindTclsh running tclsh
|
||||
set(TCL_TCLSH "")
|
||||
set(TK_WISH "")
|
||||
|
||||
find_package(TclStub QUIET)
|
||||
|
||||
if(NOT TclStub_FOUND STREQUAL arg_FOUND)
|
||||
message(SEND_ERROR "${name}: TclStub_FOUND is '${TclStub_FOUND}'"
|
||||
" but expected '${arg_FOUND}'")
|
||||
endif()
|
||||
foreach(var IN ITEMS TCL_STUB_LIBRARY TK_STUB_LIBRARY TTK_STUB_LIBRARY)
|
||||
if(arg_${var})
|
||||
set(expect "${prefix}/${arg_${var}}")
|
||||
else()
|
||||
set(expect "${var}-NOTFOUND")
|
||||
endif()
|
||||
if(NOT "${${var}}" STREQUAL "${expect}")
|
||||
message(SEND_ERROR "${name}: ${var} is\n ${${var}}\n"
|
||||
"but expected\n ${expect}")
|
||||
endif()
|
||||
endforeach()
|
||||
foreach(var IN ITEMS TCL_STUB_LIBRARY TK_STUB_LIBRARY TTK_STUB_LIBRARY
|
||||
TCL_LIBRARY TK_LIBRARY TCL_INCLUDE_PATH TK_INCLUDE_PATH)
|
||||
unset(${var} CACHE)
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
check_layout(Stub86
|
||||
FILES include/tcl.h include/tk.h lib/tcl86t.lib lib/tk86t.lib
|
||||
lib/tclstub86.lib lib/tkstub86.lib
|
||||
FOUND TRUE
|
||||
TCL_STUB_LIBRARY lib/tclstub86.lib TK_STUB_LIBRARY lib/tkstub86.lib
|
||||
)
|
||||
|
||||
check_layout(Stub9
|
||||
FILES include/tcl.h include/tk.h lib/tcl90.lib lib/tcl9tk90.lib
|
||||
lib/tclstub.lib lib/tkstub.lib
|
||||
FOUND TRUE
|
||||
TCL_STUB_LIBRARY lib/tclstub.lib TK_STUB_LIBRARY lib/tkstub.lib
|
||||
)
|
||||
|
||||
check_layout(StubTclOnly
|
||||
FILES include/tcl.h lib/tcl86t.lib lib/tclstub86.lib
|
||||
FOUND TRUE
|
||||
TCL_STUB_LIBRARY lib/tclstub86.lib
|
||||
)
|
||||
|
||||
check_layout(StubTtk
|
||||
FILES include/tcl.h include/tk.h lib/tcl86t.lib lib/tk86t.lib
|
||||
lib/tclstub86.lib lib/tkstub86.lib lib/ttkstub86.lib
|
||||
FOUND TRUE
|
||||
TCL_STUB_LIBRARY lib/tclstub86.lib TK_STUB_LIBRARY lib/tkstub86.lib
|
||||
TTK_STUB_LIBRARY lib/ttkstub86.lib
|
||||
)
|
||||
|
||||
check_layout(NoStub
|
||||
FILES include/tcl.h include/tk.h lib/tcl86t.lib lib/tk86t.lib
|
||||
FOUND FALSE
|
||||
)
|
||||
@@ -0,0 +1,3 @@
|
||||
include(RunCMake)
|
||||
|
||||
run_cmake(FindTclStubTest)
|
||||
Reference in new issue
Block a user