Add option to CMake to disable all tests

This commit is contained in:
Paul Bakker 2014-04-30 16:31:54 +02:00
parent c16f4e1f78
commit 27f1caed02

View file

@ -1,8 +1,6 @@
cmake_minimum_required(VERSION 2.6)
project(POLARSSL C)
enable_testing()
string(REGEX MATCH "clang" CMAKE_COMPILER_IS_CLANG "${CMAKE_C_COMPILER}")
if(CMAKE_COMPILER_IS_GNUCC)
@ -41,6 +39,11 @@ option(USE_PKCS11_HELPER_LIBRARY "Build PolarSSL with the pkcs11-helper library.
option(ENABLE_ZLIB_SUPPORT "Build PolarSSL with zlib library." OFF)
option(ENABLE_PROGRAMS "Build PolarSSL programs." ON)
option(ENABLE_TESTING "Build PolarSSL tests." ON)
if(ENABLE_TESTING)
enable_testing()
endif()
if(LIB_INSTALL_DIR)
else()
@ -60,12 +63,14 @@ endif(ENABLE_ZLIB_SUPPORT)
add_subdirectory(library)
add_subdirectory(include)
if(ENABLE_TESTING)
if(CMAKE_COMPILER_IS_GNUCC)
add_subdirectory(tests)
endif(CMAKE_COMPILER_IS_GNUCC)
if(CMAKE_COMPILER_IS_CLANG)
add_subdirectory(tests)
endif(CMAKE_COMPILER_IS_CLANG)
endif()
if(ENABLE_PROGRAMS)
add_subdirectory(programs)
@ -75,6 +80,7 @@ ADD_CUSTOM_TARGET(apidoc
COMMAND doxygen doxygen/polarssl.doxyfile
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
if(ENABLE_TESTING)
ADD_CUSTOM_TARGET(test-ref-config
COMMAND tests/scripts/test-ref-configs.pl
)
@ -102,3 +108,4 @@ ADD_CUSTOM_TARGET(memcheck
COMMAND tail -n1 memcheck.log | grep 'Memory checking results:' > /dev/null
COMMAND rm -f memcheck.log
)
endif()