[CMake] automatically re-generating makefiles
Eric Noulard
eric.noulard at gmail.com
Thu Feb 26 07:04:22 EST 2009
2009/2/26 Alex Flint <alex.flint at gmail.com>:
> Hi there,
>
> I've noticed that when I run "make blah" then the makefile is
> automatically re-generated if I've changed anything in CMakeLists.txt
> since the last time I built "blah". However, if I add a new target to
> CMakeLists.txt then I have to run cmake manually or else I just get
> "to rule to make foo". This makes perfect sense but I was wondering if
> there is there any way to get cmake to put a catch-all rule in the
> Makefile that will cause CMakeLists.txt to be re-read even if a
> nonexistent target is specified on the commandline. Hence I would like
> to be able to add a target "foo" to CMakeLists.txt then just run "make
> foo" and cmake should be invoked to regenerate the makefile and the
> makefile should be invoked.
I think this already works if you call
"make"
and not
"make foo"
Because "existing target" do depends on "cmake_check_build_system"
which should check for CMakeLists.txt changes (not verified just a guess).
Would you confirm it make with "make" (no target) ?
If it works with "make" with no target but your added target is
excluded from ALL
I would say that you are currently stuck, because when you run
make <whatever_target>
make will look for that <whatever_target> before CMake gets a chance to
be executed. What you ask for is somehow to force cmake to be run
<each time> make is run.
Another question is could you tell us which version of CMake do you use?
> This might sound pointless but I actually
> have a good motivation that I'd be happy to discuss if anyone is interested...
Yes please tell us why you need that
I currently cannot imagine your "good motivations" :-)
--
Erk
More information about the CMake
mailing list