aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarat Dukhan <marat@fb.com>2017-11-03 16:02:16 -0700
committerMarat Dukhan <marat@fb.com>2017-11-03 16:02:16 -0700
commitc3202af4371eaae4249350b270e17333244792f2 (patch)
treec801b840aaf764adce27f50859987b4c518b3c46
parent372026ae18cbdb527fe7bf84d6240a3f413e430f (diff)
downloadplatform_external_pthreadpool-c3202af4371eaae4249350b270e17333244792f2.tar.gz
platform_external_pthreadpool-c3202af4371eaae4249350b270e17333244792f2.tar.bz2
platform_external_pthreadpool-c3202af4371eaae4249350b270e17333244792f2.zip
CMake: replace PTHREADPOOL_BUILD_SHARED with PTHREADPOOL_LIBRARY_TYPE option
-rw-r--r--CMakeLists.txt9
1 files changed, 6 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e6d2a60..20a786d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -6,7 +6,8 @@ INCLUDE(GNUInstallDirs)
PROJECT(pthreadpool C CXX)
# ---[ Options.
-OPTION(PTHREADPOOL_BUILD_SHARED "Build pthreadpool as a shared library" OFF)
+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_BUILD_TESTS "Build pthreadpool unit tests" ON)
OPTION(PTHREADPOOL_BUILD_BENCHMARKS "Build pthreadpool micro-benchmarks" ON)
@@ -67,9 +68,11 @@ ENDIF()
TARGET_INCLUDE_DIRECTORIES(pthreadpool_interface INTERFACE include)
INSTALL(FILES include/pthreadpool.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
-IF(PTHREADPOOL_BUILD_SHARED)
+IF(PTHREADPOOL_LIBRARY_TYPE STREQUAL "default")
+ ADD_LIBRARY(pthreadpool ${PTHREADPOOL_SRCS})
+ELSEIF(PTHREADPOOL_LIBRARY_TYPE STREQUAL "shared")
ADD_LIBRARY(pthreadpool SHARED ${PTHREADPOOL_SRCS})
-ELSE()
+ELSEIF(PTHREADPOOL_LIBRARY_TYPE STREQUAL "static")
ADD_LIBRARY(pthreadpool STATIC ${PTHREADPOOL_SRCS})
ENDIF()
TARGET_LINK_LIBRARIES(pthreadpool PUBLIC pthreadpool_interface)