@@ -72,57 +72,15 @@ elseif( CINDER_COCOA_TOUCH )
7272elseif ( CINDER_LINUX )
7373endif ()
7474
75- # Check compiler support for enabling c++11 or c++14 or c++17 .
75+ # Enforce the minimum C++ standard Cinder requires .
7676if ( CINDER_MSW AND MSVC )
77- if ( MSVC_VERSION LESS 1800 ) # Older version of Visual Studio
78- message ( FATAL_ERROR "Unsupported MSVC version: ${MSVC_VERSION} " )
79- elseif ( MSVC_VERSION LESS 1900 ) # Visual Studio 2013
80- set ( COMPILER_SUPPORTS_CXX11 true )
81- elseif ( MSVC_VERSION LESS 1920 ) # Visual Studio 2015
82- set ( COMPILER_SUPPORTS_CXX14 true )
83- set ( COMPILER_SUPPORTS_CXX11 true )
84- else () # Visual Studio 2019
85- set ( COMPILER_SUPPORTS_CXX17 true )
86- set ( COMPILER_SUPPORTS_CXX14 true )
87- set ( COMPILER_SUPPORTS_CXX11 true )
77+ if ( MSVC_VERSION LESS 1920 )
78+ message ( FATAL_ERROR "Cinder requires Visual Studio 2019 (MSVC 19.20) or newer." )
8879 endif ()
89- elseif ( CINDER_ANDROID )
90- # Assume true for Android since compiler is Clang 3.8 at minimum
91- set ( COMPILER_SUPPORTS_CXX14 true )
92- set ( COMPILER_SUPPORTS_CXX11 true )
93- else ()
94- include ( CheckCXXCompilerFlag )
95- CHECK_CXX_COMPILER_FLAG( "-std=c++17" COMPILER_SUPPORTS_CXX17 )
96- CHECK_CXX_COMPILER_FLAG( "-std=c++14" COMPILER_SUPPORTS_CXX14 )
97- CHECK_CXX_COMPILER_FLAG( "-std=c++11" COMPILER_SUPPORTS_CXX11 )
9880endif ()
9981
100- if ( COMPILER_SUPPORTS_CXX17 )
101- if ( NOT MSVC )
102- set ( CINDER_CXX_FLAGS "-std=c++17" )
103- else ()
104- set ( CINDER_CXX_FLAGS "/std:c++17" )
105- endif ()
106- elseif ( COMPILER_SUPPORTS_CXX14 )
107- if ( NOT MSVC )
108- set ( CINDER_CXX_FLAGS "-std=c++14" )
109- else ()
110- set ( CINDER_CXX_FLAGS "/std:c++14" )
111- endif ()
112- elseif ( COMPILER_SUPPORTS_CXX11 )
113- if ( NOT MSVC )
114- set ( CINDER_CXX_FLAGS "-std=c++11" )
115- else ()
116- set ( CINDER_CXX_FLAGS "/std:c++11" )
117- endif ()
118- else ()
119- message ( FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} has neither C++11 or C++14 or C++17 support. Please use a different C++ compiler." )
120- endif ()
121-
122- # TODO: it would be nice to the following, but we can't until min required cmake is 3.3
123- #target_compile_options( cinder PUBLIC $<$<COMPILE_LANGUAGE:CXX>:${CINDER_CXX_FLAGS}> )
124- set ( CMAKE_CXX_FLAGS "${CINDER_CXX_FLAGS} ${CMAKE_CXX_FLAGS} " )
125- target_compile_options ( cinder INTERFACE ${CINDER_CXX_FLAGS} )
82+ target_compile_features ( cinder PUBLIC cxx_std_17 )
83+ set_property ( TARGET cinder PROPERTY CXX_EXTENSIONS OFF )
12684
12785# This file will contain all dependencies, includes, definition, compiler flags and so on..
12886export ( TARGETS cinder FILE ${PROJECT_BINARY_DIR} /${CINDER_LIB_DIRECTORY} /cinderTargets.cmake )
0 commit comments