On 2013-12-02 12:58,
[email protected] wrote:
I just finished converting a large project from VC project files to Cmake
generated ones and am using file GLOBing to generate the file lists for
builds. This is working fine and I don't see the benefit to explicitly
specifying every file.
I know the docs recommend not using GLOB, but the only reason given is
that cmake won't do a rebuild when new files are added. This seems like a
limitation of the build system not a good reason.
More like a design choice made for various reasons; a major one (as Bill
alludes to) being performance.
So is there any good way to cause a CMake rebuild of a project when the
contents of the directory change? I am thinking something like outputting
the directory listing to a file (i.e. dir /b/s > filelist.txt) and adding
that file as some sort of dependency to the project. But I don't know
exactly how this would be done in practice.
Any ideas or canonical methods?
Idea: don't do that :-).
Besides what Bill mentioned, if you're working on a project with more
than one instance of the source tree (i.e. you are using VCS¹ and/or
have more than one developer), explicitly listing files helps with
'forgot to add' errors since other builds will explicitly try to build a
file that doesn't exist, thus making such mistakes obvious, rather than
failing at some other point because a source file is missing.
(¹ I recommend to - and do - use VCS even for personal projects. With
most DVCS's e.g. git, it's really easy to do so, and having a history is
invaluable, especially if the project later grows. Plus it's ever so
much easier to work on a project from multiple machines :-).)
--
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