import external library

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

import external library

Wagner Martin

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

 

 

 

 


--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: import external library

Florent Castelli
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

 

 

 

 





--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake