[CMake] import external library
Florent Castelli
florent.castelli at gmail.com
Wed Feb 15 10:55:03 EST 2017
You can either unpack the target at generation time (recommended).
Or you could create an INTERFACE target instead.
The first solution is recommended as I believe it's important to have
access to all the sources (for IDEs for example) before actually
starting the build process.
/Florent
On 15/02/2017 14:12, Wagner Martin wrote:
>
> Hi @all,
>
> I’ve tried importing an external library like that:
> stackoverflow.com/questions/31274577
>
> I have the same use case, except that my custom target does not call
> make but does unpack a tar archive containing headers and .a.
>
> My problem is that the step
>
> “
>
> # specify where the library is and where to find the headers
>
> set_target_properties(lib2
>
> PROPERTIES
>
> IMPORTED_LOCATION ${LIB_FILE}
>
> INTERFACE_INCLUDE_DIRECTORIES ${LIB_HEADER_FOLDER})
>
> “
>
> fails. When running cmake, I get an error that the header dir
> specified with “INTERFACE_INCLUDE_DIRECTORIES” does not exist.
>
> “
>
> CMake Error in src/CMakeLists.txt:
>
> Imported target "whatever" includes non-existent path
>
> "/path/to/include"
>
> in its INTERFACE_INCLUDE_DIRECTORIES. Possible reasons include:
>
> * The path was deleted, renamed, or moved to another location.
>
> * An install or uninstall procedure did not complete successfully.
>
> * The installation package was faulty and references files it does not
>
> provide.
>
> “
>
> This is true, as the header path is only generated when running the
> unpack target. Is there a way to tell cmake to skip this check?
>
> Thanks!
>
> Regards,
>
> Martin
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20170215/e12da70f/attachment-0001.html>
More information about the CMake
mailing list