[CMake] Help Accommodating Ninja when including CMAKE_CURRENT_BINARY_DIR

Robert Maynard robert.maynard at kitware.com
Fri Apr 27 11:22:58 EDT 2018


I recommend going with the custom target / custom command route.

On Fri, Apr 27, 2018 at 5:19 AM, Stephen McDowell <sjm324 at cornell.edu>
wrote:

> Upon further inspection, it seems more related to PRE_BUILD.  The step to
> generating the files is through a add_custom_command call, which from the
> docs apparently may end up being PRE_LINK.
>
> I tried generating into the ${CMAKE_CURRENT_SOURCE}/include/nanogui,
> which will work for Makefiles but not for Ninja.
>
> So it seems that maybe this is not a pathing issue at all, but instead an
> order of operations issue.  If the Ninja generator ends up having this as
> PRE_LINK, the files haven’t been generated yet.
>
> That doesn’t quite explain why it worked previously, but perhaps the
> original setup was inherently flawed by relying on PRE_BUILD which is not a
> guaranteed order.
>
> Does anybody have thoughts on how to change things?  The files cannot be
> compiled on their own, but maybe I should instead create a fake target and
> make it a dependency of the real (object) library that needs them.  I keep
> messing that up, but this seems the most promising.
>
> -Stephen
>
> --
>
> 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:
> https://cmake.org/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20180427/d38c704d/attachment-0001.html>


More information about the CMake mailing list