mirror of
https://github.com/simonbrunel/qtpromise.git
synced 2024-11-23 19:20:57 +08:00
project: cmake: add option to explicity enable/disable building tests
This allows user/builder to chose whether or not to build the tests. The option retains the previous default behaviour, so that tests are built if we are a subproject. Signed-off-by: Marc Reilly <marc@cpdesign.com.au>
This commit is contained in:
parent
c181965a1c
commit
36fa94a9ac
@ -2,6 +2,8 @@ cmake_minimum_required(VERSION 3.8)
|
||||
|
||||
if(DEFINED PROJECT_NAME)
|
||||
set(SUBPROJECT ON)
|
||||
else()
|
||||
set(SUBPROJECT OFF)
|
||||
endif()
|
||||
|
||||
project(qtpromise VERSION 0.6.0 LANGUAGES CXX)
|
||||
@ -10,6 +12,11 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
|
||||
|
||||
find_package(Qt5 5.6.0 REQUIRED COMPONENTS Core)
|
||||
|
||||
option(qtpromise_BuildTests "Build Test Programs" ON)
|
||||
if (${SUBPROJECT})
|
||||
set(qtpromise_BuildTests OFF)
|
||||
endif()
|
||||
|
||||
include(GNUInstallDirs)
|
||||
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
@ -125,7 +132,7 @@ install(FILES ${PROJECT_SOURCE_DIR}/include/QtPromise
|
||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/qtpromise/include)
|
||||
|
||||
|
||||
if(NOT SUBPROJECT)
|
||||
if(qtpromise_BuildTests)
|
||||
enable_testing()
|
||||
add_subdirectory(tests)
|
||||
endif()
|
||||
|
Loading…
Reference in New Issue
Block a user