Commit 43023505 authored by Christian Rober's avatar Christian Rober Committed by Yoni Fogel

refs #5086 Adding cmake settings for Clang compatibility with c++0x on darwin.

git-svn-id: file:///svn/toku/tokudb@47172 c7de825b-a66e-492c-adef-691d508d4ae1
parent a2d06156
...@@ -120,7 +120,7 @@ set(BUILDNAME "${branchname} ${buildname_build_type} ${CMAKE_SYSTEM} ${machine_t ...@@ -120,7 +120,7 @@ set(BUILDNAME "${branchname} ${buildname_build_type} ${CMAKE_SYSTEM} ${machine_t
include(CTest) include(CTest)
if (BUILD_TESTING) if (BUILD_TESTING OR BUILD_FT_TESTS)
## set up full valgrind suppressions file (concatenate the suppressions files) ## set up full valgrind suppressions file (concatenate the suppressions files)
file(READ ft/valgrind.suppressions valgrind_suppressions) file(READ ft/valgrind.suppressions valgrind_suppressions)
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/valgrind.suppressions" "${valgrind_suppressions}") file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/valgrind.suppressions" "${valgrind_suppressions}")
...@@ -178,4 +178,4 @@ if (BUILD_TESTING) ...@@ -178,4 +178,4 @@ if (BUILD_TESTING)
option(RUN_PERF_TESTS "If set, run the perf tests." OFF) option(RUN_PERF_TESTS "If set, run the perf tests." OFF)
configure_file(CTestCustom.cmake . @ONLY) configure_file(CTestCustom.cmake . @ONLY)
endif (BUILD_TESTING) endif (BUILD_TESTING OR BUILD_FT_TESTS)
...@@ -39,6 +39,11 @@ endif (USE_GCOV) ...@@ -39,6 +39,11 @@ endif (USE_GCOV)
include(CheckCCompilerFlag) include(CheckCCompilerFlag)
include(CheckCXXCompilerFlag) include(CheckCXXCompilerFlag)
#####################################################
## Xcode needs to have this set manually.
## Other generators (makefiles) ignore this setting.
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
## adds a compiler flag if the compiler supports it ## adds a compiler flag if the compiler supports it
macro(set_cflags_if_supported_named flag flagname) macro(set_cflags_if_supported_named flag flagname)
check_c_compiler_flag("${flag}" HAVE_C_${flagname}) check_c_compiler_flag("${flag}" HAVE_C_${flagname})
...@@ -86,10 +91,17 @@ set_cflags_if_supported( ...@@ -86,10 +91,17 @@ set_cflags_if_supported(
-Wlogical-op -Wlogical-op
-Wmissing-format-attribute -Wmissing-format-attribute
-Wno-error=missing-format-attribute -Wno-error=missing-format-attribute
-Wpacked
-fno-rtti -fno-rtti
-fno-exceptions -fno-exceptions
) )
## Clang has stricter POD checks. So, only enable this warning on our other builds (Linux + GCC)
if (NOT CMAKE_CXX_COMPILER_ID MATCHES Clang)
set_cflags_if_supported(
-Wpacked
)
endif ()
## set_cflags_if_supported_named("-Weffc++" -Weffcpp) ## set_cflags_if_supported_named("-Weffc++" -Weffcpp)
set_ldflags_if_supported( set_ldflags_if_supported(
-Wno-error=strict-overflow -Wno-error=strict-overflow
...@@ -134,6 +146,9 @@ if (NOT USE_VALGRIND) ...@@ -134,6 +146,9 @@ if (NOT USE_VALGRIND)
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_RELEASE NVALGRIND=1) set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_RELEASE NVALGRIND=1)
endif () endif ()
## We need to explicitly set this standard library for Xcode builds.
add_definitions(-stdlib=libc++)
if (CMAKE_CXX_COMPILER_ID MATCHES Intel) if (CMAKE_CXX_COMPILER_ID MATCHES Intel)
set(CMAKE_C_FLAGS "-std=c99 ${CMAKE_C_FLAGS}") set(CMAKE_C_FLAGS "-std=c99 ${CMAKE_C_FLAGS}")
set(CMAKE_CXX_FLAGS "-std=c++0x ${CMAKE_CXX_FLAGS}") set(CMAKE_CXX_FLAGS "-std=c++0x ${CMAKE_CXX_FLAGS}")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment