CMake: Fix image libraries build if fallback is used
The CMake instructions would use the wrong image libs (png, jpeg, zlib) if the fallback was active (OPTION_USE_SYSTEM_XXX) was true but the header files were not present. This had already been fixed for jpeg but not for the other two libs. This commit rearranges the logic for all three libs. Add information about builtin or system libraries to config summary.
This commit is contained in:
parent
29d9e31c51
commit
ec98dc113f
@ -2,7 +2,7 @@
|
||||
# Main CMakeLists.txt to build the FLTK project using CMake (www.cmake.org)
|
||||
# Originally written by Michael Surette
|
||||
#
|
||||
# Copyright 1998-2021 by Bill Spitzak and others.
|
||||
# Copyright 1998-2022 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
|
||||
@ -19,12 +19,6 @@
|
||||
# set CMake minimum version (must be before `project()`
|
||||
#######################################################################
|
||||
|
||||
# Note: previous (1.3.5) minimum version
|
||||
# cmake_minimum_required (VERSION 2.6.3)
|
||||
|
||||
# Note: minimum CMake version required by GNUInstallDirs
|
||||
# cmake_minimum_required (VERSION 2.8.4)
|
||||
|
||||
# Minimum CMake version required by FLTK 1.4 (06/2020, work in progress)
|
||||
cmake_minimum_required (VERSION 3.2.3 FATAL_ERROR)
|
||||
|
||||
@ -225,5 +219,23 @@ else ()
|
||||
message (STATUS "Example programs will not be built (set FLTK_BUILD_EXAMPLES=ON to build)")
|
||||
endif ()
|
||||
|
||||
if (FLTK_USE_BUILTIN_JPEG)
|
||||
message (STATUS "Image Libraries: JPEG = Builtin")
|
||||
else ()
|
||||
message (STATUS "Image Libraries: JPEG = System")
|
||||
endif ()
|
||||
|
||||
if (FLTK_USE_BUILTIN_PNG)
|
||||
message (STATUS " PNG = Builtin")
|
||||
else ()
|
||||
message (STATUS " PNG = System")
|
||||
endif ()
|
||||
|
||||
if (FLTK_USE_BUILTIN_ZLIB)
|
||||
message (STATUS " ZLIB = Builtin")
|
||||
else ()
|
||||
message (STATUS " ZLIB = System")
|
||||
endif ()
|
||||
|
||||
message ("")
|
||||
message (STATUS "End of Configuration Summary --\n")
|
||||
|
@ -511,23 +511,23 @@ target_link_libraries (fltk_forms fltk)
|
||||
FL_ADD_LIBRARY (fltk_images STATIC "${IMGCPPFILES}")
|
||||
target_link_libraries (fltk_images fltk)
|
||||
|
||||
if (NOT FLTK_USE_BUILTIN_JPEG)
|
||||
target_link_libraries (fltk_images ${FLTK_JPEG_LIBRARIES})
|
||||
else()
|
||||
if (FLTK_USE_BUILTIN_JPEG)
|
||||
target_link_libraries (fltk_images fltk_jpeg)
|
||||
endif (NOT FLTK_USE_BUILTIN_JPEG)
|
||||
|
||||
if (OPTION_USE_SYSTEM_ZLIB)
|
||||
target_link_libraries (fltk_images ${FLTK_ZLIB_LIBRARIES})
|
||||
else()
|
||||
target_link_libraries (fltk_images ${FLTK_JPEG_LIBRARIES})
|
||||
endif ()
|
||||
|
||||
if (FLTK_USE_BUILTIN_ZLIB)
|
||||
target_link_libraries (fltk_images fltk_z)
|
||||
endif (OPTION_USE_SYSTEM_ZLIB)
|
||||
|
||||
if (OPTION_USE_SYSTEM_LIBPNG)
|
||||
target_link_libraries (fltk_images ${FLTK_PNG_LIBRARIES})
|
||||
else()
|
||||
target_link_libraries (fltk_images ${FLTK_ZLIB_LIBRARIES})
|
||||
endif ()
|
||||
|
||||
if (FLTK_USE_BUILTIN_PNG)
|
||||
target_link_libraries (fltk_images fltk_png)
|
||||
endif (OPTION_USE_SYSTEM_LIBPNG)
|
||||
else()
|
||||
target_link_libraries (fltk_images ${FLTK_PNG_LIBRARIES})
|
||||
endif ()
|
||||
|
||||
#######################################################################
|
||||
|
||||
@ -557,23 +557,23 @@ if (OPTION_BUILD_SHARED_LIBS AND NOT MSVC)
|
||||
FL_ADD_LIBRARY (fltk_images SHARED "${IMGCPPFILES}")
|
||||
target_link_libraries (fltk_images_SHARED fltk_SHARED)
|
||||
|
||||
if (NOT FLTK_USE_BUILTIN_JPEG)
|
||||
target_link_libraries (fltk_images_SHARED ${FLTK_JPEG_LIBRARIES})
|
||||
else()
|
||||
if (FLTK_USE_BUILTIN_JPEG)
|
||||
target_link_libraries (fltk_images_SHARED fltk_jpeg_SHARED)
|
||||
endif (NOT FLTK_USE_BUILTIN_JPEG)
|
||||
|
||||
if (OPTION_USE_SYSTEM_LIBPNG)
|
||||
target_link_libraries (fltk_images_SHARED ${FLTK_PNG_LIBRARIES})
|
||||
else()
|
||||
target_link_libraries (fltk_images_SHARED ${FLTK_JPEG_LIBRARIES})
|
||||
endif ()
|
||||
|
||||
if (FLTK_USE_BUILTIN_PNG)
|
||||
target_link_libraries (fltk_images_SHARED fltk_png_SHARED)
|
||||
endif (OPTION_USE_SYSTEM_LIBPNG)
|
||||
|
||||
if (OPTION_USE_SYSTEM_ZLIB)
|
||||
target_link_libraries (fltk_images_SHARED ${FLTK_ZLIB_LIBRARIES})
|
||||
else()
|
||||
target_link_libraries (fltk_images_SHARED ${FLTK_PNG_LIBRARIES})
|
||||
endif ()
|
||||
|
||||
if (FLTK_USE_BUILTIN_ZLIB)
|
||||
target_link_libraries (fltk_images_SHARED fltk_z_SHARED)
|
||||
endif (OPTION_USE_SYSTEM_ZLIB)
|
||||
else()
|
||||
target_link_libraries (fltk_images_SHARED ${FLTK_ZLIB_LIBRARIES})
|
||||
endif ()
|
||||
|
||||
###################################################################
|
||||
|
||||
@ -603,23 +603,23 @@ if (OPTION_BUILD_SHARED_LIBS AND MSVC)
|
||||
FL_ADD_LIBRARY (fltk SHARED "${SOURCES}")
|
||||
target_link_libraries (fltk_SHARED ${OPTIONAL_LIBS})
|
||||
|
||||
if (NOT FLTK_USE_BUILTIN_JPEG)
|
||||
target_link_libraries (fltk_SHARED ${FLTK_JPEG_LIBRARIES})
|
||||
else()
|
||||
if (FLTK_USE_BUILTIN_JPEG)
|
||||
target_link_libraries (fltk_SHARED fltk_jpeg_SHARED)
|
||||
endif (NOT FLTK_USE_BUILTIN_JPEG)
|
||||
|
||||
if (OPTION_USE_SYSTEM_LIBPNG)
|
||||
target_link_libraries (fltk_SHARED ${FLTK_PNG_LIBRARIES})
|
||||
else()
|
||||
target_link_libraries (fltk_SHARED ${FLTK_JPEG_LIBRARIES})
|
||||
endif ()
|
||||
|
||||
if (FLTK_USE_BUILTIN_PNG)
|
||||
target_link_libraries (fltk_SHARED fltk_png_SHARED)
|
||||
endif (OPTION_USE_SYSTEM_LIBPNG)
|
||||
|
||||
if (OPTION_USE_SYSTEM_ZLIB)
|
||||
target_link_libraries (fltk_SHARED ${FLTK_ZLIB_LIBRARIES})
|
||||
else()
|
||||
target_link_libraries (fltk_SHARED ${FLTK_PNG_LIBRARIES})
|
||||
endif ()
|
||||
|
||||
if (FLTK_USE_BUILTIN_ZLIB)
|
||||
target_link_libraries (fltk_SHARED fltk_z_SHARED)
|
||||
endif (OPTION_USE_SYSTEM_ZLIB)
|
||||
else()
|
||||
target_link_libraries (fltk_SHARED ${FLTK_ZLIB_LIBRARIES})
|
||||
endif ()
|
||||
|
||||
if (OPENGL_FOUND)
|
||||
target_link_libraries (fltk_SHARED ${OPENGL_LIBRARIES})
|
||||
|
Loading…
Reference in New Issue
Block a user