Skip to content

Commit 7d4e9b5

Browse files
committed
Make CMake release flags similar to Makefile build
1 parent 5ee349f commit 7d4e9b5

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

.travis.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ jobs:
163163
packages:
164164
- g++-5
165165
install:
166-
- 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'
166+
- cmake -H. -Bbuild '-DCMAKE_BUILD_TYPE=Release' '-DCMAKE_CXX_COMPILER=g++-5' '-Dsat_impl=glucose'
167167
- cmake --build build -- -j4
168168
script: (cd build; ctest -V -L CORE)
169169

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

CMakeLists.txt

+12
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,18 @@ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
1313
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
1414
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
1515

16+
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR
17+
"${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU"
18+
)
19+
# Ensure NDEBUG is not set for release builds
20+
set(CMAKE_CXX_FLAGS_RELEASE "-O2")
21+
# Enable lots of warnings
22+
set(CMAKE_CXX_FLAGS "-Wall -Wpedantic -Werror")
23+
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
24+
# This would be the place to enable warnings for Windows builds, although
25+
# config.inc doesn't seem to do that currently
26+
endif()
27+
1628
add_subdirectory(src)
1729

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

0 commit comments

Comments
 (0)