Skip to content

Commit 4d21b2d

Browse files
committed
CXX-807 Enforce compiler minima
1 parent a0df86e commit 4d21b2d

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

CMakeLists.txt

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,30 @@
1+
cmake_minimum_required(VERSION 3.2 FATAL_ERROR)
2+
3+
if(POLICY CMP0025)
4+
cmake_policy(SET CMP0025 NEW)
5+
endif()
6+
17
project(MONGO_CXX_DRIVER LANGUAGES CXX)
28

3-
cmake_minimum_required(VERSION 3.2 FATAL_ERROR)
9+
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
10+
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.9")
11+
message(FATAL_ERROR "Insufficient GCC version - GCC 4.9+ required")
12+
endif()
13+
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
14+
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "19.0.23506")
15+
message(FATAL_ERROR "Insufficient Microsoft Visual C++ version - MSVC 2015U1+ required")
16+
endif()
17+
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
18+
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "6.2")
19+
message(FATAL_ERROR "Insufficient Apple clang version - XCode 6.2+ required")
20+
endif()
21+
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
22+
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "3.5")
23+
message(FATAL_ERROR "Insufficient clang version - clang 3.5+ required")
24+
endif()
25+
else()
26+
message(WARNING "Unknown compiler... recklessly proceeding without a version check")
27+
endif()
428

529
set (CMAKE_SKIP_BUILD_RPATH false)
630
set (CMAKE_BUILD_WITH_INSTALL_RPATH false)

0 commit comments

Comments
 (0)