[CMake] ExternalProject_Add, static library, Ninja generator

Charles Nicholson charles.nicholson at gmail.com
Thu Apr 2 01:15:07 EDT 2015


Hi all-

I'm using ExternalProject_Add to pull down, configure, build, and install
the OSS "hidapi" project.

The output of the hidapi build is, among other things, a library called
libhidapi.a. I'm creating an imported static library using add_library, and
then using add_dependency to indicate that the library depends on the
ExternalProject_Add target.

I've seen examples of this approach here
<http://cmake.3232098.n2.nabble.com/ExternalProject-Add-and-Dependent-Targets-td6816623.html>
and here
<http://stackoverflow.com/questions/6351609/cmake-linking-to-library-downloaded-from-externalproject-add>,
but can't get it working.

The funny part is that this works fine using the Makefile generator but
fails with the Ninja generator.

I've put up a very small and self-contained repro case here:
https://github.com/charlesnicholson/cmake-external-project-test

It requires that cmake and ninja are installed (I'm using cmake 3.2.1 and
ninja v1.5.3.). Other than that, just clone and run ./b from the root.

I'm assuming that I'm not correctly expressing the dependencies. Would
anyone mind taking a quick look? I'd really appreciate it!

Thanks in advance,
Charles
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20150401/28e7acf6/attachment.html>


More information about the CMake mailing list