From 8b37d4fd78f0df254f16e8b3f803ba7c5aa592f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Mon, 22 Apr 2019 14:05:36 +0200 Subject: [PATCH] modules: different search order for plugin libs in FindMagnum. This makes Vcpkg-built static plugins be found correctly. Previously both the debug and release variant pointed to the same lib. --- doc/changelog.dox | 2 ++ modules/FindMagnum.cmake | 12 +++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/doc/changelog.dox b/doc/changelog.dox index 802079ca7..5dad1d486 100644 --- a/doc/changelog.dox +++ b/doc/changelog.dox @@ -280,6 +280,8 @@ See also: [OpenGL_GL_PREFERENCE](https://cmake.org/cmake/help/v3.11/module/FindOpenGL.html#linux-specific) from outside on systems where GLVND doesn't work properly (before the build scripts and `FindMagnum.cmake` always forced GLVND) +- `FindMagnum.cmake` now correctly finds debug versions of statically built + plugins when using Vcpkg @subsection changelog-latest-bugfixes Bug fixes diff --git a/modules/FindMagnum.cmake b/modules/FindMagnum.cmake index a4d581ef9..f8da1e607 100644 --- a/modules/FindMagnum.cmake +++ b/modules/FindMagnum.cmake @@ -550,11 +550,17 @@ foreach(_component ${Magnum_FIND_COMPONENTS}) set(CMAKE_FIND_LIBRARY_PREFIXES "${CMAKE_FIND_LIBRARY_PREFIXES};") # Try to find both debug and release version. Dynamic and static - # debug libraries are in different places. - find_library(MAGNUM_${_COMPONENT}_LIBRARY_DEBUG ${_component} - PATH_SUFFIXES magnum-d/${_MAGNUM_${_COMPONENT}_PATH_SUFFIX}) + # debug libraries are in different places. Static debug plugins are + # in magnum/ with a -d suffix while dynamic debug plugins are in + # magnum-d/ with no suffix. Problem is that Vcpkg's library linking + # automagic needs the static libs to be in the root library + # directory along with everything else and so we need to search for + # the -d suffixed version *before* the unsuffixed so it doesn't + # pick the release library for both debug and release. find_library(MAGNUM_${_COMPONENT}_LIBRARY_DEBUG ${_component}-d PATH_SUFFIXES magnum/${_MAGNUM_${_COMPONENT}_PATH_SUFFIX}) + find_library(MAGNUM_${_COMPONENT}_LIBRARY_DEBUG ${_component} + PATH_SUFFIXES magnum-d/${_MAGNUM_${_COMPONENT}_PATH_SUFFIX}) find_library(MAGNUM_${_COMPONENT}_LIBRARY_RELEASE ${_component} PATH_SUFFIXES magnum/${_MAGNUM_${_COMPONENT}_PATH_SUFFIX}) mark_as_advanced(MAGNUM_${_COMPONENT}_LIBRARY_DEBUG