Skip to content

Commit

Permalink
Make CMake release flags similar to Makefile build
Browse files Browse the repository at this point in the history
  • Loading branch information
reuk committed Sep 11, 2017
1 parent 5ee349f commit 7d4e9b5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ jobs:
packages:
- g++-5
install:
- cmake -H. -Bbuild '-DCMAKE_BUILD_TYPE=Release' '-DCMAKE_CXX_FLAGS_RELEASE=-O3' '-DCMAKE_CXX_FLAGS=-Wall -Wpedantic -Werror' '-DCMAKE_CXX_COMPILER=g++-5' '-Dsat_impl=glucose'
- cmake -H. -Bbuild '-DCMAKE_BUILD_TYPE=Release' '-DCMAKE_CXX_COMPILER=g++-5' '-Dsat_impl=glucose'
- cmake --build build -- -j4
script: (cd build; ctest -V -L CORE)

Expand All @@ -174,7 +174,7 @@ jobs:
- BUILD_SYSTEM=cmake
- CCACHE_CPP2=yes
install:
- cmake -H. -Bbuild '-DCMAKE_BUILD_TYPE=Release' '-DCMAKE_CXX_FLAGS_RELEASE=-O3' '-DCMAKE_CXX_FLAGS=-Wall -Wpedantic -Werror' '-DCMAKE_OSX_ARCHITECTURES=x86_64'
- cmake -H. -Bbuild '-DCMAKE_BUILD_TYPE=Release' '-DCMAKE_OSX_ARCHITECTURES=x86_64'
- cmake --build build -- -j4
script: (cd build; ctest -V -L CORE)

Expand Down
12 changes: 12 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,18 @@ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR
"${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU"
)
# Ensure NDEBUG is not set for release builds
set(CMAKE_CXX_FLAGS_RELEASE "-O2")
# Enable lots of warnings
set(CMAKE_CXX_FLAGS "-Wall -Wpedantic -Werror")
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
# This would be the place to enable warnings for Windows builds, although
# config.inc doesn't seem to do that currently
endif()

add_subdirectory(src)

set(enable_cbmc_tests on CACHE BOOL "Whether CBMC tests should be enabled")
Expand Down

0 comments on commit 7d4e9b5

Please sign in to comment.