Skip to content

Commit 600fee8

Browse files
authored
Update CMakeLists.txt
Now, it can check the required compiler version
1 parent ad27aa5 commit 600fee8

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

CMakeLists.txt

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
cmake_minimum_required (VERSION 3.10)
2-
3-
set(CMAKE_CXX_COMPILER g++-7)
4-
52
project (identity)
63

4+
# Credit: https://stackoverflow.com/questions/52180281/cmake-cxx-compiler-version-is-pointing-to-the-old-gcc-version
5+
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
6+
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.5)
7+
message(FATAL_ERROR "GNU g++ 7.5.0 or later is required. Your current compiler version is: " ${CMAKE_CXX_COMPILER_VERSION})
8+
endif()
9+
else()
10+
message(FATAL_ERROR "Your compiler is currently unsupported: " ${CMAKE_CXX_COMPILER_ID})
11+
endif()
12+
713
set(CMAKE_BINARY_DIR ${CMAKE_SOURCE_DIR}/bin)
814
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR})
915
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR})
@@ -44,6 +50,4 @@ ${CMAKE_SOURCE_DIR}/src/AlignerParallel.h
4450

4551
set (CMAKE_CXX_STANDARD 17)
4652
set (CMAKE_CXX_FLAGS " -O3 -ffast-math -fopenmp -fmessage-length=0")
47-
4853
add_executable(identity ${CMAKE_SOURCE_DIR}/src/Identity.cpp ${SOURCES} ${HEADER_FILES})
49-

0 commit comments

Comments
 (0)