mirror of
https://github.com/fltk/fltk.git
synced 2026-05-28 03:15:21 +08:00
CMake: Raise cmake_minimum_required from 3.12 to 3.15
Remove code that checks CMake versions lower than 3.15
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# CMake compatibility functions and macros for the Fast Light Tool Kit (FLTK)
|
# CMake compatibility functions and macros for the Fast Light Tool Kit (FLTK)
|
||||||
#
|
#
|
||||||
# Copyright 1998-2021 by Bill Spitzak and others.
|
# Copyright 1998-2023 by Bill Spitzak and others.
|
||||||
#
|
#
|
||||||
# This library is free software. Distribution and use rights are outlined in
|
# This library is free software. Distribution and use rights are outlined in
|
||||||
# the file "COPYING" which should have been included with this file. If this
|
# the file "COPYING" which should have been included with this file. If this
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
#
|
#
|
||||||
# The functions (and macros) in this file are defined to simplify CMake
|
# The functions and maybe macros in this file are defined to simplify CMake
|
||||||
# code that uses features not available in all supported CMake versions.
|
# code that uses features not available in all supported CMake versions.
|
||||||
# Functions should be preferred (rather than macros) because functions
|
# Functions should be preferred (rather than macros) because functions
|
||||||
# have their own variable scope.
|
# have their own variable scope.
|
||||||
@@ -33,6 +33,12 @@
|
|||||||
#
|
#
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
|
|
||||||
|
# Right now we don't need compatibility functions
|
||||||
|
# This file is currently "empty" but left for documentation purposes
|
||||||
|
# An example function documentation follows...
|
||||||
|
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
#
|
#
|
||||||
# function fl_target_link_directories - add link directories to target
|
# function fl_target_link_directories - add link directories to target
|
||||||
@@ -62,13 +68,3 @@
|
|||||||
# can be an empty list.
|
# can be an empty list.
|
||||||
#
|
#
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
function (fl_target_link_directories TARGET SCOPE DIRS)
|
|
||||||
|
|
||||||
if (CMAKE_VERSION VERSION_LESS "3.13")
|
|
||||||
link_directories (${DIRS})
|
|
||||||
else ()
|
|
||||||
target_link_directories (${TARGET} ${SCOPE} ${DIRS})
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
endfunction () # fl_target_link_directories()
|
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ function (CREATE_EXAMPLE NAME SOURCES LIBRARIES)
|
|||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
if (FLTK_HAVE_CAIRO AND PKG_CAIRO_LIBRARY_DIRS)
|
if (FLTK_HAVE_CAIRO AND PKG_CAIRO_LIBRARY_DIRS)
|
||||||
fl_target_link_directories (${TARGET_NAME} PUBLIC ${PKG_CAIRO_LIBRARY_DIRS})
|
target_link_directories (${TARGET_NAME} PUBLIC ${PKG_CAIRO_LIBRARY_DIRS})
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
if (USE_GDIPLUS) # can only be true on Windows
|
if (USE_GDIPLUS) # can only be true on Windows
|
||||||
|
|||||||
+1
-1
@@ -536,7 +536,7 @@ if (OPTION_USE_GL)
|
|||||||
unset(HAVE_GL_GLU_H CACHE)
|
unset(HAVE_GL_GLU_H CACHE)
|
||||||
find_file (HAVE_GL_GLU_H GL/glu.h PATHS ${X11_INCLUDE_DIR})
|
find_file (HAVE_GL_GLU_H GL/glu.h PATHS ${X11_INCLUDE_DIR})
|
||||||
else()
|
else()
|
||||||
include (FindOpenGL)
|
find_package(OpenGL)
|
||||||
if (APPLE)
|
if (APPLE)
|
||||||
set (HAVE_GL_GLU_H ${HAVE_OPENGL_GLU_H})
|
set (HAVE_GL_GLU_H ${HAVE_OPENGL_GLU_H})
|
||||||
endif (APPLE)
|
endif (APPLE)
|
||||||
|
|||||||
+3
-5
@@ -82,11 +82,9 @@ include(TestBigEndian)
|
|||||||
TEST_BIG_ENDIAN(WORDS_BIGENDIAN)
|
TEST_BIG_ENDIAN(WORDS_BIGENDIAN)
|
||||||
|
|
||||||
if (CMAKE_GENERATOR MATCHES "Xcode")
|
if (CMAKE_GENERATOR MATCHES "Xcode")
|
||||||
if (NOT (CMAKE_VERSION VERSION_LESS 3.9)) # CMake 3.9 and up
|
# Tell Xcode to regenerate scheme information automatically whenever the
|
||||||
# Tell Xcode to regenerate scheme information automatically whenever the
|
# CMake configuration changes without asking the user
|
||||||
# CMake configuration changes without asking the user
|
set (CMAKE_XCODE_GENERATE_SCHEME 1)
|
||||||
set (CMAKE_XCODE_GENERATE_SCHEME 1)
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (APPLE)
|
if (APPLE)
|
||||||
|
|||||||
+5
-17
@@ -25,23 +25,9 @@
|
|||||||
# at least CMake 3.12.0
|
# at least CMake 3.12.0
|
||||||
# Note 2: Used in fluid since 05/2023,
|
# Note 2: Used in fluid since 05/2023,
|
||||||
# used for Windows (MSVC) shared lib builds much earlier
|
# used for Windows (MSVC) shared lib builds much earlier
|
||||||
|
# Note 3: More modern CMake features require 3.13...3.15 (Nov 2023)
|
||||||
|
|
||||||
cmake_minimum_required (VERSION 3.12.0 FATAL_ERROR) # 05/2023
|
cmake_minimum_required (VERSION 3.15.0 FATAL_ERROR)
|
||||||
|
|
||||||
#######################################################################
|
|
||||||
|
|
||||||
# Use "legacy mode" of FindOpenGL (avoid CMake developer warning).
|
|
||||||
# Note: we're using FindOpenGL with `OPENGL_LIBRARIES` and not (yet)
|
|
||||||
# the `OpenGL::GL` target. This may be changed in the future.
|
|
||||||
# See https://cmake.org/cmake/help/latest/policy/CMP0072.html
|
|
||||||
# Update Feb 28, 2021: To avoid a warning about "OLD" policies we set
|
|
||||||
# OpenGL_GL_PREFERENCE directly to "LEGACY" (other option: "GLVND").
|
|
||||||
|
|
||||||
# if (POLICY CMP0072)
|
|
||||||
# cmake_policy (SET CMP0072 OLD)
|
|
||||||
# endif ()
|
|
||||||
|
|
||||||
set (OpenGL_GL_PREFERENCE LEGACY)
|
|
||||||
|
|
||||||
#######################################################################
|
#######################################################################
|
||||||
# define the FLTK project and version
|
# define the FLTK project and version
|
||||||
@@ -56,7 +42,9 @@ project (FLTK VERSION 1.4.0)
|
|||||||
include (CMake/fl_debug_var.cmake)
|
include (CMake/fl_debug_var.cmake)
|
||||||
include (CMake/fl_debug_pkg.cmake)
|
include (CMake/fl_debug_pkg.cmake)
|
||||||
include (CMake/fl_add_library.cmake)
|
include (CMake/fl_add_library.cmake)
|
||||||
include (CMake/compatibility.cmake)
|
|
||||||
|
# right now we don't use compatibility functions
|
||||||
|
# include (CMake/compatibility.cmake)
|
||||||
|
|
||||||
if (0)
|
if (0)
|
||||||
fl_debug_var (FLTK_VERSION_MAJOR)
|
fl_debug_var (FLTK_VERSION_MAJOR)
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ endif ()
|
|||||||
|
|
||||||
# we must link fltk-optons with cairo if option CAIRO is enabled
|
# we must link fltk-optons with cairo if option CAIRO is enabled
|
||||||
if (FLTK_HAVE_CAIRO)
|
if (FLTK_HAVE_CAIRO)
|
||||||
fl_target_link_directories (fltk-options PRIVATE "${PKG_CAIRO_LIBRARY_DIRS}")
|
target_link_directories (fltk-options PRIVATE ${PKG_CAIRO_LIBRARY_DIRS})
|
||||||
endif (FLTK_HAVE_CAIRO)
|
endif (FLTK_HAVE_CAIRO)
|
||||||
|
|
||||||
if (USE_GDIPLUS) # can only be true on Windows
|
if (USE_GDIPLUS) # can only be true on Windows
|
||||||
@@ -71,7 +71,7 @@ if (WIN32)
|
|||||||
add_executable (fltk-options-cmd ${CPPFILES} ${HEADERFILES})
|
add_executable (fltk-options-cmd ${CPPFILES} ${HEADERFILES})
|
||||||
target_link_libraries (fltk-options-cmd ${FLTK_OPTIONS_LIBS})
|
target_link_libraries (fltk-options-cmd ${FLTK_OPTIONS_LIBS})
|
||||||
if (FLTK_HAVE_CAIRO)
|
if (FLTK_HAVE_CAIRO)
|
||||||
fl_target_link_directories (fltk-options-cmd PRIVATE "${PKG_CAIRO_LIBRARY_DIRS}")
|
target_link_directories (fltk-options-cmd PRIVATE ${PKG_CAIRO_LIBRARY_DIRS})
|
||||||
endif (FLTK_HAVE_CAIRO)
|
endif (FLTK_HAVE_CAIRO)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ endif ()
|
|||||||
if (FLTK_HAVE_CAIRO)
|
if (FLTK_HAVE_CAIRO)
|
||||||
target_include_directories (fluid PRIVATE ${PKG_CAIRO_INCLUDE_DIRS})
|
target_include_directories (fluid PRIVATE ${PKG_CAIRO_INCLUDE_DIRS})
|
||||||
if (PKG_CAIRO_LIBRARY_DIRS)
|
if (PKG_CAIRO_LIBRARY_DIRS)
|
||||||
fl_target_link_directories (fluid PRIVATE ${PKG_CAIRO_LIBRARY_DIRS})
|
target_link_directories (fluid PRIVATE ${PKG_CAIRO_LIBRARY_DIRS})
|
||||||
endif ()
|
endif ()
|
||||||
endif (FLTK_HAVE_CAIRO)
|
endif (FLTK_HAVE_CAIRO)
|
||||||
|
|
||||||
@@ -191,7 +191,7 @@ if (WIN32)
|
|||||||
if (FLTK_HAVE_CAIRO)
|
if (FLTK_HAVE_CAIRO)
|
||||||
target_include_directories (fluid-cmd PRIVATE ${PKG_CAIRO_INCLUDE_DIRS})
|
target_include_directories (fluid-cmd PRIVATE ${PKG_CAIRO_INCLUDE_DIRS})
|
||||||
if (PKG_CAIRO_LIBRARY_DIRS)
|
if (PKG_CAIRO_LIBRARY_DIRS)
|
||||||
fl_target_link_directories (fluid-cmd PRIVATE ${PKG_CAIRO_LIBRARY_DIRS})
|
target_link_directories (fluid-cmd PRIVATE ${PKG_CAIRO_LIBRARY_DIRS})
|
||||||
endif ()
|
endif ()
|
||||||
endif (FLTK_HAVE_CAIRO)
|
endif (FLTK_HAVE_CAIRO)
|
||||||
endif (WIN32)
|
endif (WIN32)
|
||||||
|
|||||||
+3
-10
@@ -644,14 +644,7 @@ if (USE_XFT)
|
|||||||
endif (USE_XFT)
|
endif (USE_XFT)
|
||||||
|
|
||||||
if (UNIX AND OPTION_USE_WAYLAND)
|
if (UNIX AND OPTION_USE_WAYLAND)
|
||||||
if (NOT (CMAKE_VERSION VERSION_LESS 3.4))
|
pkg_get_variable(PROTOCOLS wayland-protocols pkgdatadir)
|
||||||
pkg_get_variable(PROTOCOLS wayland-protocols pkgdatadir) # requires cmake 3.4
|
|
||||||
else()
|
|
||||||
execute_process(COMMAND pkg-config --variable=pkgdatadir wayland-protocols
|
|
||||||
OUTPUT_VARIABLE PROTOCOLS)
|
|
||||||
# strip trailing newline
|
|
||||||
string (REPLACE "\n" "" PROTOCOLS ${PROTOCOLS})
|
|
||||||
endif (NOT (CMAKE_VERSION VERSION_LESS 3.4))
|
|
||||||
# replace "//" with "/"
|
# replace "//" with "/"
|
||||||
string (REPLACE "//" "/" PROTOCOLS ${PROTOCOLS})
|
string (REPLACE "//" "/" PROTOCOLS ${PROTOCOLS})
|
||||||
if (NOT(EXISTS ${PROTOCOLS}/stable/xdg-shell/xdg-shell.xml))
|
if (NOT(EXISTS ${PROTOCOLS}/stable/xdg-shell/xdg-shell.xml))
|
||||||
@@ -737,7 +730,7 @@ FL_ADD_LIBRARY (fltk STATIC "${STATIC_FILES}")
|
|||||||
target_link_libraries (fltk ${OPTIONAL_LIBS})
|
target_link_libraries (fltk ${OPTIONAL_LIBS})
|
||||||
|
|
||||||
if (FLTK_HAVE_CAIRO)
|
if (FLTK_HAVE_CAIRO)
|
||||||
fl_target_link_directories (fltk PUBLIC "${PKG_CAIRO_LIBRARY_DIRS}")
|
target_link_directories (fltk PUBLIC ${PKG_CAIRO_LIBRARY_DIRS})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
#######################################################################
|
#######################################################################
|
||||||
@@ -785,7 +778,7 @@ if (OPTION_BUILD_SHARED_LIBS AND NOT MSVC)
|
|||||||
|
|
||||||
FL_ADD_LIBRARY (fltk SHARED "${SHARED_FILES}")
|
FL_ADD_LIBRARY (fltk SHARED "${SHARED_FILES}")
|
||||||
target_link_libraries (fltk_SHARED ${OPTIONAL_LIBS} ${PKG_CAIRO_LIBRARIES})
|
target_link_libraries (fltk_SHARED ${OPTIONAL_LIBS} ${PKG_CAIRO_LIBRARIES})
|
||||||
fl_target_link_directories (fltk_SHARED PUBLIC "${PKG_CAIRO_LIBRARY_DIRS}")
|
target_link_directories (fltk_SHARED PUBLIC ${PKG_CAIRO_LIBRARY_DIRS})
|
||||||
|
|
||||||
###################################################################
|
###################################################################
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user