[CMake] Using ninja with imported libraries not working (Windows)

Brendan Heinonen brendan at heinonen.co
Mon Dec 17 15:42:40 EST 2018


I've been struggling to use ninja-generator with imported libraries in
CMake on Windows.  The issue started when I moved some third-party code in
the project to an external project using find_package.  I have since
reduced the issue to a minimally reproducible example:

add_library(foo STATIC IMPORTED)
set_property(TARGET foo PROPERTY IMPORTED_LOCATION E:/path/to/foo.lib)
target_link_libraries(bar foo)

This produces a Ninja error:

ninja : error : 'E:/path/to/foo.lib', needed by 'bar', missing and no known
rule to make it

I should note that the path to the lib exists, and in fact, this config
works on other generators, such as NMake and Unix Makefiles.

The issue is "fixed" upon manually editing build.ninja and removing this
from the bar link target:

E$:/path/to/foo.lib

What's the deal?  Am I missing something?  Any help would be appreciated.

-- 
*Brendan Heinonen*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20181217/9162e1b2/attachment-0001.html>


More information about the CMake mailing list