[CMake] Makefile regeneration on added/removed files

Naram Qashat cyberbotx at cyberbotx.com
Fri Jan 16 13:47:08 EST 2009


Andreas Pakulat wrote:
> On 16.01.09 12:59:23, Naram Qashat wrote:
>> Is it possible to have CMake be re-run either automatically or via a 
>> Makefile target if files are added or removed from one of the directories 
>> that CMake has previously checked?  I know that checking for changed 
>> files is a job of the Makefile, but I am unaware if there is a way for 
>> either (g)make or CMake to check for files being added or removed.  If 
>> this can't be done, I will continue to recommend that CMake be re-run 
>> manually if files are added or removed.
> 
> I assume you're using GLOB to get the list of sources? This is considered
> to be bad practice, you should list your source files in the CMakeLists.txt
> file in which case adding a new file will re-run cmake automatically
> because you changed the CMakeLists.txt.
> 
> And to clearly answer your question: No its not possible to re-run cmake
> when you add a file, if you use GLOB-stuff to create the list of source
> files.
> 
> Andreas

Yeah, I'm using GLOB.  I suppose it's not a bad thing to require CMake to be 
re-run, but I was hoping there was an alternative.  Thanks for the clear answer, 
though.

Thanks,
Naram Qashat


More information about the CMake mailing list