aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarat Dukhan <marat@fb.com>2017-11-03 15:52:32 -0700
committerMarat Dukhan <marat@fb.com>2017-11-03 15:52:32 -0700
commit372026ae18cbdb527fe7bf84d6240a3f413e430f (patch)
treea6d5de3f338a070b05b7da34e08fd3b3515a72ae
parentc4a4d1a709b96df541ebf52513412b3232c7f499 (diff)
downloadplatform_external_pthreadpool-372026ae18cbdb527fe7bf84d6240a3f413e430f.tar.gz
platform_external_pthreadpool-372026ae18cbdb527fe7bf84d6240a3f413e430f.tar.bz2
platform_external_pthreadpool-372026ae18cbdb527fe7bf84d6240a3f413e430f.zip
CMake: build pthreadpool as a static library by default
-rw-r--r--CMakeLists.txt7
1 files changed, 6 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f70bd96..e6d2a60 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -6,6 +6,7 @@ INCLUDE(GNUInstallDirs)
PROJECT(pthreadpool C CXX)
# ---[ Options.
+OPTION(PTHREADPOOL_BUILD_SHARED "Build pthreadpool as a shared library" OFF)
OPTION(PTHREADPOOL_BUILD_TESTS "Build pthreadpool unit tests" ON)
OPTION(PTHREADPOOL_BUILD_BENCHMARKS "Build pthreadpool micro-benchmarks" ON)
@@ -66,7 +67,11 @@ ENDIF()
TARGET_INCLUDE_DIRECTORIES(pthreadpool_interface INTERFACE include)
INSTALL(FILES include/pthreadpool.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
-ADD_LIBRARY(pthreadpool ${PTHREADPOOL_SRCS})
+IF(PTHREADPOOL_BUILD_SHARED)
+ ADD_LIBRARY(pthreadpool SHARED ${PTHREADPOOL_SRCS})
+ELSE()
+ ADD_LIBRARY(pthreadpool STATIC ${PTHREADPOOL_SRCS})
+ENDIF()
TARGET_LINK_LIBRARIES(pthreadpool PUBLIC pthreadpool_interface)
IF(NOT CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
SET(CMAKE_THREAD_PREFER_PTHREAD TRUE)