cmake: Use a standard option for controlling the tests

As per the docs [1], there's a standard variable for this purpose. This
introduces a behavior change, the tests are now being built by default.

[1] https://cmake.org/cmake/help/v3.0/module/CTest.html
This commit is contained in:
Jan Kundrát 2016-11-22 10:20:13 +01:00
parent 61cdd170fd
commit 1c31800210

View File

@ -5,6 +5,7 @@
cmake_minimum_required(VERSION 3.1)
project(spdlog VERSION 1.0.0)
include(CTest)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
@ -12,7 +13,6 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
add_library(spdlog INTERFACE)
option(SPDLOG_BUILD_EXAMPLES "Build examples" OFF)
option(SPDLOG_BUILD_TESTS "Build tests" OFF)
target_include_directories(
spdlog
@ -28,7 +28,7 @@ if(SPDLOG_BUILD_EXAMPLES)
add_subdirectory(example)
endif()
if(SPDLOG_BUILD_TESTS)
if(BUILD_TESTING)
add_subdirectory(tests)
endif()