[CMake] Adding a cmake makefile dependency
Daniel
daniel at connect2.com
Sat Jul 28 01:02:11 EDT 2007
I am using CMake to build MinGW Makefiles in Windows and using Visual Studio to
develop and build from. In my CMakeLists.txt files, I use file globbing to
create the list of source files. The problem with this is that CMake cannot
tell when I add or remove source files to know that it needs to rerun CMake.
One idea I had was to try and use the .vcproj files, which are updated whenever
you add or remove a file, as dependencies that would trigger cmake to run again
if they change.
It seems that CMake creates a target that runs CMake with the
--check-build-system argument against the files in CMakeFiles/Makefile.cmake,
where CMAKE_MAKEFILE_DEPENDS is set to the files that when changed will trigger
CMake to rerun. Unfortunately I cannot find a way to add to this file in my
CMakeLists.txt files. One way I could fix this is to generate a whole new file
and create a custom command and target and set all the other targets to depend
on it. 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?
--
Daniel
More information about the CMake
mailing list