Re: [CMake] Run clean before automatically re-running cmake?

2014-02-22 Thread Abe Bachrach
Agreed that it is a bit heavyweight, but the stray files have resulted in
some pretty cryptic issues in the past (targets linking against an old
version of a library that got renamed etc...).

Your idea sounds good... I'll give it a try.

Thanks!
-=Abe

On Fri, Feb 14, 2014 at 8:55 AM, Bill Hoffman bill.hoff...@kitware.comwrote:

 On 2/14/2014 11:00 AM, Abe Bachrach wrote:

 I'd only want to do a full build if one of the CMakeLists.txt has
 changed (cmake needs to get re-run). Otherwise, I'd like to do a normal
 build.

 That seems a bit over kill to me.  I would rather have a few extra files
 than having a complete clean done each time a new file is added or a flag
 is changed in a CMake file.  Here is what you should do

 1. create a list of all the targets in your project
 2. use configure file to save the list, but be tricky so that it saves the
 last version of the file as well.
 3. add a custom command that all your targets depend on.  The custom
 command should depend on the file that is configured.  It will get run only
 when the file changes if you use copy on different.  When the custom
 command runs it should diff the two files and figure out what target went
 away, and then remove it.

 Basically, you should be able to do this all from the CMake language with
 custom commands and a CMake script.

 -Bill


 --

 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://www.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:
http://www.cmake.org/mailman/listinfo/cmake

Re: [CMake] Run clean before automatically re-running cmake?

2014-02-14 Thread Abe Bachrach
I'd only want to do a full build if one of the CMakeLists.txt has changed
(cmake needs to get re-run). Otherwise, I'd like to do a normal build.


On Thu, Feb 13, 2014 at 4:52 AM, Ian Liu Rodrigues ian.li...@gmail.comwrote:

  You are correct that I would prefer that behavior, however I'd prefer to
 go for safety (and do a full clean) until that more advanced logic can be
 implemented... I am in fact using ninja, so hopefully that feature may come
 down the pipe soon :-)


 If you want a full build, why don't you just rm -rf build  mkdir build
  cd build  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://www.cmake.org/mailman/listinfo/cmake

Re: [CMake] Run clean before automatically re-running cmake?

2014-02-14 Thread Bill Hoffman

On 2/14/2014 11:00 AM, Abe Bachrach wrote:

I'd only want to do a full build if one of the CMakeLists.txt has
changed (cmake needs to get re-run). Otherwise, I'd like to do a normal
build.
That seems a bit over kill to me.  I would rather have a few extra files 
than having a complete clean done each time a new file is added or a 
flag is changed in a CMake file.  Here is what you should do


1. create a list of all the targets in your project
2. use configure file to save the list, but be tricky so that it saves 
the last version of the file as well.
3. add a custom command that all your targets depend on.  The custom 
command should depend on the file that is configured.  It will get run 
only when the file changes if you use copy on different.  When the 
custom command runs it should diff the two files and figure out what 
target went away, and then remove it.


Basically, you should be able to do this all from the CMake language 
with custom commands and a CMake script.


-Bill

--

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://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] Run clean before automatically re-running cmake?

2014-02-13 Thread Ian Liu Rodrigues

 You are correct that I would prefer that behavior, however I'd prefer to
 go for safety (and do a full clean) until that more advanced logic can be
 implemented... I am in fact using ninja, so hopefully that feature may come
 down the pipe soon :-)


If you want a full build, why don't you just rm -rf build  mkdir build 
cd build  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://www.cmake.org/mailman/listinfo/cmake

[CMake] Run clean before automatically re-running cmake?

2014-02-12 Thread Abe Bachrach
Hi there,

The Makefile that cmake generates includes a rule to automatically re-run
cmake if any of the input CMakelists.txt files change.

Is there a way to configure this rule to have it run clean first?


Currently, if you change the name of an executable target (or library), it
will leave the old file in the output location, and then after re-running
cmake, the Makefile will not have any record of it, so running make clean
won't remove it.

I would rather have the rule call make clean before re-running cmake so
that such stray outputs are not left around.

Is there any way to accomplish this?

Thanks!
-=Abe
-- 

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://www.cmake.org/mailman/listinfo/cmake

Re: [CMake] Run clean before automatically re-running cmake?

2014-02-12 Thread Matthew Woehlke

On 2014-02-12 11:35, Abe Bachrach wrote:

The Makefile that cmake generates includes a rule to automatically re-run
cmake if any of the input CMakelists.txt files change.

Currently, if you change the name of an executable target (or library), it
will leave the old file in the output location, and then after re-running
cmake, the Makefile will not have any record of it, so running make clean
won't remove it.

I would rather have the rule call make clean before re-running cmake so
that such stray outputs are not left around.

Is there any way to accomplish this?


What you really want is to record the old list of output files, re-run 
CMake, then remove any files on that list that no longer have rules to 
generate them. If you do a complete 'clean' you will delete and have to 
rebuild more than is necessary (which might even be nothing e.g. if 
CMake is being re-run because you added a debugging message).


While that's probably hard to impossible¹ with 'make', I mention it 
because this feature (as described above) has at least been discussed 
for ninja², which does have the ability to implement it. (I'm not sure 
if it actually has been implemented or not, though.)


(¹ Use of recursive makefiles here doesn't help; probably each makefile 
would have to implement this logic, and each parent would have to know 
how to deal with directories that no longer exist in the build.)


(¹ http://martine.github.io/ninja/)

--
Matthew

--

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://www.cmake.org/mailman/listinfo/cmake

Re: [CMake] Run clean before automatically re-running cmake?

2014-02-12 Thread Abe Bachrach
On Wed, Feb 12, 2014 at 8:53 AM, Matthew Woehlke 
mw_tr...@users.sourceforge.net wrote:

 What you really want is to record the old list of output files, re-run
 CMake, then remove any files on that list that no longer have rules to
 generate them. If you do a complete 'clean' you will delete and have to
 rebuild more than is necessary (which might even be nothing e.g. if CMake
 is being re-run because you added a debugging message).



You are correct that I would prefer that behavior, however I'd prefer to go
for safety (and do a full clean) until that more advanced logic can be
implemented... I am in fact using ninja, so hopefully that feature may come
down the pipe soon :-)
-- 

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://www.cmake.org/mailman/listinfo/cmake