Using ninja with imported libraries not working (Windows)

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Using ninja with imported libraries not working (Windows)

Brendan Heinonen
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


--

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:
https://cmake.org/mailman/listinfo/cmake