diff --git a/proj/cmake/libcinder_target.cmake b/proj/cmake/libcinder_target.cmake index 66b5b1c932..dc617ee598 100755 --- a/proj/cmake/libcinder_target.cmake +++ b/proj/cmake/libcinder_target.cmake @@ -97,24 +97,14 @@ else() CHECK_CXX_COMPILER_FLAG( "-std=c++11" COMPILER_SUPPORTS_CXX11 ) endif() +# Prevent gcc and clang adding -std=gnu++XX instead of -stdc++XX +set_target_properties(cinder PROPERTIES CXX_EXTENSIONS OFF) if( COMPILER_SUPPORTS_CXX17 ) - if( NOT MSVC ) - set( CINDER_CXX_FLAGS "-std=c++17" ) - else() - set( CINDER_CXX_FLAGS "/std:c++17" ) - endif() + target_compile_features(cinder PUBLIC cxx_std_17) elseif( COMPILER_SUPPORTS_CXX14 ) - if( NOT MSVC ) - set( CINDER_CXX_FLAGS "-std=c++14" ) - else() - set( CINDER_CXX_FLAGS "/std:c++14") - endif() + target_compile_features(cinder PUBLIC cxx_std_14) elseif( COMPILER_SUPPORTS_CXX11 ) - if( NOT MSVC ) - set( CINDER_CXX_FLAGS "-std=c++11" ) - else() - set( CINDER_CXX_FLAGS "/std:c++11") - endif() + target_compile_features(cinder PUBLIC cxx_std_11) else() 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." ) endif()