diff options
| author | Albrecht Schlosser <albrechts.fltk@online.de> | 2018-02-24 13:44:06 +0000 |
|---|---|---|
| committer | Albrecht Schlosser <albrechts.fltk@online.de> | 2018-02-24 13:44:06 +0000 |
| commit | c9d4df288ceab6061d46dd1a5db36abcf8dc721a (patch) | |
| tree | 2bac7ac615574e44d2fc651579ad385cf440a012 /CMake/options.cmake | |
| parent | 7d1488507d110e567f57610894e9ce5d0eaebf2b (diff) | |
CMake: fix fltk-config generation for MacOS.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12687 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'CMake/options.cmake')
| -rw-r--r-- | CMake/options.cmake | 43 |
1 files changed, 28 insertions, 15 deletions
diff --git a/CMake/options.cmake b/CMake/options.cmake index 22b83525f..92bca14f6 100644 --- a/CMake/options.cmake +++ b/CMake/options.cmake @@ -25,10 +25,18 @@ if (DEBUG_OPTIONS_CMAKE) endif (DEBUG_OPTIONS_CMAKE) ####################################################################### -# *temporary* option to modify header searches +# *Temporary* option to modify header file searches +####################################################################### +# Note: The old, deprecated behavior (ON) was to use find_file() for +# header searches, the new behavior (ON) is to use check_include_files() +# which seems to be more reliable but more difficult to set up and +# slower because it uses a compilation test. Default is "new" (OFF). +# This option should be removed as soon as the new search strategy +# is considered stable. +# Currently used only in resources.cmake. ####################################################################### option(USE_FIND_FILE - "Deprecated: use find_file() for header searches" + "Deprecated: use find_file() for header searches. Should be OFF." OFF ) mark_as_advanced(USE_FIND_FILE) @@ -59,14 +67,9 @@ set(FL_ABI_VERSION ${OPTION_ABI_VERSION}) ####################################################################### ####################################################################### if (UNIX) - option(OPTION_CREATE_LINKS "create backwards compatibility links" OFF) - list(APPEND FLTK_LDLIBS -lm) + option(OPTION_CREATE_LINKS "create backwards compatibility links" OFF) endif (UNIX) -if (WIN32) - list(APPEND FLTK_LDLIBS -lole32 -luuid -lcomctl32) -endif (WIN32) - ####################################################################### ## Add a TEMPORARY OPTION to enable high-DPI support under Windows. ## May be removed once high-DPI support under Windows is complete. @@ -195,21 +198,26 @@ if(OPTION_USE_GL) set(HAVE_GL_GLU_H ${HAVE_OPENGL_GLU_H}) endif(APPLE) endif(OPTION_APPLE_X11) +else () + set(OPENGL_FOUND FALSE) endif(OPTION_USE_GL) -if (DEBUG_OPTIONS_CMAKE) - fl_debug_var(OPENGL_FOUND) - fl_debug_var(OPENGL_INCLUDE_DIR) - fl_debug_var(OPENGL_LIBRARIES) -endif (DEBUG_OPTIONS_CMAKE) - if (OPENGL_FOUND) set (CMAKE_REQUIRED_INCLUDES ${OPENGL_INCLUDE_DIR}/GL) + + # Set GLLIBS (used in fltk-config). + # We should probably deduct this from OPENGL_LIBRARIES but it turned + # out to be difficult since FindOpenGL seems to return different + # syntax depending on the platform (and maybe also CMake version). + # Hence we use the following code... + if (WIN32) set (GLLIBS "-lglu32 -lopengl32") + elseif (APPLE AND NOT OPTION_APPLE_X11) + set (GLLIBS "-framework OpenGL") else () set (GLLIBS "-lGLU -lGL") - endif () + endif (WIN32) # check if function glXGetProcAddressARB exists set (TEMP_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES}) @@ -221,6 +229,7 @@ if (OPENGL_FOUND) set (FLTK_GL_FOUND TRUE) else () set (FLTK_GL_FOUND FALSE) + set (GLLIBS) endif (OPENGL_FOUND) ####################################################################### @@ -541,11 +550,15 @@ endif(NOT CMAKE_VERSION VERSION_LESS 3.0.0) # Debugging ... if (DEBUG_OPTIONS_CMAKE) + message (STATUS "") # empty line fl_debug_var (WIN32) fl_debug_var (LIBS) fl_debug_var (GLLIBS) fl_debug_var (FLTK_LDLIBS) fl_debug_var (USE_FIND_FILE) + fl_debug_var (OPENGL_FOUND) + fl_debug_var (OPENGL_INCLUDE_DIR) + fl_debug_var (OPENGL_LIBRARIES) message (STATUS "[** end of options.cmake **]") endif (DEBUG_OPTIONS_CMAKE) unset (DEBUG_OPTIONS_CMAKE) |
