From a89dbfc1b9be897a2c9f0216d160185669ec795e Mon Sep 17 00:00:00 2001 From: Ian Scott Date: Mon, 2 Sep 2002 17:34:45 -0400 Subject: Moved FLTK and GTK to new FindXXX scheme. Imported some functionality from VXL --- Modules/FindFLTK.cmake | 203 +++++++++++++++++++++++++------------------------ Modules/FindGTK.cmake | 140 +++++++++++++++++++++++++++++++--- 2 files changed, 232 insertions(+), 111 deletions(-) diff --git a/Modules/FindFLTK.cmake b/Modules/FindFLTK.cmake index 8ad9d98..d805346 100644 --- a/Modules/FindFLTK.cmake +++ b/Modules/FindFLTK.cmake @@ -1,99 +1,104 @@ -# -# Find the native FLTK includes and library -# -# FLTK_FLUID_EXE, where to find the Fluid tool -# FLTK_WRAP_UI, This allows the FLTK_WRAP_UI command to work. -# FLTK_INCLUDE_PATH, where to find include files -# FLTK_LIBRARY, list of fltk libraries -# FLTK_BASE_LIBRARY, the full path to fltk.lib -# FLTK_GL_LIBRARY, the full path to fltk_gl.lib -# FLTK_FORMS_LIBRARY, the full path to fltk_forms.lib - - -OPTION(USE_FLTK_VERSION_1.0.11 "Use FLTK version 1.0.11" 1) - -OPTION(USE_FLTK_VERSION_1.1 "Use FLTK version 1.1" 0) - -# Exlusion between the two version -IF(USE_FLTK_VERSION_1.0.11) - SET(USE_FLTK_VERSION_1.1 0) -ENDIF(USE_FLTK_VERSION_1.0.11) - - -FIND_PATH(FLTK_INCLUDE_PATH FL/Fl.h -/usr/local/include -/usr/include -/usr/local/fltk -/usr/X11R6/include -H:/usr/local/fltk -) - - -# Platform dependent libraries required by FLTK -IF(WIN32) - SET( FLTK_PLATFORM_DEPENDENT_LIBS wsock32 ) -ENDIF(WIN32) - -IF(UNIX) - SET( FLTK_PLATFORM_DEPENDENT_LIBS ${CMAKE_X_LIBS} -lm) -ENDIF(UNIX) - - -# Make sure that the FLTK include path has been set -# So the FLTK_LIBRARY does not appear the first time -IF(FLTK_INCLUDE_PATH) - IF(USE_FLTK_VERSION_1.0.11) - FIND_LIBRARY(FLTK_BASE_LIBRARY NAMES fltk fltkd - PATHS /usr/lib /usr/local/lib /usr/local/fltk/lib H:/usr/local/fltk/lib /usr/X11R6/lib - ${FLTK_INCLUDE_PATH}/lib - ) - ENDIF(USE_FLTK_VERSION_1.0.11) - - - IF(USE_FLTK_VERSION_1.1) - FIND_LIBRARY(FLTK_BASE_LIBRARY NAMES fltk fltkd - PATHS /usr/lib /usr/local/lib /usr/local/fltk/lib H:/usr/local/fltk/lib /usr/X11R6/lib - ${FLTK_INCLUDE_PATH}/lib - ) - FIND_LIBRARY(FLTK_GL_LIBRARY NAMES fltkgl fltkgld fltk_gl - PATHS /usr/lib /usr/local/lib /usr/local/fltk/lib H:/usr/local/fltk/lib /usr/X11R6/lib - ${FLTK_INCLUDE_PATH}/lib - ) - FIND_LIBRARY(FLTK_FORMS_LIBRARY NAMES fltkforms fltkformsd fltk_forms - PATHS /usr/lib /usr/local/lib /usr/local/fltk/lib H:/usr/local/fltk/lib /usr/X11R6/lib - ${FLTK_INCLUDE_PATH}/lib - ) - FIND_LIBRARY(FLTK_IMAGES_LIBRARY NAMES fltkimages fltkimagesd fltk_images - PATHS /usr/lib /usr/local/lib /usr/local/fltk/lib H:/usr/local/fltk/lib /usr/X11R6/lib - ${FLTK_INCLUDE_PATH}/lib - ) - ENDIF(USE_FLTK_VERSION_1.1) - - SET( FLTK_LIBRARY ${FLTK_BASE_LIBRARY} ${FLTK_GL_LIBRARY} ${FLTK_FORMS_LIBRARY} ${FLTK_IMAGES_LIBRARY} ${FLTK_PLATFORM_DEPENDENT_LIBS} ) - -ENDIF(FLTK_INCLUDE_PATH) - -# Find Fluid -FIND_FILE(FLTK_FLUID_EXE fluid -${path} ${FLTK_INCLUDE_PATH}/fluid -) - -# Enable the Wrap UI command -IF (FLTK_FLUID_EXE) - SET ( FLTK_WRAP_UI 1 CACHE INTERNAL "Can we honour the FLTK_WRAP_UI command" ) -ENDIF (FLTK_FLUID_EXE) - -# -# Set HAS_FLTK -# This is the final flag that will be checked by -# other code that requires FLTK for compile/run. -# -IF(FLTK_FLUID_EXE) - IF(FLTK_INCLUDE_PATH) - IF(FLTK_LIBRARY) - SET (HAS_FLTK 1 CACHE INTERNAL "FLTK library, headers and Fluid are available") - ENDIF(FLTK_LIBRARY) - ENDIF(FLTK_INCLUDE_PATH) -ENDIF(FLTK_FLUID_EXE) - - +# +# Find the native FLTK includes and library +# +# The following settings are defined +# FLTK_FLUID_EXECUTABLE, where to find the Fluid tool +# FLTK_WRAP_UI, This allows the FLTK_WRAP_UI command to work. +# FLTK_INCLUDE_DIR, where to find include files +# FLTK_LIBRARIES, list of fltk libraries +# FLTK_FOUND, Don't use FLTK if false. + + +# The following settings should not be used in general. +# FLTK_BASE_LIBRARY, the full path to fltk.lib +# FLTK_GL_LIBRARY, the full path to fltk_gl.lib +# FLTK_FORMS_LIBRARY, the full path to fltk_forms.lib + +OPTION(USE_FLTK_VERSION_1.0.11 "Use FLTK version 1.0.11" 1) +OPTION(USE_FLTK_VERSION_1.1 "Use FLTK version 1.1" 0) + +# Exclusion between the two version + +IF(USE_FLTK_VERSION_1.0.11) + SET(USE_FLTK_VERSION_1.1 0) +ENDIF(USE_FLTK_VERSION_1.0.11) + +FIND_PATH(FLTK_INCLUDE_DIR FL/Fl.h + /usr/local/include + /usr/include + /usr/local/fltk + /usr/X11R6/include +) + +# Platform dependent libraries required by FLTK + +IF(WIN32) + SET( FLTK_PLATFORM_DEPENDENT_LIBS wsock32 ) +ENDIF(WIN32) + +IF(UNIX) + SET( FLTK_PLATFORM_DEPENDENT_LIBS ${CMAKE_X_LIBS} -lm) +ENDIF(UNIX) + +# Make sure that the FLTK include path has been set +# So the FLTK_LIBRARY does not appear the first time +IF(FLTK_INCLUDE_DIR) + IF(USE_FLTK_VERSION_1.0.11) + FIND_LIBRARY(FLTK_BASE_LIBRARY NAMES fltk fltkd + PATHS /usr/lib /usr/local/lib + /usr/local/fltk/lib + /usr/X11R6/lib ${FLTK_INCLUDE_DIR}/lib + ) + ENDIF(USE_FLTK_VERSION_1.0.11) + IF(USE_FLTK_VERSION_1.1) + FIND_LIBRARY(FLTK_BASE_LIBRARY NAMES fltk fltkd + PATHS /usr/lib /usr/local/lib /usr/local/fltk/lib + /usr/X11R6/lib ${FLTK_INCLUDE_DIR}/lib + ) + FIND_LIBRARY(FLTK_GL_LIBRARY NAMES fltkgl fltkgld fltk_gl + PATHS /usr/lib /usr/local/lib /usr/local/fltk/lib + /usr/X11R6/lib ${FLTK_INCLUDE_DIR}/lib + ) + FIND_LIBRARY(FLTK_FORMS_LIBRARY NAMES fltkforms fltkformsd fltk_forms + PATHS /usr/lib /usr/local/lib /usr/local/fltk/lib + /usr/X11R6/lib ${FLTK_INCLUDE_DIR}/lib + ) + FIND_LIBRARY(FLTK_IMAGES_LIBRARY NAMES fltkimages fltkimagesd fltk_images + PATHS /usr/lib /usr/local/lib /usr/local/fltk/lib + /usr/X11R6/lib ${FLTK_INCLUDE_DIR}/lib + ) + ENDIF(USE_FLTK_VERSION_1.1) + SET( FLTK_LIBRARIES ${FLTK_BASE_LIBRARY} ${FLTK_GL_LIBRARY} + ${FLTK_FORMS_LIBRARY} ${FLTK_IMAGES_LIBRARY} ${FLTK_PLATFORM_DEPENDENT_LIBS} + ) +ENDIF(FLTK_INCLUDE_DIR) +# Find Fluid +FIND_FILE(FLTK_FLUID_EXECUTABLE fluid + ${path} ${FLTK_INCLUDE_DIR}/fluid +) +# Enable the Wrap UI command +IF (FLTK_FLUID_EXECUTABLE) + SET ( FLTK_WRAP_UI 1 CACHE INTERNAL "Can we honour the FLTK_WRAP_UI command" ) +ENDIF (FLTK_FLUID_EXECUTABLE) + +# +# Set FLTK_FOUND +# This is the final flag that will be checked by +# other code that requires FLTK for compile/run. +# + +IF(FLTK_FLUID_EXECUTABLE) + IF(FLTK_INCLUDE_DIR) + IF(FLTK_LIBRARIES) + + # The fact that it is in the cache is deprecated. + SET (FLTK_FOUND 1 CACHE INTERNAL "FLTK library, headers and Fluid are available") + + # The following deprecated settings are for compatibility with CMake 1.4 + SET (HAS_FLTK ${FLTK_FOUND}) + SET (FLTK_INCLUDE_PATH ${FLTK_INCLUDE_DIR}) + SET (FLTK_FLUID_EXE ${FLTK_FLUID_EXECUTABLE}) + SET (FLTK_LIBRARY ${FLTK_LIBRARIES}) + ENDIF(FLTK_LIBRARIES) + ENDIF(FLTK_INCLUDE_DIR) +ENDIF(FLTK_FLUID_EXECUTABLE) \ No newline at end of file diff --git a/Modules/FindGTK.cmake b/Modules/FindGTK.cmake index df6277e..846cd99 100644 --- a/Modules/FindGTK.cmake +++ b/Modules/FindGTK.cmake @@ -1,25 +1,141 @@ # -# try to find GTK +# try to find GTK (and glib) and GTKGLArea # +# GTK_INCLUDE_DIR - Directories to include to use GTK +# GTK_LIBRARIES - Files to link against to use GTK +# GTK_FOUND - If false, don't try to use GTK + # don't even bother under WIN32 IF (UNIX) - FIND_PATH(GTK_INCLUDE_PATH gtk/gtk.h - /usr/include - /usr/local/include - /usr/openwin/share/include + FIND_PATH( GTK_gtk_INCLUDE_PATH gtk/gtk.h + /usr/include + /usr/local/include + /usr/openwin/share/include + /usr/openwin/include + /usr/X11R6/include + /usr/include/X11 + /usr/X11R6/include/gtk12 + /usr/include/gtk-1.2 + /usr/local/include/gtk-1.2 + /opt/gnome/include ) - FIND_LIBRARY(GTK_LIB_PATH gtk - PATHS /usr/lib /usr/local/lib /usr/openwin/lib /usr/X11R6/lib + # Some Linux distributions (e.g. Red Hat) have glibconfig.h + # and glib.h in different directories, so we need to look + # for both. + # - Atanas Georgiev + + FIND_PATH( GTK_glibconfig_INCLUDE_PATH glibconfig.h + /usr/include + /usr/local/include + /usr/openwin/share/include + /usr/local/include/glib12 + /usr/lib/glib/include + /usr/local/lib/glib/include + /opt/gnome/include + /opt/gnome/lib/glib/include ) - FIND_PATH(GTK_GLIB_INCLUDE_PATH glibconfig.h - /usr/include - /usr/local/include - /usr/openwin/share/include + FIND_PATH( GTK_glib_INCLUDE_PATH glib.h + /usr/include + /usr/local/include + /usr/openwin/share/include + /usr/include/gtk-1.2 + /usr/local/include/glib12 + /usr/lib/glib/include + /usr/include/glib-1.2 + /usr/local/include/glib-1.2 + /opt/gnome/include + /opt/gnome/include/glib-1.2 ) -ENDIF (UNIX) + FIND_PATH( GTK_gtkgl_INCLUDE_PATH gtkgl/gtkglarea.h + /usr/include + /usr/local/include + /usr/openwin/share/include + /opt/gnome/include + ) + + FIND_LIBRARY( GTK_gtkgl_LIBRARY gtkgl + /usr/lib + /usr/local/lib + /usr/openwin/lib + /usr/X11R6/lib + /opt/gnome/lib + ) + + # + # The 12 suffix is thanks to the FreeBSD ports collection + # + + FIND_LIBRARY( GTK_gtk_LIBRARY + NAMES gtk gtk12 + PATHS /usr/lib + /usr/local/lib + /usr/openwin/lib + /usr/X11R6/lib + /opt/gnome/lib + ) + + FIND_LIBRARY( GTK_gdk_LIBRARY + NAMES gdk gdk12 + PATHS /usr/lib + /usr/local/lib + /usr/openwin/lib + /usr/X11R6/lib + /opt/gnome/lib + ) + FIND_LIBRARY( GTK_gmodule_LIBRARY + NAMES gmodule gmodule12 + PATHS /usr/lib + /usr/local/lib + /usr/openwin/lib + /usr/X11R6/lib + /opt/gnome/lib + ) + + FIND_LIBRARY( GTK_glib_LIBRARY + NAMES glib glib12 + PATHS /usr/lib + /usr/local/lib + /usr/openwin/lib + /usr/X11R6/lib + /opt/gnome/lib + ) + + IF(GTK_gtk_INCLUDE_PATH) + IF(GTK_glibconfig_INCLUDE_PATH) + IF(GTK_glib_INCLUDE_PATH) + IF(GTK_gtkgl_INCLUDE_PATH) + IF(GTK_gtk_LIBRARY) + IF(GTK_glib_LIBRARY) + IF(GTK_gtkgl_LIBRARY) + + # Assume that if gtk and glib were found, the other + # supporting libraries have also been found. + + SET( GTK_FOUND "YES" ) + SET( GTK_INCLUDE_DIR ${GTK_gtk_INCLUDE_PATH} + ${GTK_glibconfig_INCLUDE_PATH} + ${GTK_glib_INCLUDE_PATH} + ${GTK_gtkgl_INCLUDE_PATH} ) + SET( GTK_LIBRARIES ${GTK_gtkgl_LIBRARY} + ${GTK_gtk_LIBRARY} + ${GTK_gdk_LIBRARY} + ${GTK_gmodule_LIBRARY} + ${GTK_glib_LIBRARY} ) + + ENDIF(GTK_gtkgl_LIBRARY) + ENDIF(GTK_glib_LIBRARY) + ENDIF(GTK_gtk_LIBRARY) + ENDIF(GTK_gtkgl_INCLUDE_PATH) + ENDIF(GTK_glibconfig_INCLUDE_PATH) + ENDIF(GTK_glib_INCLUDE_PATH) + ENDIF(GTK_gtk_INCLUDE_PATH) + + + +ENDIF (UNIX) -- cgit v0.12