Vcpkg: [FLTK] FindFLTK not finding debug libraries

Created on 20 Jun 2017  路  5Comments  路  Source: microsoft/vcpkg

I am running against a problem with FLTK static libraries built with debug symbols (I think that the problem should exist also for dll). When I look for the package in my CMake script, with a

find_package(FLTK REQUIRED)

the only found libraries are the ones without debug symbols.
Since I am using static libraries (dynamic FLTK libraries have many problems on Windows, at least for me), what I see is that release libs are in x86-windows-static/lib/fltk*.lib and debug libs are in x86-windows-static/debug/lib/fltk*d.lib.

The problem I am running into is that CMake always find first the libs in x86-windows-static/lib/fltk*.lib, without having a chance of picking up from x86-windows-static/debug/lib/fltk*d.lib, since, from what I can understand (hope to be proven wrong), FindFLTK.cmake first it looks for libs without d across all paths and then if not found it looks for libraries with d appended to the filename.
In fact, if i then rename debug libraries removing the d appended, they are found (since the vcpkg.cmake script put the debug folders at the first position in Debug/Undefined mode).
Which should suggest to rename the libraries in the portfile for FLTK, removing the d since they are already in a different folder and it's clear enough that they are debug libs. But unfortunately, in that case, due to how vcpkg.cmake works, the debug libraries are always picked up if the CMAKE_BUILD_TYPE is undefined (which is a rather common case with multi-configuration setup, like VS, since in that case CMake only listens to CMAKE_CONFIGURATION_TYPES).
This problem I think is not just related to FLTK but maybe is more common. How to pick up the proper library in different configurations?
Thanks a lot, and sorry for the confusion. I hope this post is clear enough, I am still learning on how to use this great vcpkg tool

port-bug

All 5 comments

I have updated the opening post, clarifying some points

@ras0219-msft sorry to disturb, any news on this problem?

Thanks for bumping this back up, but unfortunately no (solid) progress has been made.

The trouble with removing the debug suffix is that it becomes effectively impossible for multiconfiguration generators like VS to function correctly (they need to be able to see both libraries and distinguish between them).

It looks like we might be able to modify the fltk port to create a FLTKConfig.cmake file, then override FLTK_DIR during find_package()[1].

[1] https://gitlab.kitware.com/cmake/cmake/blob/92d16be9e6578600a273b338d003eb8908e5ed4e/Modules/FindFLTK.cmake#L130

I opened a PR on the cmake repository with a fix for this problem, I hope it can be accepted
https://gitlab.kitware.com/cmake/cmake/merge_requests/1563

The patch has been accepted and is released in CMake since v3.11.0-rc1

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghost picture ghost  路  3Comments

ThinkalVB picture ThinkalVB  路  3Comments

spindensity picture spindensity  路  3Comments

husseinalihazime picture husseinalihazime  路  3Comments

cjvaijo picture cjvaijo  路  3Comments