aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
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)