aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorMarat Dukhan <maratek@google.com>2019-10-19 01:01:15 -0700
committerMarat Dukhan <maratek@google.com>2019-10-19 01:01:15 -0700
commit88dfae07f90d02309186a3aa7aae85086eae9769 (patch)
treeaebd889d31d67e0b12a76c895dabdb7c66fe1db0 /CMakeLists.txt
parent9589e30d3e294dfda4974669062a5886b6e42703 (diff)
downloadpthreadpool-88dfae07f90d02309186a3aa7aae85086eae9769.tar.gz
CMake: disable tests and benchmarks in a dependency build
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt9
1 files changed, 7 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ef62f70..5bb1410 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -9,8 +9,13 @@ PROJECT(pthreadpool C CXX)
SET(PTHREADPOOL_LIBRARY_TYPE "default" CACHE STRING "Type of library (shared, static, or default) to build")
SET_PROPERTY(CACHE PTHREADPOOL_LIBRARY_TYPE PROPERTY STRINGS default static shared)
OPTION(PTHREADPOOL_ALLOW_DEPRECATED_API "Enable deprecated API functions" ON)
-OPTION(PTHREADPOOL_BUILD_TESTS "Build pthreadpool unit tests" ON)
-OPTION(PTHREADPOOL_BUILD_BENCHMARKS "Build pthreadpool micro-benchmarks" ON)
+IF("${CMAKE_SOURCE_DIR}" STREQUAL "${PROJECT_SOURCE_DIR}")
+ OPTION(PTHREADPOOL_BUILD_TESTS "Build pthreadpool unit tests" ON)
+ OPTION(PTHREADPOOL_BUILD_BENCHMARKS "Build pthreadpool micro-benchmarks" ON)
+ELSE()
+ SET(PTHREADPOOL_BUILD_TESTS OFF CACHE BOOL "Build pthreadpool unit tests")
+ SET(PTHREADPOOL_BUILD_BENCHMARKS OFF CACHE BOOL "Build pthreadpool micro-benchmarks")
+ENDIF()
# ---[ CMake options
IF(PTHREADPOOL_BUILD_TESTS)