<html><head><style> body {height: 100%; color:#000000; font-size:12pt; font-family:times new roman, new york, times, serif;}</style></head><body><div><br></div><div>Hello,<br></div><div><br></div><div>I use the ExternalProject_Add command to download and build a static library called 'foo.a'.<br></div><div>I build another library 'bar' which depends on 'foo.a'.<br></div><div><br></div><div>For the moment, I use the target_link_libraries command to create a link between foo and bar:<br></div><div><br></div><div></div><div>    target_link_libraries(bar ${FOO_INSTALL_DIR}/lib/foo.a)</div><div><br></div><div>However, this approach is not portable, especially if I want foo to be a shared library.<br></div><div>Indeed, the extension of such libraries is plateform dependent.<br></div><div><br></div><div>Therefore, I tried to replace the path to foo by its name 'foo' from the call to the ExternalProject_Add command:<br></div><div><br></div><div>    target_link_libraries(bar foo)<div><br></div>However, it does not work and I get the following error message:<br></div><div><br></div><div>    Target "foo" of type UTILITY may not be linked into another target.<br>    One may link only to STATIC or SHARED libraries, or to executables with the<br>    ENABLE_EXPORTS property set.<br></div><div><br></div><div>I guess I understand that foo has the wrong type UTILITY and it would work only if I had defined my target like this:<br></div><div>  <br></div><div>    add_library(foo blablabla)<br></div><div><br></div><div>However, I need to use the ExternalProject_Add command.<br></div><div><br></div><div>Is there a way to create a library target name 'foo' in this case?<br></div><div><br></div><div>Thank you!<br></div><div><br></div><div>Cédric<br></div><div><br></div></body></html>