[cmake-developers] Best practice for determining if a static library was found and other issues with FindFLTK.cmake

Nils Gladitz nilsgladitz at gmail.com
Wed Sep 3 16:23:44 EDT 2014


On 03.09.2014 22:12, Richard Shaw wrote:
>
> I did a cmake based build for cross-compiling for win32 on Fedora 
> because the autotools was going to be WAY too much work to get working 
> with the rpmbuild mingw macros and took a look at the generated cmake 
> files.
>
> It looks like it uses a bunch of imported targets rather than 
> utilizing find_library... I'm not familiar with this method so would 
> you just use an "include(FLTKConfig)" instead of 
> find_library/find_package? And then I would add the imported targets 
> to target_link_libraries?

You would use e.g. find_package(FLTK CONFIG).
Or find_package(FLTK) if there is no FindFLTK.cmake or if FindFLTK.cmake 
itself looks for the package in config mode as well.

For reference on packages:
http://www.cmake.org/cmake/help/v3.0/manual/cmake-packages.7.html

And find_package() module and config modes:
http://www.cmake.org/cmake/help/v3.0/command/find_package.html

Nils



More information about the cmake-developers mailing list