diff options
author | Marat Dukhan <marat@fb.com> | 2017-11-03 15:52:32 -0700 |
---|---|---|
committer | Marat Dukhan <marat@fb.com> | 2017-11-03 15:52:32 -0700 |
commit | 372026ae18cbdb527fe7bf84d6240a3f413e430f (patch) | |
tree | a6d5de3f338a070b05b7da34e08fd3b3515a72ae /CMakeLists.txt | |
parent | c4a4d1a709b96df541ebf52513412b3232c7f499 (diff) | |
download | pthreadpool-372026ae18cbdb527fe7bf84d6240a3f413e430f.tar.gz |
CMake: build pthreadpool as a static library by default
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 7 |
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) |