[CMake] Adding a cmake makefile dependency

Daniel daniel at connect2.com
Sun Jul 29 05:57:28 EDT 2007


Brandon Van Every wrote:
>> The custom command would run cmake with the same arguments as in
>> cmake_check_build_system, but this seems like an ugly hack.
>>
>> Can anyone suggest a better way to do this?
> 
> Yes.  Quit trying to solve this problem and accept that you need to
> manually list your program files in CMakeLists.txt.  It's a non-issue
> once your project structure stabilizes.
> 

This would work, but for our team adding the source file into the Visual Studio 
project is our way of listing the program files, I would rather it didn't take 
us two steps to do this.  I do concede that it is not such a big deal to just 
list the source files manually, but others working on the project feel differently.

I ended up adding a new command to my copy of CMake that takes a list of 
filenames and adds them the list of Makefile dependencies by calling

void cmMakefile::AddCMakeDependFile(const char* file);

It's not as flexible as having a macro that does it, but it works.  I couldn't 
find a way to do this using the plugin system either since you are rather 
limited in what functions you can call.
--
Daniel





More information about the CMake mailing list