summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2003-12-29 21:18:18 (GMT)
committerBrad King <brad.king@kitware.com>2003-12-29 21:18:18 (GMT)
commit13e9428d2ea9357d3f832dbe237a7a044ce26c58 (patch)
tree88807df0f73445d20166e1199c2deb0ac8ddcb05 /Modules
parentc237e0ac68922925e3fea15f8c51f9e6afef1d34 (diff)
downloadCMake-13e9428d2ea9357d3f832dbe237a7a044ce26c58.zip
CMake-13e9428d2ea9357d3f832dbe237a7a044ce26c58.tar.gz
CMake-13e9428d2ea9357d3f832dbe237a7a044ce26c58.tar.bz2
BUG#423: Fixed search for frameworks on OSX.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/CMakeFindFrameworks.cmake17
-rw-r--r--Modules/FindPythonLibs.cmake57
-rw-r--r--Modules/FindTCL.cmake84
3 files changed, 89 insertions, 69 deletions
diff --git a/Modules/CMakeFindFrameworks.cmake b/Modules/CMakeFindFrameworks.cmake
new file mode 100644
index 0000000..c800869
--- /dev/null
+++ b/Modules/CMakeFindFrameworks.cmake
@@ -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)
diff --git a/Modules/FindPythonLibs.cmake b/Modules/FindPythonLibs.cmake
index 42a3ed0..79bbe57 100644
--- a/Modules/FindPythonLibs.cmake
+++ b/Modules/FindPythonLibs.cmake
@@ -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.
diff --git a/Modules/FindTCL.cmake b/Modules/FindTCL.cmake
index 0b95c6b..e5c26e7 100644
--- a/Modules/FindTCL.cmake
+++ b/Modules/FindTCL.cmake
@@ -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