BUG#423: Fixed search for frameworks on OSX.

This commit is contained in:
Brad King 2003-12-29 16:18:18 -05:00
parent c237e0ac68
commit 13e9428d2e
3 changed files with 89 additions and 69 deletions

View File

@ -0,0 +1,17 @@
IF(NOT CMAKE_FIND_FRAMEWORKS_INCLUDED)
SET(CMAKE_FIND_FRAMEWORKS_INCLUDED 1)
MACRO(CMAKE_FIND_FRAMEWORKS fwk)
SET(${fwk}_FRAMEWORKS)
IF(APPLE)
FOREACH(dir
~/Library/Frameworks/${fwk}.framework
/Library/Frameworks/${fwk}.framework
/System/Library/Frameworks/${fwk}.framework
/Network/Library/Frameworks/${fwk}.framework)
IF(EXISTS ${dir})
SET(${fwk}_FRAMEWORKS ${${fwk}_FRAMEWORKS} ${dir})
ENDIF(EXISTS ${dir})
ENDFOREACH(dir)
ENDIF(APPLE)
ENDMACRO(CMAKE_FIND_FRAMEWORKS)
ENDIF(NOT CMAKE_FIND_FRAMEWORKS_INCLUDED)

View File

@ -8,6 +8,8 @@
# PYTHON_DEBUG_LIBRARIES = the full path to the debug library found
#
INCLUDE(${CMAKE_ROOT}/Modules/CMakeFindFrameworks.cmake)
IF(WIN32)
FIND_LIBRARY(PYTHON_DEBUG_LIBRARY
NAMES python23_d python22_d python21_d python20_d python
@ -51,21 +53,22 @@ FIND_LIBRARY(PYTHON_LIBRARY
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\1.5\\InstallPath]/libs
)
# Search for the python framework on Apple.
CMAKE_FIND_FRAMEWORKS(Python)
SET(PYTHON_FRAMEWORK_INCLUDES)
IF(Python_FRAMEWORKS)
IF(NOT PYTHON_INCLUDE_PATH)
FOREACH(version 2.3 2.2 2.1 2.0 1.6 1.5)
FOREACH(dir ${Python_FRAMEWORKS})
SET(PYTHON_FRAMEWORK_INCLUDES ${PYTHON_FRAMEWORK_INCLUDES}
${dir}/Versions/${version}/include/python${version})
ENDFOREACH(dir)
ENDFOREACH(version)
ENDIF(NOT PYTHON_INCLUDE_PATH)
ENDIF(Python_FRAMEWORKS)
FIND_PATH(PYTHON_INCLUDE_PATH Python.h
~/Library/Frameworks/Python.framework/Headers
/Library/Frameworks/Python.framework/Headers
~/Library/Frameworks/Python.framework/Versions/2.3/include/python2.3
/Library/Frameworks/Python.framework/Versions/2.3/include/python2.3
~/Library/Frameworks/Python.framework/Versions/2.2/include/python2.2
/Library/Frameworks/Python.framework/Versions/2.2/include/python2.2
~/Library/Frameworks/Python.framework/Versions/2.1/include/python2.1
/Library/Frameworks/Python.framework/Versions/2.1/include/python2.1
~/Library/Frameworks/Python.framework/Versions/2.0/include/python2.0
/Library/Frameworks/Python.framework/Versions/2.0/include/python2.0
~/Library/Frameworks/Python.framework/Versions/1.6/include/python1.6
/Library/Frameworks/Python.framework/Versions/1.6/include/python1.6
~/Library/Frameworks/Python.framework/Versions/1.5/include/python1.5
/Library/Frameworks/Python.framework/Versions/1.5/include/python1.5
${PYTHON_FRAMEWORK_INCLUDES}
/usr/include/python2.3
/usr/include/python2.2
/usr/include/python2.1
@ -91,26 +94,20 @@ IF (WIN32)
ENDIF(WIN32)
# Python Should be built and installed as a Framework on OSX
IF (APPLE)
IF(EXISTS ~/Library/Frameworks/Python.framework)
SET(PYTHON_HAVE_FRAMEWORK 1)
ENDIF(EXISTS ~/Library/Frameworks/Python.framework)
IF(EXISTS /Library/Frameworks/Python.framework)
SET(PYTHON_HAVE_FRAMEWORK 1)
ENDIF(EXISTS /Library/Frameworks/Python.framework)
IF(Python_FRAMEWORKS)
# If a framework has been selected for the include path,
# make sure "-framework" is used to link it.
IF("${PYTHON_INCLUDE_PATH}" MATCHES "Python\\.framework")
SET(PYTHON_LIBRARY "")
SET(PYTHON_DEBUG_LIBRARY "")
ENDIF("${PYTHON_INCLUDE_PATH}" MATCHES "Python\\.framework")
IF(PYTHON_HAVE_FRAMEWORK)
IF(NOT PYTHON_LIBRARY)
SET (PYTHON_LIBRARY "-framework Python" CACHE FILEPATH "Python Framework" FORCE)
ENDIF(NOT PYTHON_LIBRARY)
IF(NOT PYTHON_DEBUG_LIBRARY)
SET (PYTHON_DEBUG_LIBRARY "-framework Python" CACHE FILEPATH "Python Framework" FORCE)
ENDIF(NOT PYTHON_DEBUG_LIBRARY)
ENDIF(PYTHON_HAVE_FRAMEWORK)
ENDIF (APPLE)
IF(NOT PYTHON_LIBRARY)
SET (PYTHON_LIBRARY "-framework Python" CACHE FILEPATH "Python Framework" FORCE)
ENDIF(NOT PYTHON_LIBRARY)
IF(NOT PYTHON_DEBUG_LIBRARY)
SET (PYTHON_DEBUG_LIBRARY "-framework Python" CACHE FILEPATH "Python Framework" FORCE)
ENDIF(NOT PYTHON_DEBUG_LIBRARY)
ENDIF(Python_FRAMEWORKS)
# We use PYTHON_LIBRARY and PYTHON_DEBUG_LIBRARY for the cache entries
# because they are meant to specify the location of a single library.

View File

@ -18,6 +18,7 @@
# TK_WISH = full path to the wish binary (wish wish80 etc)
#
INCLUDE(${CMAKE_ROOT}/Modules/CMakeFindFrameworks.cmake)
INCLUDE(${CMAKE_ROOT}/Modules/FindTclsh.cmake)
INCLUDE(${CMAKE_ROOT}/Modules/FindWish.cmake)
@ -78,22 +79,38 @@ FIND_LIBRARY(TK_STUB_LIBRARY_DEBUG
PATHS ${TCLTK_POSSIBLE_LIB_PATHS}
)
CMAKE_FIND_FRAMEWORKS(Tcl)
CMAKE_FIND_FRAMEWORKS(Tk)
SET(TCL_FRAMEWORK_INCLUDES)
IF(Tcl_FRAMEWORKS)
IF(NOT TCL_INCLUDE_PATH)
FOREACH(dir ${Tcl_FRAMEWORKS})
SET(TCL_FRAMEWORK_INCLUDES ${TCL_FRAMEWORK_INCLUDES} ${dir}/Headers)
ENDFOREACH(dir)
ENDIF(NOT TCL_INCLUDE_PATH)
ENDIF(Tcl_FRAMEWORKS)
SET(TK_FRAMEWORK_INCLUDES)
IF(Tk_FRAMEWORKS)
IF(NOT TK_INCLUDE_PATH)
FOREACH(dir ${Tk_FRAMEWORKS})
SET(TK_FRAMEWORK_INCLUDES ${TK_FRAMEWORK_INCLUDES}
${dir}/Headers ${dir}/PrivateHeaders)
ENDFOREACH(dir)
ENDIF(NOT TK_INCLUDE_PATH)
ENDIF(Tk_FRAMEWORKS)
SET (TCLTK_POSSIBLE_INCLUDE_PATHS
~/Library/Frameworks/Tcl.framework/Headers
~/Library/Frameworks/Tk.framework/Headers
~/Library/Frameworks/Tk.framework/PrivateHeaders
/Library/Frameworks/Tcl.framework/Headers
/Library/Frameworks/Tk.framework/Headers
/Library/Frameworks/Tk.framework/PrivateHeaders
"${TCL_TCLSH_PATH}/../include"
"${TK_WISH_PATH}/../include"
"C:/Program Files/Tcl/include"
"C:/Tcl/include"
${TCL_TCLSH_PATH}/../include
${TK_WISH_PATH}/../include
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.4;Root]/include
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.3;Root]/include
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.2;Root]/include
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.0;Root]/include
/usr/include
"C:/Program Files/Tcl/include"
C:/Tcl/include
/usr/include
/usr/local/include
/usr/include/tcl8.4
/usr/include/tcl8.3
@ -101,12 +118,12 @@ SET (TCLTK_POSSIBLE_INCLUDE_PATHS
/usr/include/tcl8.0
)
FIND_PATH(TCL_INCLUDE_PATH tcl.h
${TCLTK_POSSIBLE_INCLUDE_PATHS}
FIND_PATH(TCL_INCLUDE_PATH tcl.h
${TCL_FRAMEWORK_INCLUDES} ${TCLTK_POSSIBLE_INCLUDE_PATHS}
)
FIND_PATH(TK_INCLUDE_PATH tk.h
${TCLTK_POSSIBLE_INCLUDE_PATHS}
FIND_PATH(TK_INCLUDE_PATH tk.h
${TK_FRAMEWORK_INCLUDES} ${TCLTK_POSSIBLE_INCLUDE_PATHS}
)
IF (WIN32)
@ -127,36 +144,25 @@ IF (WIN32)
)
ENDIF(WIN32)
IF(APPLE)
IF(EXISTS ~/Library/Frameworks/Tcl.framework)
SET(TCL_HAVE_FRAMEWORK 1)
ENDIF(EXISTS ~/Library/Frameworks/Tcl.framework)
IF(EXISTS /Library/Frameworks/Tcl.framework)
SET(TCL_HAVE_FRAMEWORK 1)
ENDIF(EXISTS /Library/Frameworks/Tcl.framework)
IF(EXISTS ~/Library/Frameworks/Tk.framework)
SET(TCL_TK_HAVE_FRAMEWORK 1)
ENDIF(EXISTS ~/Library/Frameworks/Tk.framework)
IF(EXISTS /Library/Frameworks/Tk.framework)
SET(TCL_TK_HAVE_FRAMEWORK 1)
ENDIF(EXISTS /Library/Frameworks/Tk.framework)
IF(Tcl_FRAMEWORKS)
# If we are using the Tcl framework, link to it.
IF("${TCL_INCLUDE_PATH}" MATCHES "Tcl\\.framework")
SET(TCL_LIBRARY "")
ENDIF("${TCL_INCLUDE_PATH}" MATCHES "Tcl\\.framework")
IF(NOT TCL_LIBRARY)
SET (TCL_LIBRARY "-framework Tcl" CACHE FILEPATH "Tcl Framework" FORCE)
ENDIF(NOT TCL_LIBRARY)
ENDIF(Tcl_FRAMEWORKS)
IF(Tk_FRAMEWORKS)
# If we are using the Tk framework, link to it.
IF("${TK_INCLUDE_PATH}" MATCHES "Tk\\.framework")
SET(TK_LIBRARY "")
ENDIF("${TK_INCLUDE_PATH}" MATCHES "Tk\\.framework")
IF(TCL_HAVE_FRAMEWORK)
IF(NOT TCL_LIBRARY)
SET (TCL_LIBRARY "-framework Tcl" CACHE FILEPATH "Tcl Framework" FORCE)
ENDIF(NOT TCL_LIBRARY)
ENDIF(TCL_HAVE_FRAMEWORK)
IF(TCL_TK_HAVE_FRAMEWORK)
IF(NOT TK_LIBRARY)
SET (TK_LIBRARY "-framework Tk" CACHE FILEPATH "Tk Framework" FORCE)
ENDIF(NOT TK_LIBRARY)
ENDIF(TCL_TK_HAVE_FRAMEWORK)
ENDIF(APPLE)
IF(NOT TK_LIBRARY)
SET (TK_LIBRARY "-framework Tk" CACHE FILEPATH "Tk Framework" FORCE)
ENDIF(NOT TK_LIBRARY)
ENDIF(Tk_FRAMEWORKS)
MARK_AS_ADVANCED(
TCL_STUB_LIBRARY