I have an ExternalProject dependency that gets cloned (using git) in the build process. This all works great with CMake + Make.
mkdir build && cd build;
cmake ..
make
It correctly clones and builds the library using git when I type make.
However, when I use the Ninja Generator:
mkdir build && cd build;
cmake -GNinja ..
ninja
I get the following error:
$ cmake -GNinja .. -- The C compiler identification is AppleClang 6.0.0.6000054
-- The CXX compiler identification is AppleClang 6.0.0.6000054
-- Check for working C compiler using: Ninja
-- Check for working C compiler using: Ninja -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler using: Ninja
-- Check for working CXX compiler using: Ninja -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Boost version: 1.56.0
-- Found the following Boost libraries:
-- unit_test_framework
-- Found Git: /usr/local/bin/git (found version "2.1.2")
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/carneiro/src/gamgee/build
$ ninja
ninja: error: 'contrib/htslib-prefix/src/htslib/libhts.a', needed by 'test/gamgee_test', missing and no known rule to make it
Is git downloading of external projects not supported by the cmake+ninja combo?
Turns out if you do a clean before building, it all works and ninja does download my dependencies correctly.
So the workflow looks like this:
mkdir build && cd build
cmake -G Ninja ..
ninja clean # if you don't do this, it will not download Externalproject dependencies
ninja
Must be some kind of bug in the Ninja generator, but I'm happy with this workflow for now.