CMake: improve formatting, remove debug statements

This commit is contained in:
Albrecht Schlosser 2024-02-13 14:47:28 +01:00
parent bddcecd28a
commit 0771bc6cee
8 changed files with 64 additions and 67 deletions

View File

@ -144,7 +144,6 @@ function(fl_add_library LIBNAME LIBTYPE SOURCES)
target_include_directories(${TARGET_NAME} PRIVATE
$<BUILD_INTERFACE:${FLTK_BUILD_INCLUDE_DIRECTORIES}>
)
fl_debug_target(${TARGET_NAME})
endif()
@ -160,8 +159,8 @@ function(fl_add_library LIBNAME LIBTYPE SOURCES)
# we must link fltk with cairo if Cairo or Wayland is enabled (or both)
if(FLTK_HAVE_CAIRO OR FLTK_USE_CAIRO)
target_include_directories(${TARGET_NAME} PUBLIC ${PKG_CAIRO_INCLUDE_DIRS})
target_link_directories(${TARGET_NAME} PUBLIC ${PKG_CAIRO_LIBRARY_DIRS})
target_link_libraries(${TARGET_NAME} PUBLIC ${PKG_CAIRO_LIBRARIES})
target_link_directories (${TARGET_NAME} PUBLIC ${PKG_CAIRO_LIBRARY_DIRS})
target_link_libraries (${TARGET_NAME} PUBLIC ${PKG_CAIRO_LIBRARIES})
endif()
endif(LIBNAME STREQUAL "fltk")
@ -222,8 +221,6 @@ function(fl_add_library LIBNAME LIBTYPE SOURCES)
if(MSVC)
if(FLTK_OPTION_LARGE_FILE)
# fl_debug_var(FLTK_OPTION_LARGE_FILE)
# fl_debug_var(TARGET_NAME)
set_target_properties(${TARGET_NAME} PROPERTIES
LINK_FLAGS /LARGEADDRESSAWARE
)

View File

@ -47,7 +47,7 @@
#
################################################################################
function (fl_create_example NAME SOURCES LIBRARIES)
function(fl_create_example NAME SOURCES LIBRARIES)
set(srcs) # source files
set(flsrcs) # fluid source (.fl) files
@ -184,4 +184,4 @@ function (fl_create_example NAME SOURCES LIBRARIES)
)
endif()
endfunction ()
endfunction()

View File

@ -28,7 +28,7 @@
# Example for package "cairo":
#
# pkg_check_modules (CAIRO cairo)
# fl_debug_pkg (CAIRO cairo)
# fl_debug_pkg(CAIRO cairo)
#
# The first command searches for pkg 'cairo' and stores the results
# in CMake variables with prefix 'CAIRO_'.
@ -38,7 +38,7 @@
#
#######################################################################
macro (fl_debug_pkg PREFIX NAME)
macro(fl_debug_pkg PREFIX NAME)
message("")
message(STATUS "Results of pkg_check_modules(${PREFIX}, ${NAME}):")
fl_debug_var(${PREFIX}_FOUND)
@ -66,4 +66,4 @@ macro (fl_debug_pkg PREFIX NAME)
endif()
message("")
endmacro (fl_debug_pkg)
endmacro(fl_debug_pkg)

View File

@ -35,7 +35,7 @@
#
#######################################################################
function (fl_expand_name out in min_len)
function(fl_expand_name out in min_len)
string(LENGTH "${in}" len)
if(len LESS min_len)
set(spaces " ")
@ -44,7 +44,7 @@ function (fl_expand_name out in min_len)
string(SUBSTRING "${temp}" 0 ${min_len} temp)
set(${out} "${temp}" PARENT_SCOPE)
endif()
endfunction (fl_expand_name)
endfunction(fl_expand_name)
#######################################################################
# fl_debug_var - a function to output debugging info
@ -64,11 +64,11 @@ endfunction (fl_expand_name)
#
#######################################################################
function (fl_debug_var name)
function(fl_debug_var name)
set(var "${name}")
fl_expand_name(var "${name}" 40)
message(STATUS "${var} = '${${name}}'")
endfunction (fl_debug_var)
endfunction(fl_debug_var)
#######################################################################
@ -90,8 +90,8 @@ endfunction (fl_debug_var)
#
#######################################################################
function (fl_debug_target name)
message(STATUS "+++ fl_debug_target (${name})")
function(fl_debug_target name)
message(STATUS "+++ fl_debug_target(${name})")
set(var "${name}")
fl_expand_name(var "${name}" 40)
if(TARGET ${name})
@ -101,7 +101,7 @@ function (fl_debug_target name)
INTERFACE_INCLUDE_DIRECTORIES
INTERFACE_LINK_DIRECTORIES
INTERFACE_LINK_LIBRARIES)
get_target_property (${prop} ${name} ${prop})
get_target_property(${prop} ${name} ${prop})
if(NOT ${prop})
set(${prop} "")
endif()
@ -112,4 +112,4 @@ function (fl_debug_target name)
endif()
message(STATUS "")
endfunction (fl_debug_target)
endfunction(fl_debug_target)

View File

@ -14,20 +14,20 @@
# https://www.fltk.org/bugs.php
# On UNIX create backward compatibility symlinks
if (NOT EXISTS $ENV{DESTDIR}@PREFIX_INCLUDE@/Fl)
if(NOT EXISTS $ENV{DESTDIR}@PREFIX_INCLUDE@/Fl)
EXECUTE_PROCESS(
COMMAND ln -s FL Fl
WORKING_DIRECTORY $ENV{DESTDIR}@PREFIX_INCLUDE@
)
endif (NOT EXISTS $ENV{DESTDIR}@PREFIX_INCLUDE@/Fl)
endif(NOT EXISTS $ENV{DESTDIR}@PREFIX_INCLUDE@/Fl)
file (GLOB FLTK_HEADER_FILES $ENV{DESTDIR}@PREFIX_INCLUDE@/FL/*.H)
file(GLOB FLTK_HEADER_FILES $ENV{DESTDIR}@PREFIX_INCLUDE@/FL/*.H)
foreach(file ${FLTK_HEADER_FILES})
GET_FILENAME_COMPONENT(nameWE ${file} NAME_WE)
if (NOT EXISTS $ENV{DESTDIR}@PREFIX_INCLUDE@/FL/${nameWE}.h)
if(NOT EXISTS $ENV{DESTDIR}@PREFIX_INCLUDE@/FL/${nameWE}.h)
EXECUTE_PROCESS(
COMMAND ln -s ${nameWE}.H ${nameWE}.h
WORKING_DIRECTORY $ENV{DESTDIR}@PREFIX_INCLUDE@/FL
)
endif (NOT EXISTS $ENV{DESTDIR}@PREFIX_INCLUDE@/FL/${nameWE}.h)
endif(NOT EXISTS $ENV{DESTDIR}@PREFIX_INCLUDE@/FL/${nameWE}.h)
endforeach(file)

View File

@ -110,7 +110,7 @@ if(UNIX OR MSYS OR MINGW)
DESTINATION ${FLTK_MANDIR}/man${LEVEL}
RENAME ${FILE}.${LEVEL}
)
endmacro (INSTALL_MAN FILE LEVEL)
endmacro(INSTALL_MAN FILE LEVEL)
if(FLTK_BUILD_FLUID)
INSTALL_MAN (fluid 1)

View File

@ -590,7 +590,7 @@ set(FLTK_USE_GL FALSE)
if(HAVE_GL)
option(FLTK_BUILD_GL "use OpenGL and build fltk_gl library" ON)
if (FLTK_BUILD_GL)
if(FLTK_BUILD_GL)
set(FLTK_USE_GL TRUE)
endif()
endif()

View File

@ -28,12 +28,12 @@ set(CMAKE_REQUIRED_QUIET 1)
include(CheckIncludeFiles)
macro (fl_find_header VAR HEADER)
macro(fl_find_header VAR HEADER)
check_include_files("${HEADER}" ${VAR})
if(NOT CMAKE_REQUIRED_QUIET)
fl_debug_var(${VAR})
endif(NOT CMAKE_REQUIRED_QUIET)
endmacro (fl_find_header)
endmacro(fl_find_header)
#######################################################################
# Include FindPkgConfig for later use of pkg-config
@ -56,23 +56,23 @@ endif(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "FreeBSD")
# fl_debug_var(CMAKE_HOST_SYSTEM_NAME)
# fl_debug_var(CMAKE_REQUIRED_INCLUDES)
fl_find_header (HAVE_ALSA_ASOUNDLIB_H alsa/asoundlib.h)
fl_find_header (HAVE_DLFCN_H dlfcn.h)
fl_find_header (HAVE_GL_GLU_H GL/glu.h)
fl_find_header (HAVE_LOCALE_H locale.h)
fl_find_header (HAVE_OPENGL_GLU_H OpenGL/glu.h)
fl_find_header (HAVE_STDIO_H stdio.h)
fl_find_header (HAVE_STRINGS_H strings.h)
fl_find_header (HAVE_SYS_SELECT_H sys/select.h)
fl_find_header (HAVE_SYS_STDTYPES_H sys/stdtypes.h)
fl_find_header(HAVE_ALSA_ASOUNDLIB_H alsa/asoundlib.h)
fl_find_header(HAVE_DLFCN_H dlfcn.h)
fl_find_header(HAVE_GL_GLU_H GL/glu.h)
fl_find_header(HAVE_LOCALE_H locale.h)
fl_find_header(HAVE_OPENGL_GLU_H OpenGL/glu.h)
fl_find_header(HAVE_STDIO_H stdio.h)
fl_find_header(HAVE_STRINGS_H strings.h)
fl_find_header(HAVE_SYS_SELECT_H sys/select.h)
fl_find_header(HAVE_SYS_STDTYPES_H sys/stdtypes.h)
fl_find_header (HAVE_X11_XREGION_H "X11/Xlib.h;X11/Xregion.h")
fl_find_header(HAVE_X11_XREGION_H "X11/Xlib.h;X11/Xregion.h")
if(WIN32 AND NOT CYGWIN)
# we don't use pthreads on Windows (except for Cygwin, see options.cmake)
set(HAVE_PTHREAD_H 0)
else()
fl_find_header (HAVE_PTHREAD_H pthread.h)
fl_find_header(HAVE_PTHREAD_H pthread.h)
endif(WIN32 AND NOT CYGWIN)
# Do we have PTHREAD_MUTEX_RECURSIVE ?
@ -119,27 +119,27 @@ endif(MSVC)
# Note: we don't check if it really defines 'DIR', but we stop processing
# once we found the first suitable header file.
fl_find_header (HAVE_DIRENT_H dirent.h)
fl_find_header(HAVE_DIRENT_H dirent.h)
if(NOT HAVE_DIRENT_H)
fl_find_header (HAVE_SYS_NDIR_H sys/ndir.h)
fl_find_header(HAVE_SYS_NDIR_H sys/ndir.h)
if(NOT HAVE_SYS_NDIR_H)
fl_find_header (HAVE_SYS_DIR_H sys/dir.h)
fl_find_header(HAVE_SYS_DIR_H sys/dir.h)
if(NOT HAVE_SYS_DIR_H)
fl_find_header (HAVE_NDIR_H ndir.h)
fl_find_header(HAVE_NDIR_H ndir.h)
endif(NOT HAVE_SYS_DIR_H)
endif(NOT HAVE_SYS_NDIR_H)
endif(NOT HAVE_DIRENT_H)
mark_as_advanced (HAVE_ALSA_ASOUNDLIB_H HAVE_DIRENT_H HAVE_DLFCN_H)
mark_as_advanced (HAVE_GL_GLU_H)
mark_as_advanced (HAVE_OPENGL_GLU_H)
mark_as_advanced (HAVE_LOCALE_H HAVE_NDIR_H)
mark_as_advanced (HAVE_PTHREAD_H HAVE_PTHREAD_MUTEX_RECURSIVE)
mark_as_advanced (HAVE_STDIO_H HAVE_STRINGS_H HAVE_SYS_DIR_H)
mark_as_advanced (HAVE_SYS_NDIR_H HAVE_SYS_SELECT_H)
mark_as_advanced (HAVE_SYS_STDTYPES_H)
mark_as_advanced (HAVE_X11_XREGION_H)
mark_as_advanced(HAVE_ALSA_ASOUNDLIB_H HAVE_DIRENT_H HAVE_DLFCN_H)
mark_as_advanced(HAVE_GL_GLU_H)
mark_as_advanced(HAVE_OPENGL_GLU_H)
mark_as_advanced(HAVE_LOCALE_H HAVE_NDIR_H)
mark_as_advanced(HAVE_PTHREAD_H HAVE_PTHREAD_MUTEX_RECURSIVE)
mark_as_advanced(HAVE_STDIO_H HAVE_STRINGS_H HAVE_SYS_DIR_H)
mark_as_advanced(HAVE_SYS_NDIR_H HAVE_SYS_SELECT_H)
mark_as_advanced(HAVE_SYS_STDTYPES_H)
mark_as_advanced(HAVE_X11_XREGION_H)
#----------------------------------------------------------------------
# The following code is used to find the include path for freetype
@ -147,32 +147,32 @@ mark_as_advanced (HAVE_X11_XREGION_H)
# where to find freetype headers
find_path (FREETYPE_PATH freetype.h PATH_SUFFIXES freetype2)
find_path (FREETYPE_PATH freetype/freetype.h PATH_SUFFIXES freetype2)
find_path(FREETYPE_PATH freetype.h PATH_SUFFIXES freetype2)
find_path(FREETYPE_PATH freetype/freetype.h PATH_SUFFIXES freetype2)
if(FREETYPE_PATH)
list(APPEND FLTK_BUILD_INCLUDE_DIRECTORIES ${FREETYPE_PATH})
endif(FREETYPE_PATH)
mark_as_advanced (FREETYPE_PATH)
mark_as_advanced(FREETYPE_PATH)
#######################################################################
# libraries
find_library (LIB_dl dl)
find_library(LIB_dl dl)
if((NOT APPLE) OR FLTK_BACKEND_X11)
find_library (LIB_fontconfig fontconfig)
find_library(LIB_fontconfig fontconfig)
endif((NOT APPLE) OR FLTK_BACKEND_X11)
find_library (LIB_freetype freetype)
find_library (LIB_GL GL)
find_library (LIB_MesaGL MesaGL)
find_library (LIB_GLEW NAMES GLEW glew32)
find_library (LIB_jpeg jpeg)
find_library (LIB_png png)
find_library (LIB_zlib z)
find_library(LIB_freetype freetype)
find_library(LIB_GL GL)
find_library(LIB_MesaGL MesaGL)
find_library(LIB_GLEW NAMES GLEW glew32)
find_library(LIB_jpeg jpeg)
find_library(LIB_png png)
find_library(LIB_zlib z)
mark_as_advanced (LIB_dl LIB_fontconfig LIB_freetype)
mark_as_advanced (LIB_GL LIB_MesaGL LIB_GLEW)
mark_as_advanced (LIB_jpeg LIB_png LIB_zlib)
mark_as_advanced(LIB_dl LIB_fontconfig LIB_freetype)
mark_as_advanced(LIB_GL LIB_MesaGL LIB_GLEW)
mark_as_advanced(LIB_jpeg LIB_png LIB_zlib)
#######################################################################
# functions
@ -232,7 +232,7 @@ if(HAVE_SCANDIR AND NOT HAVE_SCANDIR_POSIX)
set(HAVE_SCANDIR_POSIX HAVE_SCANDIR_POSIX-NOTFOUND)
endif(V)
endif(HAVE_SCANDIR AND NOT HAVE_SCANDIR_POSIX)
mark_as_advanced (HAVE_SCANDIR_POSIX)
mark_as_advanced(HAVE_SCANDIR_POSIX)
# restore CMAKE_REQUIRED_LIBRARIES (is this really necessary ?)
if(DEFINED SAVED_REQUIRED_LIBRARIES)