Skip to content

Commit

Permalink
add STL_NO_DEBUG option in CMake
Browse files Browse the repository at this point in the history
  • Loading branch information
Norihiro Watanabe committed Aug 14, 2015
1 parent db6daf6 commit 6a0dcaa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ option(OGS_DISABLE_LOGGING "Disables all logog messages." OFF)

# Compiler flags
set(OGS_CXX_FLAGS "" CACHE STRING "Additional C++ compiler flags.")
option(STL_NO_DEBUG "Disable STL debug in debug build" OFF)

# Print CMake variable values
if (OGS_CMAKE_DEBUG)
Expand Down
8 changes: 6 additions & 2 deletions scripts/cmake/CompilerSetup.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ if(COMPILER_IS_GCC)
endif()
else()
# Enable assertions in STL in debug mode.
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_ASSERT -D_GLIBCXX_DEBUG_PEDASSERT -D_GLIBCXX_DEBUG_VERIFY")
if (NOT STL_NO_DEBUG)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_ASSERT -D_GLIBCXX_DEBUG_PEDASSERT -D_GLIBCXX_DEBUG_VERIFY")
endif()
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wno-deprecated -Wall -Wextra")
endif() # COMPILER_IS_GCC
Expand All @@ -53,7 +55,9 @@ if(COMPILER_IS_CLANG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wno-c++98-compat-pedantic -march=native")
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
# Enable assertions in STL in debug mode.
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_ASSERT -D_GLIBCXX_DEBUG_PEDASSERT -D_GLIBCXX_DEBUG_VERIFY")
if (NOT STL_NO_DEBUG)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_ASSERT -D_GLIBCXX_DEBUG_PEDASSERT -D_GLIBCXX_DEBUG_VERIFY")
endif()
endif()
endif() # COMPILER_IS_CLANG

Expand Down

0 comments on commit 6a0dcaa

Please sign in to comment.