Hello,

I use the ExternalProject_Add command to download and build a static library 
called 'foo.a'.
I build another library 'bar' which depends on 'foo.a'.

For the moment, I use the target_link_libraries command to create a link 
between foo and bar:

    target_link_libraries(bar ${FOO_INSTALL_DIR}/lib/foo.a)
However, this approach is not portable, especially if I want foo to be a shared 
library.
Indeed, the extension of such libraries is plateform dependent.

Therefore, I tried to replace the path to foo by its name 'foo' from the call 
to the ExternalProject_Add command:

    target_link_libraries(bar foo)
However, it does not work and I get the following error message:

    Target "foo" of type UTILITY may not be linked into another target.
    One may link only to STATIC or SHARED libraries, or to executables with the
    ENABLE_EXPORTS property set.

I guess I understand that foo has the wrong type UTILITY and it would work only 
if I had defined my target like this:
  
    add_library(foo blablabla)

However, I need to use the ExternalProject_Add command.

Is there a way to create a library target name 'foo' in this case?

Thank you!

Cédric

-- 

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 via email to