[CMake] CMake generator executable variable

Patrick Boettcher patrick.boettcher at posteo.de
Wed Jun 22 10:43:40 EDT 2016


Hi list,

In my project some people use Ninja as a generator, some use GNU Make.

In a part of my projects I have a add_custom_command() which runs, for
convenience, the build of another cmake-generated project in another
dir using a different set of compilers (which is the reason for not
being a sub_directory).

  add_custom_target(build-app
      COMMAND make -C ${APP_BUILD_DIR})

This fails of course if the user decided to use ninja.

We can assume that the caller's build is always using the same generator
as the callee's one.

I know there is CMAKE_GENERATOR - I could do it with 'IF()', but is
there a variable carrying the generator-command which I can use to
replace the bare 'make'?

Thank you in advance.

regards,
--
Patrick.





More information about the CMake mailing list