Don't rely on CMake 3.0 features

Too recent (about one year).
This commit is contained in:
Manuel Pégourié-Gonnard 2015-07-01 16:59:56 +02:00
parent 9de64f5af1
commit 5fe51d75f0

View file

@ -40,10 +40,14 @@ option(USE_PKCS11_HELPER_LIBRARY "Build mbed TLS with the pkcs11-helper library.
option(ENABLE_ZLIB_SUPPORT "Build mbed TLS with zlib library." OFF) option(ENABLE_ZLIB_SUPPORT "Build mbed TLS with zlib library." OFF)
option(ENABLE_PROGRAMS "Build mbed TLS programs." ON) option(ENABLE_PROGRAMS "Build mbed TLS programs." ON)
option(ENABLE_TESTING "Build mbed TLS tests." ON)
if(ENABLE_TESTING) # Tests need Perl. Ideally we would use CMake's FindPerl module,
enable_testing() # but it is only available since CMake 3.0 (released June 2014).
# Assume Perl is available on Unix, and allow user to override.
if(UNIX)
option(ENABLE_TESTING "Build mbed TLS tests." ON)
else()
option(ENABLE_TESTING "Build mbed TLS tests." OFF)
endif() endif()
if(LIB_INSTALL_DIR) if(LIB_INSTALL_DIR)
@ -73,12 +77,13 @@ ADD_CUSTOM_TARGET(apidoc
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
if(ENABLE_TESTING) if(ENABLE_TESTING)
find_package(PERL) enable_testing()
if(PERL_FOUND)
add_subdirectory(tests) add_subdirectory(tests)
# additional convenience targets for Unix only
if(UNIX) if(UNIX)
ADD_CUSTOM_TARGET(covtest ADD_CUSTOM_TARGET(covtest
COMMAND make test COMMAND make test
COMMAND programs/test/selftest COMMAND programs/test/selftest
@ -105,5 +110,4 @@ if(ENABLE_TESTING)
COMMAND mv DartConfiguration.tcl.bak DartConfiguration.tcl COMMAND mv DartConfiguration.tcl.bak DartConfiguration.tcl
) )
endif(UNIX) endif(UNIX)
endif(PERL_FOUND)
endif() endif()