]> git.seodisparate.com - EntityComponentMetaSystem/commitdiff
Fix C++14 requirement in CMakeLists.txt
authorStephen Seo <seo.disparate@gmail.com>
Mon, 21 May 2018 10:23:25 +0000 (19:23 +0900)
committerStephen Seo <seo.disparate@gmail.com>
Mon, 21 May 2018 10:24:49 +0000 (19:24 +0900)
src/CMakeLists.txt

index 62c605653a8a164c1a8373a3e03b081b1e619cbb..56e7b471deedc61c7c8eef90997ea8d6e8907e40 100644 (file)
@@ -24,24 +24,11 @@ target_include_directories(EntityComponentSystem INTERFACE ${CMAKE_CURRENT_SOURC
 include_directories(${CMAKE_CURRENT_SOURCE_DIR})
 
 
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -Wall -Wextra -Wpedantic")
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic")
 set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
 set(CMAKE_CXX_FLAGS_RELEASE "-O3 -D NDEBUG")
 
-if("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
-    execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
-    if(NOT (GCC_VERSION VERSION_GREATER 5.0 OR GCC_VERSION VERSION_EQUAL 5.0))
-        message(FATAL_ERROR "${PROJECT_NAME} requires g++ 5.0 or greater.")
-    endif ()
-elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
-    execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE CLANG_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
-    if(NOT (CLANG_VERSION VERSION_GREATER 3.4 OR CLANG_VERSION VERSION_EQUAL 3.4))
-        message(FATAL_ERROR "${PROJECT_NAME} requires clang 3.4 or greater.")
-    endif()
-elseif(MSVC)
-else()
-    message(FATAL_ERROR "Your C++ compiler does not support C++14.")
-endif()
+target_compile_features(EntityComponentSystem INTERFACE cxx_std_14)
 
 if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
     message(STATUS "Setting build type to 'Debug', none was specified.")
@@ -63,6 +50,7 @@ if(GTEST_FOUND)
     add_executable(UnitTests ${UnitTests_SOURCES})
     target_link_libraries(UnitTests EntityComponentSystem ${GTEST_LIBRARIES})
     target_include_directories(UnitTests PUBLIC ${GTEST_INCLUDE_DIR})
+    target_compile_features(UnitTests PUBLIC cxx_std_14)
 
     enable_testing()
     add_test(NAME UnitTests COMMAND UnitTests)