I’m trying to write a FindGigeSim.cmake module that creates imported targets for a 3rd party library.
I’m having trouble getting it to work on Windows. Specifically, the following command fails to find the gigesimsdk64.dll
file:
find_library(
GigeSim_LIBRARY
NAMES gigesimsdk64
PATHS "C:/Program Files/GigESim/Bin"
"/usr/lib/GigeSimSDK"
)
I found the command fails because the CMAKE_FIND_LIBRARY_SUFFIXES
variable only contains ".lib"
and not ".dll"
.
I’ve read other posts (like this one) which state this is by design, since on Windows, you link to the import-lib instead of the DLL directly.
However, I still need the DLL path to set the IMPORTED_LOCATION
property on the imported target, correct? I suppose I could add a separate call to find_path
that looks exclusively for the .dll
; or I can temporarily add .dll
to the CMAKE_FIND_LIBRARY_SUFFIXES
, but I wonder if there is a more elegant way to solve this?
I would also like to point out the documentation for CMAKE_FIND_LIBRARY_SUFFIXES
:
On Windows systems this is typically
.lib
and.dll
So part of my confusion is that the docs state that .dll
should be present.
FWIW, I’m using Cmake 3.21.2 on Windows 10 with the Visual Studio 2019 generator. My minimum required version is set to 3.10.
Thanks in advance for your help!