summaryrefslogtreecommitdiff
path: root/Modules/Findosg_functions.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/Findosg_functions.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/Findosg_functions.cmake')
-rw-r--r--Modules/Findosg_functions.cmake22
1 files changed, 9 insertions, 13 deletions
diff --git a/Modules/Findosg_functions.cmake b/Modules/Findosg_functions.cmake
index 60de726e13..adaeb6b1d1 100644
--- a/Modules/Findosg_functions.cmake
+++ b/Modules/Findosg_functions.cmake
@@ -13,6 +13,8 @@
# libraries and nodekits. Please see FindOpenSceneGraph.cmake for full
# documentation.
+include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake)
+
#
# OSG_FIND_PATH
#
@@ -39,7 +41,7 @@ endfunction()
function(OSG_FIND_LIBRARY module library)
string(TOUPPER ${module} module_uc)
- find_library(${module_uc}_LIBRARY
+ find_library(${module_uc}_LIBRARY_RELEASE
NAMES ${library}
HINTS
ENV ${module_uc}_DIR
@@ -63,18 +65,12 @@ function(OSG_FIND_LIBRARY module library)
PATH_SUFFIXES lib
)
- if(NOT ${module_uc}_LIBRARY_DEBUG)
- # They don't have a debug library
- set(${module_uc}_LIBRARY_DEBUG ${${module_uc}_LIBRARY} PARENT_SCOPE)
- set(${module_uc}_LIBRARIES ${${module_uc}_LIBRARY} PARENT_SCOPE)
- else()
- # They really have a FOO_LIBRARY_DEBUG
- set(${module_uc}_LIBRARIES
- optimized ${${module_uc}_LIBRARY}
- debug ${${module_uc}_LIBRARY_DEBUG}
- PARENT_SCOPE
- )
- endif()
+ select_library_configurations(${module_uc})
+
+ # the variables set by select_library_configurations go out of scope
+ # here, so we need to set them again
+ set(${module_uc}_LIBRARY ${${module_uc}_LIBRARY} PARENT_SCOPE)
+ set(${module_uc}_LIBRARIES ${${module_uc}_LIBRARIES} PARENT_SCOPE)
endfunction()
#