[CMake] CMake generator executable variable
Petr Kmoch
petr.kmoch at gmail.com
Wed Jun 22 10:52:17 EDT 2016
Hi Patrick.
If the "subproject" is also CMake-generated, as you say, the best way to
build it would be:
add_custom_target(build-app
COMMAND ${CMAKE_COMMAND} --build #... other options as appropriate
)
You might also have to set the WORKING_DIRECTORY.
This should give you a generator-agnostic command to build a
CMake-generated project.
Petr
On 22 June 2016 at 16:43, Patrick Boettcher <patrick.boettcher at posteo.de>
wrote:
> 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.
>
>
>
> --
>
> 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:
> http://public.kitware.com/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20160622/8931ee28/attachment-0001.html>
More information about the CMake
mailing list