changeset 6080:a2834b7f4027

setting CMAKE_CXX_STANDARD to 11 for macOS
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 04 Apr 2025 18:22:01 +0200
parents 4a03333b69f6
children 36fed5f5dae9
files OrthancFramework/Resources/CMake/Compiler.cmake
diffstat 1 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancFramework/Resources/CMake/Compiler.cmake	Fri Apr 04 16:52:21 2025 +0200
+++ b/OrthancFramework/Resources/CMake/Compiler.cmake	Fri Apr 04 18:22:01 2025 +0200
@@ -22,6 +22,16 @@
 
 # This file sets all the compiler-related flags
 
+if (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
+  # Since Orthanc 1.12.7 that allows CMake 4.0, builds for macOS
+  # require the C++ standard to be explicitly set to C++11. Do *not*
+  # do this on GNU/Linux, as third-party system libraries could have
+  # been compiled with higher versions of the C++ standard.
+  set(CMAKE_CXX_STANDARD 11)
+  set(CMAKE_CXX_STANDARD_REQUIRED ON)
+  set(CMAKE_CXX_EXTENSIONS OFF)
+endif()
+
 
 # Save the current compiler flags to the cache every time cmake configures the project
 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}" CACHE STRING "compiler flags" FORCE)