Use static_assert more actively

This commit is contained in:
carterl 2015-02-15 03:07:27 +01:00
parent 0fc15d48f3
commit 43b9fefbd2
2 changed files with 9 additions and 1 deletions

View File

@ -128,6 +128,13 @@ endif ()
# add_definitions(-DFMT_USE_DELETED_FUNCTIONS=1)
#endif ()
#check_cxx_source_compiles("
# static_assert(true, \"\");
# int main(){}" FMT_STATIC_ASSERT)
#if (FMT_STATIC_ASSERT)
# add_definitions(-DFMT_USE_STATIC_ASSERT=1)
#endif ()
# GTest doesn't detect <tuple> with clang.
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
target_compile_definitions(gmock PUBLIC GTEST_USE_OWN_TR1_TUPLE=1)

View File

@ -68,7 +68,8 @@
# define FMT_UNUSED
#endif
#if FMT_USE_STATIC_ASSERT
#if FMT_USE_STATIC_ASSERT || FMT_HAS_CPP_ATTRIBUTE(cxx_static_assert) || \
(FMT_GCC_VERSION >= 403 && __cplusplus >= 201103) || _MSC_VER >= 1600
# define FMT_STATIC_ASSERT(cond, message) static_assert(cond, message)
#else
# define FMT_CONCAT_(a, b) FMT_CONCAT(a, b)