Re: [CMake] CMake generator executable variable

2016-06-22 Thread Patrick Boettcher
Hi Petr,

On Wed, 22 Jun 2016 16:52:17 +0200
Petr Kmoch  wrote:

> 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.

Thanks. Just when your Email arrived I just found the --build-option.

It is even better than I thought it will be.

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


Re: [CMake] CMake generator executable variable

2016-06-22 Thread Petr Kmoch
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 
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
>
-- 

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

[CMake] CMake generator executable variable

2016-06-22 Thread Patrick Boettcher
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