MantisBT - CMake
View Issue Details
0007487CMakeCMakepublic2008-08-13 17:472016-06-10 14:30
Jason Spiro 
Brad King 
normalfeaturealways
closedmoved 
CMake-2-6 
 
0007487: Please change FILE(GLOB) not to find hidden files or directories
When I do FILE(GLOB cpp_files *.cpp), CMake finds all *.cpp files. Sadly, this includes Emacs and XEmacs lockfiles[1]. These files are saved in the same directory as the normal source files, but they are dotfiles (Unix hidden files) whose names start with dot-pound, e.g.:

          .#main.cpp

I do not want CMake to find those files, and I assume that most programmers think likewise.[2] Please change the GLOB command[3] so that it does not find files or directories whose name starts with a dot.

Cheers,
-Jason

Footnotes:
^ [1]. http://tekman.livejournal.com/79598.html [^]
^ [2]. I can only think of one case where programmers *do* need to think about dotfiles: C and C++ programmers who use GNU Libtool, in the cases where they need to look inside the hidden directories that Libtool creates. You can read more about these hidden directories at http://makepp.sourceforge.net/1.40.1/makepp_scanning.html#libtool. [^] But I think it would be rare for anyone to use GLOB to try to find things inside Libtool hidden directories. They probably only want a few libraries from inside there, not dozens of files like I assume most GLOB users would want. So they are much more likely to specify the individual libraries they want by typing their full filenames.
^ [3]. Tip: The FILE(GLOB) command is defined by cmFileCommand::HandleGlobCommand. That method uses calls kwsys/Glob.cxx to do most of the work.
No tags attached.
Issue History
2008-08-13 17:47Jason SpiroNew Issue
2008-08-13 18:07Jason SpiroNote Added: 0013004
2008-08-19 16:45Bill HoffmanStatusnew => assigned
2008-08-19 16:45Bill HoffmanAssigned To => Brad King
2008-08-19 16:51Brad KingNote Added: 0013087
2012-08-13 10:36Brad KingStatusassigned => backlog
2012-08-13 10:36Brad KingNote Added: 0030499
2016-06-10 14:27Kitware RobotNote Added: 0041444
2016-06-10 14:27Kitware RobotStatusbacklog => resolved
2016-06-10 14:27Kitware RobotResolutionopen => moved
2016-06-10 14:30Kitware RobotStatusresolved => closed

Notes
(0013004)
Jason Spiro   
2008-08-13 18:07   
Boost.Build, a competitor to CMake, has the same problem. I told them too, at http://zigzag.cs.msu.su/boost.build/ticket/199 [^]
(0013087)
Brad King   
2008-08-19 16:51   
We recommend against using file(GLOB) to collect a list of source files. If you add a source file, you should explicitly update CMakeLists.txt file to list it. Then CMake will automatically re-run and handle the dependencies.
(0030499)
Brad King   
2012-08-13 10:36   
Sending issues I'm not actively working on to the backlog to await someone with time for them.

If an issue you care about is sent to the backlog when you feel it should have been addressed in a different manner, please bring it up on the CMake mailing list for discussion. Sign up for the mailing list here, if you're not already on it:

 http://www.cmake.org/mailman/listinfo/cmake [^]

It's easy to re-activate a bug here if you can find a CMake developer or contributor who has the bandwidth to take it on.
(0041444)
Kitware Robot   
2016-06-10 14:27   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.