[CMake] CMake minimum required version

David Cole david.cole at kitware.com
Sat Aug 25 14:13:42 EDT 2012


Of course, having said that:

If you ever have a source file on disk that you DON'T want to include
in your build, then file(GLOB once again bends towards "evil"...


On Sat, Aug 25, 2012 at 2:12 PM, David Cole <david.cole at kitware.com> wrote:
> Your #2 is where our disconnect is.
>
>   "which will delete the build directory, recreate
>     it and rerun cmake, which will bring everything up to date"
>
> Most people here find it anathema to unnecessarily delete the build tree.
>
> If you are going to do THAT, then file(GLOB is entirely safe.
>
> If you have developers that want shortcuts, and don't want to do that,
> then file(GLOB should be avoided.
>
>
> :-)
>
> D
>
>
> On Sat, Aug 25, 2012 at 2:07 PM, Russell Wallace
> <russell.wallace at gmail.com> wrote:
>> I didn't claim you should have CMake do any such thing automatically,
>> did I say anything to suggest otherwise?
>>
>> The workflow I intend to use is:
>>
>> 1. I create src/foo.cc
>> 2. I type a command (which will delete the build directory, recreate
>> it and rerun cmake, which will bring everything up to date)
>>
>> I put it to you that this is strictly better (both easier and less
>> error-prone) than the workflow other people here are suggesting, which
>> is:
>>
>> 1. You create src/foo.cc
>> 2. You edit the list of files by hand
>> 3. You type a command
>>
>> On Sat, Aug 25, 2012 at 7:01 PM, David Cole <david.cole at kitware.com> wrote:
>>> And when should we inspect the file system to determine if you've
>>> added new files or not?
>>>
>>> Or should we *always* do that?
>>>
>>> If we always did that, people with source trees of thousands (and some
>>> with tens of thousands) of source files would immediately complain to
>>> us that CMake is too slow.
>>>
>>> How should we approach it then?
>>>
>>>
>>> On Sat, Aug 25, 2012 at 1:52 PM, Russell Wallace
>>> <russell.wallace at gmail.com> wrote:
>>>> Explicit in the actual set of .cc files that exist in the src directory.
>>>>
>>>> On Sat, Aug 25, 2012 at 6:48 PM, David Cole <david.cole at kitware.com> wrote:
>>>>> On Sat, Aug 25, 2012 at 1:38 PM, Russell Wallace
>>>>> <russell.wallace at gmail.com> wrote:
>>>>>> On Sat, Aug 25, 2012 at 12:41 PM, Rolf Eike Beer <eike at sf-mail.de> wrote:
>>>>>>> That sounds suspicious. From the documentation (cmake --help-command file):
>>>>>>>
>>>>>>>        We do not recommend using GLOB to
>>>>>>>        collect a list of source files from your source tree.  If no
>>>>>>>        CMakeLists.txt file changes when a source is added or removed then the
>>>>>>>        generated build system cannot know when to ask CMake to regenerate.
>>>>>>
>>>>>> Of course it can't, I wasn't expecting it to. That's not a reason to
>>>>>> violate DRY keeping the two lists in sync by hand! All you need to do
>>>>>> is issue a single command to scrub the build directory and re-create
>>>>>> it. Not only is that strictly less work, more importantly, it's
>>>>>> strictly less error-prone.
>>>>>> --
>>>>>>
>>>>>> Powered by www.kitware.com
>>>>>>
>>>>>> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>>>>>>
>>>>>> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>>>>>>
>>>>>> Follow this link to subscribe/unsubscribe:
>>>>>> http://www.cmake.org/mailman/listinfo/cmake
>>>>>
>>>>>
>>>>> Nobody's asking you to keep two lists in sync.
>>>>>
>>>>> We're recommending that you keep your one list in a CMakeLists.txt
>>>>> file (or something included by it) so that when you modify the list,
>>>>> CMake will automatically re-run.
>>>>>
>>>>> Where is your list of source files, if it's not explicit in the CMakeLists file?


More information about the CMake mailing list