From 04cbf615f5615b1c6712308625ae3ad0fdf958b0 Mon Sep 17 00:00:00 2001 From: Pavel Krajcevski Date: Tue, 2 Oct 2012 18:34:25 -0400 Subject: [PATCH] Make sure that our thread api preferences are saved in the cache. --- Core/CMakeLists.txt | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/Core/CMakeLists.txt b/Core/CMakeLists.txt index 7bc7c40..9ab1535 100644 --- a/Core/CMakeLists.txt +++ b/Core/CMakeLists.txt @@ -34,15 +34,15 @@ INCLUDE_DIRECTORIES( ${TexC_BINARY_DIR}/IO/include ) INCLUDE_DIRECTORIES( ${TexC_SOURCE_DIR}/Core/include ) -SET( THREAD_API "None" CACHE STRING "API used to implement threading operations") +SET( THREAD_API ) SET( THREAD_APIS_AVAILABLE "None" ) FIND_PACKAGE( Boost COMPONENTS thread system ) IF( Boost_FOUND ) - SET( THREAD_APIS_AVAILABLE ${THREAD_APIS_AVAILABLE} "Boost" ) - IF( THREAD_API MATCHES "None" ) - SET( THREAD_API "Boost" ) + SET( THREAD_APIS_AVAILABLE "Boost" ${THREAD_APIS_AVAILABLE} ) + IF( "${THREAD_API}" STREQUAL "" ) + SET( THREAD_API "Boost" ) ENDIF() ENDIF() @@ -50,13 +50,19 @@ ENDIF() FIND_PACKAGE( Threads ) IF( CMAKE_USE_PTHREADS_INIT ) - SET( THREAD_APIS_AVAILABLE ${THREAD_APIS_AVAILABLE} "PThread" ) - IF( THREAD_API MATCHES "None" ) - SET( THREAD_API "Boost" ) + SET( THREAD_APIS_AVAILABLE "PThread" ${THREAD_APIS_AVAILABLE} ) + IF( "${THREAD_API}" STREQUAL "" ) + SET( THREAD_API "PThread" ) ENDIF() ENDIF() +IF( "${THREAD_API}" STREQUAL "" ) + SET( THREAD_API "None" ) +ENDIF() + +SET( THREAD_API_DESC "API used to implement threading operations") +SET( THREAD_API ${THREAD_API} CACHE STRING ${THREAD_API_DESC} FORCE ) SET_PROPERTY( CACHE THREAD_API PROPERTY STRINGS ${THREAD_APIS_AVAILABLE} ) IF( THREAD_API MATCHES "Boost")