diff options
| author | Albrecht Schlosser <albrechts.fltk@online.de> | 2025-03-07 15:17:56 +0100 |
|---|---|---|
| committer | Albrecht Schlosser <albrechts.fltk@online.de> | 2025-03-07 15:17:56 +0100 |
| commit | 42a04c064d4b31c3a85210311f3ada163c406a25 (patch) | |
| tree | 276815d21d47621fda53cdf5cce0df9f300d2598 /CMakeLists.txt | |
| parent | daf20b86af28bc7db061135fa2bd14e97fef9f20 (diff) | |
Improve setting minimal compiler standard (C++11)
... so the user can override all settings.
This may need more tweaks in the future.
Diffstat (limited to 'CMakeLists.txt')
| -rw-r--r-- | CMakeLists.txt | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index da59bcd46..97b57f714 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,8 +35,28 @@ cmake_minimum_required(VERSION 3.15.0 FATAL_ERROR) project(FLTK VERSION 1.5.0) -set(CMAKE_CXX_STANDARD 11) -set(CMAKE_CXX_STANDARD_REQUIRED TRUE) +####################################################################### +# set the required C++ standard -- may be overridden by the user +####################################################################### + +# Note 1: We don't check if the user sets a standard older than C++11, +# but if they do, the build will fail. +# Note 2: For optimal portability we disable compiler specific +# extensions, but this can also be overridden by the user. +# Note 3: This code is experimental and intentionally undocumented. +# It may be removed or changed w/o notice. + +if(NOT DEFINED CMAKE_CXX_STANDARD) + set(CMAKE_CXX_STANDARD 11) +endif() + +if(NOT DEFINED CMAKE_CXX_STANDARD_REQUIRED) + set(CMAKE_CXX_STANDARD_REQUIRED TRUE) +endif() + +if(NOT DEFINED CMAKE_CXX_EXTENSIONS) + set(CMAKE_CXX_EXTENSIONS OFF) +endif() ####################################################################### # include macro and function definitions for general usage |
