LEMON_THREADING cmake variable for choosing threading lib (#223)
authorAlpar Juttner <alpar@cs.elte.hu>
Sun, 29 Jan 2012 22:33:14 +0100
changeset 98048e17328c155
parent 979 43a91b33f374
child 981 cdd2c7dad989
child 984 fcb6ad1e67d0
child 985 eb12ad2789fc
child 1002 f63ba40a60f4
LEMON_THREADING cmake variable for choosing threading lib (#223)
CMakeLists.txt
     1.1 --- a/CMakeLists.txt	Sun Jan 29 11:28:41 2012 +0100
     1.2 +++ b/CMakeLists.txt	Sun Jan 29 22:33:14 2012 +0100
     1.3 @@ -115,8 +115,26 @@
     1.4  SET(LEMON_HAVE_LONG_LONG ${HAVE_LONG_LONG})
     1.5  
     1.6  INCLUDE(FindThreads)
     1.7 -SET(LEMON_USE_PTHREAD ${CMAKE_USE_PTHREADS_INIT})
     1.8 -SET(LEMON_USE_WIN32_THREADS ${CMAKE_USE_WIN32_THREADS_INIT})
     1.9 +
    1.10 +IF(NOT LEMON_THREADING)
    1.11 +  IF(CMAKE_USE_PTHREADS_INIT)
    1.12 +    SET(LEMON_THREADING "Pthread")
    1.13 +  ELSEIF(CMAKE_USE_WIN32_THREADS_INIT)
    1.14 +    SET(LEMON_THREADING "Win32")
    1.15 +  ELSE()
    1.16 +    SET(LEMON_THREADING "None")
    1.17 +  ENDIF()
    1.18 +ENDIF()
    1.19 +
    1.20 +SET( LEMON_THREADING "${LEMON_THREADING}" CACHE STRING
    1.21 +  "Choose the threading library, options are: Pthread Win32 None."
    1.22 +  FORCE )
    1.23 +
    1.24 +IF(LEMON_THREADING STREQUAL "Pthread")
    1.25 +  SET(LEMON_USE_PTHREAD TRUE)
    1.26 +ELSEIF(LEMON_THREADING STREQUAL "Win32")
    1.27 +  SET(LEMON_USE_WIN32_THREADS TRUE)
    1.28 +ENDIF()
    1.29  
    1.30  ENABLE_TESTING()
    1.31