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:
Albrecht Schlosser 2023-11-15 21:30:12 +01:00
parent ed7c2f1464
commit 6f021d4830
8 changed files with 25 additions and 50 deletions

View File

@ -1,7 +1,7 @@
#
# 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
# 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.
# Functions should be preferred (rather than macros) because functions
# 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
@ -62,13 +68,3 @@
# 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()

View File

@ -125,7 +125,7 @@ function (CREATE_EXAMPLE NAME SOURCES LIBRARIES)
endif ()
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 ()
if (USE_GDIPLUS) # can only be true on Windows

View File

@ -536,7 +536,7 @@ if (OPTION_USE_GL)
unset(HAVE_GL_GLU_H CACHE)
find_file (HAVE_GL_GLU_H GL/glu.h PATHS ${X11_INCLUDE_DIR})
else()
include (FindOpenGL)
find_package(OpenGL)
if (APPLE)
set (HAVE_GL_GLU_H ${HAVE_OPENGL_GLU_H})
endif (APPLE)

View File

@ -82,12 +82,10 @@ include(TestBigEndian)
TEST_BIG_ENDIAN(WORDS_BIGENDIAN)
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
# CMake configuration changes without asking the user
set (CMAKE_XCODE_GENERATE_SCHEME 1)
endif()
endif()
if (APPLE)
set (HAVE_STRCASECMP 1)

View File

@ -25,23 +25,9 @@
# at least CMake 3.12.0
# Note 2: Used in fluid since 05/2023,
# 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
#######################################################################
# 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)
cmake_minimum_required (VERSION 3.15.0 FATAL_ERROR)
#######################################################################
# 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_pkg.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)
fl_debug_var (FLTK_VERSION_MAJOR)

View File

@ -53,7 +53,7 @@ endif ()
# we must link fltk-optons with cairo if option CAIRO is enabled
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)
if (USE_GDIPLUS) # can only be true on Windows
@ -71,7 +71,7 @@ if (WIN32)
add_executable (fltk-options-cmd ${CPPFILES} ${HEADERFILES})
target_link_libraries (fltk-options-cmd ${FLTK_OPTIONS_LIBS})
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 ()

View File

@ -168,7 +168,7 @@ endif ()
if (FLTK_HAVE_CAIRO)
target_include_directories (fluid PRIVATE ${PKG_CAIRO_INCLUDE_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 (FLTK_HAVE_CAIRO)
@ -191,7 +191,7 @@ if (WIN32)
if (FLTK_HAVE_CAIRO)
target_include_directories (fluid-cmd PRIVATE ${PKG_CAIRO_INCLUDE_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 (FLTK_HAVE_CAIRO)
endif (WIN32)

View File

@ -644,14 +644,7 @@ if (USE_XFT)
endif (USE_XFT)
if (UNIX AND OPTION_USE_WAYLAND)
if (NOT (CMAKE_VERSION VERSION_LESS 3.4))
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))
pkg_get_variable(PROTOCOLS wayland-protocols pkgdatadir)
# replace "//" with "/"
string (REPLACE "//" "/" PROTOCOLS ${PROTOCOLS})
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})
if (FLTK_HAVE_CAIRO)
fl_target_link_directories (fltk PUBLIC "${PKG_CAIRO_LIBRARY_DIRS}")
target_link_directories (fltk PUBLIC ${PKG_CAIRO_LIBRARY_DIRS})
endif()
#######################################################################
@ -785,7 +778,7 @@ if (OPTION_BUILD_SHARED_LIBS AND NOT MSVC)
FL_ADD_LIBRARY (fltk SHARED "${SHARED_FILES}")
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})
###################################################################