CMake and Ninja, RERUN_CMAKE useless?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

CMake and Ninja, RERUN_CMAKE useless?

CMake mailing list

Hi all,

 

My question comes from a Ninja generator build system, and is specifically about an internal rule generated by cmake.

What is the purpose of the RERUN_CMAKE rule generated by CMake with a Ninja generator?

 

In the current repo, the only reference to this rule is in WriteTargetRebuildManifest here

At line 1285, the rule is written out, seemingly as-is.

 

According to lines 1274 to 1284, the only actual behavior of this command, which is executed whenever the source CMakeLists.txt file, files included from the CMakeLists, and some other CMake installation files change, is:

cmake -S <source_dir> -B <binary_dir>

 

This seems completely insufficient for “re-running” cmake. The most obvious flaw is the absence of the generator. When I’ve seen this rule fire, my Ninja build system adds a useless Makefile to the build system, and then (hopefully) continues building as if nothing had been done at all, without so much as inspecting that Makefile.

 

What about command-line arguments like -D?

 

Am I missing the purpose of this rule or potentially doing something non-standard? The reason I send an email is because this behavior is sending my project into a cmake loop where it detects build.ninja is out of date, re-runs cmake to generate a Makefile instead of a ninja build system, and then infinitely repeats because it never actually re-ran anything.

 

Thanks,

JB

Code Generation

Texas Instruments


--

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
Reply | Threaded
Open this post in threaded view
|

Re: CMake and Ninja, RERUN_CMAKE useless?

CMake mailing list
The default generator and all other associated information ( '-D' ) is
kept in the CMakeCache.txt file in the root of the build directory.
The execution of `cmake -S <source_dir> -B <binary_dir>` will reload
this cache before doing anything else. Have you verified that your
build directory hasn't deleted this file?

On Tue, Oct 8, 2019 at 8:31 PM Nagurne, James via CMake <[hidden email]> wrote:

>
> Hi all,
>
>
>
> My question comes from a Ninja generator build system, and is specifically about an internal rule generated by cmake.
>
> What is the purpose of the RERUN_CMAKE rule generated by CMake with a Ninja generator?
>
>
>
> In the current repo, the only reference to this rule is in WriteTargetRebuildManifest here
>
> At line 1285, the rule is written out, seemingly as-is.
>
>
>
> According to lines 1274 to 1284, the only actual behavior of this command, which is executed whenever the source CMakeLists.txt file, files included from the CMakeLists, and some other CMake installation files change, is:
>
> cmake -S <source_dir> -B <binary_dir>
>
>
>
> This seems completely insufficient for “re-running” cmake. The most obvious flaw is the absence of the generator. When I’ve seen this rule fire, my Ninja build system adds a useless Makefile to the build system, and then (hopefully) continues building as if nothing had been done at all, without so much as inspecting that Makefile.
>
>
>
> What about command-line arguments like -D?
>
>
>
> Am I missing the purpose of this rule or potentially doing something non-standard? The reason I send an email is because this behavior is sending my project into a cmake loop where it detects build.ninja is out of date, re-runs cmake to generate a Makefile instead of a ninja build system, and then infinitely repeats because it never actually re-ran anything.
>
>
>
> Thanks,
>
> JB
>
> Code Generation
>
> Texas Instruments
>
> --
>
> 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
--

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
Reply | Threaded
Open this post in threaded view
|

Re: [EXTERNAL] Re: CMake and Ninja, RERUN_CMAKE useless?

CMake mailing list
That's the piece of the puzzle I was missing. Thank you!

Yes, I had deleted the cache because I thought that would force a complete regeneration. I'm using a rather complicated system of ExternalProjects (LLVM),  so I figured it was the quickest way to essentially force cmake to start from the beginning and reload those cache files without invalidating and forcing a rebuild of the executables and libraries I had already built

Is there a way to do what I was looking for? I wouldn't be surprised if there wasn't, since removing those very fundamental building blocks might as well just be an rm -rf ./*

JB

-----Original Message-----
From: Robert Maynard [mailto:[hidden email]]
Sent: Wednesday, October 9, 2019 7:16 AM
To: Nagurne, James
Cc: [hidden email]
Subject: [EXTERNAL] Re: [CMake] CMake and Ninja, RERUN_CMAKE useless?

The default generator and all other associated information ( '-D' ) is
kept in the CMakeCache.txt file in the root of the build directory.
The execution of `cmake -S <source_dir> -B <binary_dir>` will reload
this cache before doing anything else. Have you verified that your
build directory hasn't deleted this file?

On Tue, Oct 8, 2019 at 8:31 PM Nagurne, James via CMake <[hidden email]> wrote:

>
> Hi all,
>
>
>
> My question comes from a Ninja generator build system, and is specifically about an internal rule generated by cmake.
>
> What is the purpose of the RERUN_CMAKE rule generated by CMake with a Ninja generator?
>
>
>
> In the current repo, the only reference to this rule is in WriteTargetRebuildManifest here
>
> At line 1285, the rule is written out, seemingly as-is.
>
>
>
> According to lines 1274 to 1284, the only actual behavior of this command, which is executed whenever the source CMakeLists.txt file, files included from the CMakeLists, and some other CMake installation files change, is:
>
> cmake -S <source_dir> -B <binary_dir>
>
>
>
> This seems completely insufficient for “re-running” cmake. The most obvious flaw is the absence of the generator. When I’ve seen this rule fire, my Ninja build system adds a useless Makefile to the build system, and then (hopefully) continues building as if nothing had been done at all, without so much as inspecting that Makefile.
>
>
>
> What about command-line arguments like -D?
>
>
>
> Am I missing the purpose of this rule or potentially doing something non-standard? The reason I send an email is because this behavior is sending my project into a cmake loop where it detects build.ninja is out of date, re-runs cmake to generate a Makefile instead of a ninja build system, and then infinitely repeats because it never actually re-ran anything.
>
>
>
> Thanks,
>
> JB
>
> Code Generation
>
> Texas Instruments
>
> --
>
> 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
--

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
Reply | Threaded
Open this post in threaded view
|

Re: [EXTERNAL] Re: CMake and Ninja, RERUN_CMAKE useless?

CMake mailing list
If you want to do a clean rebuild you can do the following:
ninja clean or cmake --build <build_dir> --target clean
ninja or cmake --build <build_dir> -j N

On Wed, Oct 9, 2019 at 12:00 PM Nagurne, James <[hidden email]> wrote:

>
> That's the piece of the puzzle I was missing. Thank you!
>
> Yes, I had deleted the cache because I thought that would force a complete regeneration. I'm using a rather complicated system of ExternalProjects (LLVM),  so I figured it was the quickest way to essentially force cmake to start from the beginning and reload those cache files without invalidating and forcing a rebuild of the executables and libraries I had already built
>
> Is there a way to do what I was looking for? I wouldn't be surprised if there wasn't, since removing those very fundamental building blocks might as well just be an rm -rf ./*
>
> JB
>
> -----Original Message-----
> From: Robert Maynard [mailto:[hidden email]]
> Sent: Wednesday, October 9, 2019 7:16 AM
> To: Nagurne, James
> Cc: [hidden email]
> Subject: [EXTERNAL] Re: [CMake] CMake and Ninja, RERUN_CMAKE useless?
>
> The default generator and all other associated information ( '-D' ) is
> kept in the CMakeCache.txt file in the root of the build directory.
> The execution of `cmake -S <source_dir> -B <binary_dir>` will reload
> this cache before doing anything else. Have you verified that your
> build directory hasn't deleted this file?
>
> On Tue, Oct 8, 2019 at 8:31 PM Nagurne, James via CMake <[hidden email]> wrote:
> >
> > Hi all,
> >
> >
> >
> > My question comes from a Ninja generator build system, and is specifically about an internal rule generated by cmake.
> >
> > What is the purpose of the RERUN_CMAKE rule generated by CMake with a Ninja generator?
> >
> >
> >
> > In the current repo, the only reference to this rule is in WriteTargetRebuildManifest here
> >
> > At line 1285, the rule is written out, seemingly as-is.
> >
> >
> >
> > According to lines 1274 to 1284, the only actual behavior of this command, which is executed whenever the source CMakeLists.txt file, files included from the CMakeLists, and some other CMake installation files change, is:
> >
> > cmake -S <source_dir> -B <binary_dir>
> >
> >
> >
> > This seems completely insufficient for “re-running” cmake. The most obvious flaw is the absence of the generator. When I’ve seen this rule fire, my Ninja build system adds a useless Makefile to the build system, and then (hopefully) continues building as if nothing had been done at all, without so much as inspecting that Makefile.
> >
> >
> >
> > What about command-line arguments like -D?
> >
> >
> >
> > Am I missing the purpose of this rule or potentially doing something non-standard? The reason I send an email is because this behavior is sending my project into a cmake loop where it detects build.ninja is out of date, re-runs cmake to generate a Makefile instead of a ninja build system, and then infinitely repeats because it never actually re-ran anything.
> >
> >
> >
> > Thanks,
> >
> > JB
> >
> > Code Generation
> >
> > Texas Instruments
> >
> > --
> >
> > 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
--

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