diff options
author | gabime <gmelman1@gmail.com> | 2018-08-13 01:22:35 +0300 |
---|---|---|
committer | gabime <gmelman1@gmail.com> | 2018-08-13 01:22:35 +0300 |
commit | da30e2ef18da4570227aaa501673afffa097768d (patch) | |
tree | 7657545cf8b821db6b23ea39498af67a83234d68 /CMakeLists.txt | |
parent | cb299375f63d2ee0c55346739b4237511bc3c322 (diff) |
Improved CMakeLists and added bench
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index a5cceb70..5166d39f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,6 +10,17 @@ include(CMakeDependentOption) include(GNUInstallDirs) #--------------------------------------------------------------------------------------- +# set default build to release +#--------------------------------------------------------------------------------------- +if (NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose Release or Debug" FORCE) +endif() + +message("Build type: " ${CMAKE_BUILD_TYPE}) + + + +#--------------------------------------------------------------------------------------- # compiler config #--------------------------------------------------------------------------------------- set(CMAKE_CXX_STANDARD 11) @@ -17,9 +28,13 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") - set(CMAKE_CXX_FLAGS "-Wall -O3 ${CMAKE_CXX_FLAGS}") + set(CMAKE_CXX_FLAGS "-Wall -Wextra ${CMAKE_CXX_FLAGS}") endif() + +#--------------------------------------------------------------------------------------- +# address sanitizers check +#--------------------------------------------------------------------------------------- include(cmake/sanitizers.cmake) #--------------------------------------------------------------------------------------- @@ -28,7 +43,9 @@ include(cmake/sanitizers.cmake) add_library(spdlog INTERFACE) add_library(spdlog::spdlog ALIAS spdlog) -option(SPDLOG_BUILD_EXAMPLES "Build examples" OFF) +option(SPDLOG_BUILD_EXAMPLES "Build examples" ON) +option(SPDLOG_BUILD_BENCH "Build benchmarks" ON) + cmake_dependent_option(SPDLOG_BUILD_TESTING "Build spdlog tests" ON "BUILD_TESTING" OFF @@ -51,6 +68,10 @@ if(SPDLOG_BUILD_TESTING) add_subdirectory(tests) endif() +if(SPDLOG_BUILD_BENCH) + add_subdirectory(bench) +endif() + #--------------------------------------------------------------------------------------- # Install/export targets and files #--------------------------------------------------------------------------------------- |