Check for static_assert support

stable-5.2
Nicolas Hake 2010-05-29 14:44:16 +02:00
parent 19ae7b244d
commit 62f840412e
3 changed files with 11 additions and 0 deletions

View File

@ -73,6 +73,7 @@ if(CMAKE_COMPILER_IS_GNUCXX)
list(APPEND OC_CXX_FLAGS "-std=gnu++0x")
endif()
endif()
CHECK_CXX_SOURCE_COMPILES("int main() { static_assert(true, \"\"); }" HAVE_STATIC_ASSERT)
# ck 09-09-20: CMAKE_REQUIRED_FLAGS requires a string, not a list.
include(CheckCXXSourceCompiles)

View File

@ -203,5 +203,8 @@
/* Use Apple Cocoa for the UI */
#cmakedefine USE_COCOA 1
/* Define to 1 if your compiler supports static_assert */
#cmakedefine HAVE_STATIC_ASSERT 1
/* Generate minidumps on crash */
#cmakedefine GENERATE_MINI_DUMP 1

View File

@ -117,6 +117,13 @@ typedef ptrdiff_t ssize_t;
#ifndef HAVE_STATIC_ASSERT
#include <boost/static_assert.hpp>
#define static_assert(x, y) BOOST_STATIC_ASSERT(x)
#endif
#if defined(__GNUC__)
// Allow checks for correct printf-usage
#define GNUC_FORMAT_ATTRIBUTE __attribute__ ((format (printf, 1, 2)))