Skip to content

Commit ae86668

Browse files
committed
CMake builds: set a default build type (Release)
In absence of a default build type, CMake would not use any pre-defined build configuration. As a consequence, any user running CMake without setting -DCMAKE_BUILD_TYPE would end up with builds without optimisation, and thus (surprisingly!) poor performance. The fix is copied from https://stackoverflow.com/questions/48832233/have-a-cmake-project-default-to-the-release-build-type.
1 parent 5167ef5 commit ae86668

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
cmake_minimum_required(VERSION 3.2)
22

3+
# Build a Release version by default (default build flags for each build type
4+
# are configured below).
5+
if (NOT EXISTS ${CMAKE_BINARY_DIR}/CMakeCache.txt)
6+
if (NOT CMAKE_BUILD_TYPE)
7+
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "" FORCE)
8+
endif()
9+
endif()
310

411
# Grab the current CBMC version from config.inc
512
# We do this so we have a matching cbmc version between the Makefile build and

0 commit comments

Comments
 (0)