瀏覽代碼

CMakeLists: Make sure that a non-negative 'int' can be cast to a 'size_t'. Fix required CMake version.

ambrop7 14 年之前
父節點
當前提交
5c373b56d6
共有 1 個文件被更改,包括 6 次插入1 次删除
  1. 6 1
      CMakeLists.txt

+ 6 - 1
CMakeLists.txt

@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 2.6)
+cmake_minimum_required(VERSION 2.8)
 project(BADVPN C)
 
 set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules")
@@ -39,6 +39,11 @@ if (NOT (INT_SIZE GREATER "3"))
     message(FATAL_ERROR "int must be at least 32 bits")
 endif ()
 
+check_type_size(size_t SIZE_SIZE)
+if (NOT (SIZE_SIZE GREATER INT_SIZE OR SIZE_SIZE EQUAL INT_SIZE))
+    message(FATAL_ERROR "size_t must be greater or equal than int")
+endif ()
+
 add_definitions(-std=gnu99 -Werror=implicit-function-declaration -Wno-unused-value -Wno-parentheses -Wno-switch-enum -Wredundant-decls)
 
 # platform-specific stuff