[CMake] Unreliable Find*.conf

Damian Philipp damian.philipp at gmx.net
Sun Mar 22 03:48:47 EDT 2015


Hello cmake-experts,

Am 18.03.15 um 07:59 schrieb Rolf Eike Beer:
> Use find_library() to find the library itself. If you really need the library 
> directory (you probably don't) then use get_filename_component() on the library 
> location returned by find_library().

thank you, this helped. I now have the find-module working to create
Makefiles on OSX. I have published the intermediate result on github so
others can use this find-module. You can find it at

https://github.com/deltaphi/Findts3sdk.cmake/

However, all is not well in Findts3sdk-land (apart from the "creative"
directory layout already critisized in another mail). As a next step, I
want to make the find-module on Windows. I already toyed around with it
a bit, but ran into the dll/lib-problem for Visual Studio pretty soon.

For those from the future, coming to read this email, this is the file
i'm talking about:
https://github.com/deltaphi/Findts3sdk.cmake/blob/764580d4e0ad9d73a842838939259734479eff6d/Findts3sdk.cmake

What works: find_library() picks up the .lib-file to be used and I can
successefully compile and link my project.

What doesn't work: To run my project, I need to copy the .dll next to my
executable. I made my find-module set ts3sdk_LIBRARY_FILES to a list of
the library files and used add_custom_command(...POST_BUILD...) in my
main project file to copy the files.

However, to copy something, you need it's source path, which I obtain
from find_library() on Non-Windows systems. On Windows, find_library()
gives me the .lib-file only. I understand that this is the correct
behavior for find_library(), but is there another way to find the
.dll-file? I gather that find_file() might help, but that doesn't have
the same magic of detecting library filenames as find_library() has.

Regards,
Damian Philipp


More information about the CMake mailing list