summaryrefslogtreecommitdiff
path: root/Modules/FindOpenThreads.cmake
diff options
context:
space:
mode:
authorCyril Boucher <cyril.boucher@sensefly.com>2018-09-05 16:15:37 +0200
committerCyril Boucher <cyril.boucher@sensefly.com>2018-09-06 09:32:56 +0200
commit192e552099fcfbb30009db9d4284a04bb779231a (patch)
treecc178cd86de38ea6963d525f056725a99f713457 /Modules/FindOpenThreads.cmake
parent0878a79414d4b7a0a24162c7365f188dba4a9bd4 (diff)
downloadcmake-192e552099fcfbb30009db9d4284a04bb779231a.tar.gz
FindOpenSceneGraph: Fix find in Debug
As of now, it is not possible to find OpenSceneGraph in Debug because the only variable find_package_handle_standard_args is checking is ${module}_LIBRARY while the debug library is in ${module}_LIBRARY_DEBUG. The refactoring gets rid of the old behaviour to replace with a call to select_library_configurations which will populated ${module}_LIBRARY accordingly. [Modules/Findosg_functions.cmake Modules/FindOpenThreads.cmake] - Include SelectLibraryConfigurations module - Modify the name of the variable that will be populated by the first find_library to ${MODULE}_LIBRARY_RELEASE so that SelectLibraryConfigurations can act on it - Add call to select_library_configurations after attempting to find libraries in debug and release
Diffstat (limited to 'Modules/FindOpenThreads.cmake')
-rw-r--r--Modules/FindOpenThreads.cmake12
1 files changed, 4 insertions, 8 deletions
diff --git a/Modules/FindOpenThreads.cmake b/Modules/FindOpenThreads.cmake
index a197e4d2b3..91545e0ea5 100644
--- a/Modules/FindOpenThreads.cmake
+++ b/Modules/FindOpenThreads.cmake
@@ -47,6 +47,8 @@
# standard install paths.
# Explicit -DVAR=value arguments should still be able to override everything.
+include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake)
+
find_path(OPENTHREADS_INCLUDE_DIR OpenThreads/Thread
HINTS
ENV OPENTHREADS_INCLUDE_DIR
@@ -62,7 +64,7 @@ find_path(OPENTHREADS_INCLUDE_DIR OpenThreads/Thread
)
-find_library(OPENTHREADS_LIBRARY
+find_library(OPENTHREADS_LIBRARY_RELEASE
NAMES OpenThreads OpenThreadsWin32
HINTS
ENV OPENTHREADS_LIBRARY_DIR
@@ -93,13 +95,7 @@ find_library(OPENTHREADS_LIBRARY_DEBUG
PATH_SUFFIXES lib
)
-if(OPENTHREADS_LIBRARY_DEBUG)
- set(OPENTHREADS_LIBRARIES
- optimized ${OPENTHREADS_LIBRARY}
- debug ${OPENTHREADS_LIBRARY_DEBUG})
-else()
- set(OPENTHREADS_LIBRARIES ${OPENTHREADS_LIBRARY})
-endif()
+select_library_configurations(OPENTHREADS)
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenThreads DEFAULT_MSG