[CMake] import external library

Wagner Martin Martin.Wagner at neuberger.net
Wed Feb 15 08:12:57 EST 2017


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/814dbcf0/attachment.html>


More information about the CMake mailing list