Disable build tests by default in CMake and enable them in make file

This commit is contained in:
Bruno Coelho 2017-02-16 17:35:24 +00:00
parent 7a2a1feeea
commit 44944359c8
2 changed files with 6 additions and 2 deletions

View File

@ -3,7 +3,7 @@ project(json11 VERSION 1.0.0 LANGUAGES CXX)
enable_testing()
option(JSON11_BUILD_TESTS "Build unit tests" ON)
option(JSON11_BUILD_TESTS "Build unit tests" OFF)
option(JSON11_ENABLE_DR1467_CANARY "Enable canary test for DR 1467" OFF)
set(CMAKE_CXX_STANDARD 11)

View File

@ -6,8 +6,12 @@ ifneq ($(JSON11_ENABLE_DR1467_CANARY),)
CANARY_ARGS = -DJSON11_ENABLE_DR1467_CANARY=$(JSON11_ENABLE_DR1467_CANARY)
endif
ifneq ($(JSON11_BUILD_TESTS),)
JSON11_BUILD_TESTS_ARGS = -DJSON11_BUILD_TESTS=$(JSON11_BUILD_TESTS)
endif
test: json11.cpp json11.hpp test.cpp
$(CXX) $(CANARY_ARGS) -O -std=c++11 json11.cpp test.cpp -o test -fno-rtti -fno-exceptions
$(CXX) $(CANARY_ARGS) $(JSON11_BUILD_TESTS_ARGS) -O -std=c++11 json11.cpp test.cpp -o test -fno-rtti -fno-exceptions
clean:
if [ -e test ]; then rm test; fi