summaryrefslogtreecommitdiff
path: root/CMake
diff options
context:
space:
mode:
authorAlbrecht Schlosser <albrechts.fltk@online.de>2025-03-13 17:58:26 +0100
committerAlbrecht Schlosser <albrechts.fltk@online.de>2025-03-13 18:46:02 +0100
commitc18c39071a4dc0ace4fc5e23c61f3aa7ddd8c679 (patch)
tree41c0ad66cdd7481888572af02a1d54d0f2890312 /CMake
parent2d9cf4d83ec9824b978925fa6c9df8ace954d88b (diff)
CMake: improve setting C++ standard and configuration summary
CMake/fl_add_library.cmake: set target_compile_features(.. cxx_std_NN) which is inherited by consumers of the library. This prevents CMake user projects from failing if they would otherwise compile with an older C++ standard. CMake/fl_debug_var.cmake: add INTERFACE_COMPILE_FEATURES to fl_debug_target() CMake/fl_summary.cmake: update summary format for longer variable names CMakeLists.txt: - check CMAKE_CXX_STANDARD given by the user (commandline) and set C++ standard related CMake variables in the CMake cache. The latter is experimental: setting in the cache may be reverted. - add C++ standard related info to configure summary.
Diffstat (limited to 'CMake')
-rw-r--r--CMake/fl_add_library.cmake7
-rw-r--r--CMake/fl_debug_var.cmake1
-rw-r--r--CMake/fl_summary.cmake2
3 files changed, 7 insertions, 3 deletions
diff --git a/CMake/fl_add_library.cmake b/CMake/fl_add_library.cmake
index c4e5f91c4..8806de191 100644
--- a/CMake/fl_add_library.cmake
+++ b/CMake/fl_add_library.cmake
@@ -2,7 +2,7 @@
# Macro used by the CMake build system for the Fast Light Tool Kit (FLTK).
# Originally written by Michael Surette
#
-# Copyright 1998-2024 by Bill Spitzak and others.
+# Copyright 1998-2025 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
@@ -98,7 +98,10 @@ function(fl_add_library LIBNAME LIBTYPE SOURCES)
target_compile_definitions(${TARGET_NAME} PRIVATE "FL_LIBRARY")
- # Set PUBLIC include and linker directories
+ # Set PUBLIC properties, e.g. C++ standard and include and linker directories.
+ # These properties are inherited by consumers of the libraries
+
+ target_compile_features(${TARGET_NAME} PUBLIC "cxx_std_${CMAKE_CXX_STANDARD}")
if(0) # DEBUG
message(STATUS "fl_add_library and alias : fltk::${alias_name} ALIAS ${TARGET_NAME}")
diff --git a/CMake/fl_debug_var.cmake b/CMake/fl_debug_var.cmake
index 1c33a9313..815e97dc1 100644
--- a/CMake/fl_debug_var.cmake
+++ b/CMake/fl_debug_var.cmake
@@ -123,6 +123,7 @@ function(fl_debug_target name)
LINK_LIBRARIES
COMPILE_DEFINITIONS
INTERFACE_COMPILE_DEFINITIONS
+ INTERFACE_COMPILE_FEATURES
INTERFACE_INCLUDE_DIRECTORIES
INTERFACE_LINK_DIRECTORIES
INTERFACE_LINK_LIBRARIES)
diff --git a/CMake/fl_summary.cmake b/CMake/fl_summary.cmake
index 311a0db63..2026e096e 100644
--- a/CMake/fl_summary.cmake
+++ b/CMake/fl_summary.cmake
@@ -30,7 +30,7 @@ include(${CMAKE_CURRENT_LIST_DIR}/fl_debug_var.cmake)
########################################################################
macro(fl_summary title value)
- fl_expand_name(label "${title}" 24)
+ fl_expand_name(label "${title}" 30)
message(STATUS "${label} ${value}")
endmacro(fl_summary title value)