Executable depending on all source files

classic Classic list List threaded Threaded
17 messages Options
Reply | Threaded
Open this post in threaded view
|

Executable depending on all source files

Russell Wallace
How do you specify that an executable depends on all source files in a
directory? I've tried doing it like:

add_executable(foo src/*.cc)

but that only seems to pick up the first source file?
--

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
Reply | Threaded
Open this post in threaded view
|

Re: Executable depending on all source files

Alexander Neundorf-3
On Saturday 25 August 2012, Russell Wallace wrote:
> How do you specify that an executable depends on all source files in a
> directory? I've tried doing it like:
>
> add_executable(foo src/*.cc)
>
> but that only seems to pick up the first source file?


Explicitely list all of them.
Globbing is not good, cmake can't notice then when it has to rerun, and it may
pick up stuff it shouldn't.

Alex
--

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
Reply | Threaded
Open this post in threaded view
|

Re: Executable depending on all source files

Russell Wallace
I don't understand what you mean, but explicit listing violates DRY in
a big way with the usual consequence, the two lists will inevitably
get out of sync. I'd rather use globbing (unless CMake has some other
method that doesn't involve trying to keep things in sync by hand)?
Even plain Make can use globbing reliably.

On Sat, Aug 25, 2012 at 10:41 AM, Alexander Neundorf
<[hidden email]> wrote:

> On Saturday 25 August 2012, Russell Wallace wrote:
>> How do you specify that an executable depends on all source files in a
>> directory? I've tried doing it like:
>>
>> add_executable(foo src/*.cc)
>>
>> but that only seems to pick up the first source file?
>
>
> Explicitely list all of them.
> Globbing is not good, cmake can't notice then when it has to rerun, and it may
> pick up stuff it shouldn't.
>
> Alex
--

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
Reply | Threaded
Open this post in threaded view
|

Re: Executable depending on all source files

Kornel Benko

Am Samstag, 25. August 2012 um 10:53:48, schrieb Russell Wallace <[hidden email]>

> I don't understand what you mean, but explicit listing violates DRY in

> a big way with the usual consequence, the two lists will inevitably

> get out of sync. I'd rather use globbing (unless CMake has some other

> method that doesn't involve trying to keep things in sync by hand)?

> Even plain Make can use globbing reliably.

 

The you may want to try

file(GLOB foo_sources . src/*.cc)

add_executable(foo ${foo_sources})

 

> On Sat, Aug 25, 2012 at 10:41 AM, Alexander Neundorf

> <[hidden email]> wrote:

> > On Saturday 25 August 2012, Russell Wallace wrote:

> >> How do you specify that an executable depends on all source files in a

> >> directory? I've tried doing it like:

> >>

> >> add_executable(foo src/*.cc)

> >>

> >> but that only seems to pick up the first source file?

> >

> >

> > Explicitely list all of them.

> > Globbing is not good, cmake can't notice then when it has to rerun, and it may

> > pick up stuff it shouldn't.

> >

> > Alex

 

Kornel

 


--

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

signature.asc (205 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Executable depending on all source files

Alexander Neundorf-3
In reply to this post by Russell Wallace
On Saturday 25 August 2012, Russell Wallace wrote:
> I don't understand what you mean, but explicit listing violates DRY in
> a big way with the usual consequence, the two lists will inevitably
> get out of sync.

Yes, but here this is good IMO, since in general a file laying around in some
directory does not necessarily belong to the project.

> I'd rather use globbing (unless CMake has some other
> method that doesn't involve trying to keep things in sync by hand)?

There is not much "trying" involved. You notice immediately if a file is
missing in your CMakeLists.tx or if you list a file which does not exist.

> Even plain Make can use globbing reliably.

You can use file(GLOB ...), but it is not recommended.
When a new file is added to a target, cmake needs to rerun, to generate the
rules for building this file and to link the target.
In the makefiles generated by cmake there is the dependency to rerun cmake
when any of its input files have changed (e.g. when you added or removed a
source file), but there is no rule to rerun cmake if anything in a directory
has changed. So simply adding a file to a directory will not cause cmake to
rerun automatically.
By having to add that file explicitely to the CMakeLists.txt, cmake will rerun
and you will always have a consistent build system.

Alex
--

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
Reply | Threaded
Open this post in threaded view
|

Re: Executable depending on all source files

Russell Wallace
In reply to this post by Kornel Benko
On Sat, Aug 25, 2012 at 10:59 AM, Kornel Benko <[hidden email]> wrote:
> The you may want to try
>
> file(GLOB foo_sources . src/*.cc)
>
> add_executable(foo ${foo_sources})

That works, thanks!
--

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
Reply | Threaded
Open this post in threaded view
|

Re: Executable depending on all source files

Kornel Benko
In reply to this post by Alexander Neundorf-3

Am Samstag, 25. August 2012 um 12:04:21, schrieb Alexander Neundorf <[hidden email]>

> On Saturday 25 August 2012, Russell Wallace wrote:

> > I don't understand what you mean, but explicit listing violates DRY in

> > a big way with the usual consequence, the two lists will inevitably

> > get out of sync.

>

> Yes, but here this is good IMO, since in general a file laying around in some

> directory does not necessarily belong to the project.

>

> > I'd rather use globbing (unless CMake has some other

> > method that doesn't involve trying to keep things in sync by hand)?

>

> There is not much "trying" involved. You notice immediately if a file is

> missing in your CMakeLists.tx or if you list a file which does not exist.

 

If a file is missing, you notice it in both cases.

 

If you add a file (without touching CMakeLists.txt of course) you will not notice in both cases.

 

> > Even plain Make can use globbing reliably.

>

> You can use file(GLOB ...), but it is not recommended.

> When a new file is added to a target, cmake needs to rerun, to generate the

> rules for building this file and to link the target.

> In the makefiles generated by cmake there is the dependency to rerun cmake

> when any of its input files have changed (e.g. when you added or removed a

> source file), but there is no rule to rerun cmake if anything in a directory

> has changed. So simply adding a file to a directory will not cause cmake to

> rerun automatically.

> By having to add that file explicitely to the CMakeLists.txt, cmake will rerun

> and you will always have a consistent build system.

>

> Alex

 

Kornel

 


--

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

signature.asc (205 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Executable depending on all source files

Rolf Eike Beer
In reply to this post by Kornel Benko
Kornel Benko wrote:

> Am Samstag, 25. August 2012 um 10:53:48, schrieb Russell Wallace
> <[hidden email]>
> > I don't understand what you mean, but explicit listing violates DRY in
> > a big way with the usual consequence, the two lists will inevitably
> > get out of sync. I'd rather use globbing (unless CMake has some other
> > method that doesn't involve trying to keep things in sync by hand)?
> > Even plain Make can use globbing reliably.
>
> The you may want to try
> file(GLOB foo_sources . src/*.cc)
> add_executable(foo ${foo_sources})
No, you surely don't want to do that. From the documentation of it (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.

Simple solution: do something like find . -type f -name \*.cc | sed 's,^\./,,'
>> CMakeLists.txt and move the result at the correct place in that file.

Eike
--
--

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

signature.asc (205 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Executable depending on all source files

Eric Noulard
In reply to this post by Russell Wallace
2012/8/25 Russell Wallace <[hidden email]>:
> I don't understand what you mean, but explicit listing violates DRY in
> a big way with the usual consequence, the two lists will inevitably
> get out of sync. I'd rather use globbing (unless CMake has some other
> method that doesn't involve trying to keep things in sync by hand)?
> Even plain Make can use globbing reliably.

Besides the argument of tracking changes, portability comes in mind as well.
Does XCode, Visual Studio, Eclipse (with managed Makefile)
etc... do handle globbing as well ?

CMake should be able to generate project files for all these build
system so that relying on the fact that Make may handle globbing is not enough
for making it work for CMake.

Does your VCS (git, cvs, svn,...) do globbing for adding/removing files ?
Probably not and for good reasons, the same rule apply for CMake.

What you 'could do' is to craft some scripts (CMake or else) that
may automagically update the extensive list of sources in your CMakeLists.txt.
This script may be launched by a CMake custom target of yours, e.g.
then you'll be able to do

make up_src_list

instead of editing the CMakeLists.txt manually,
that said I doubt it would be  worth the effort.

My point of view is that globbing for source is seldom useful unless
the sources files are generated.

My opinion though.
--
Erk
Le gouvernement représentatif n'est pas la démocratie --
http://www.le-message.org
--

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
Reply | Threaded
Open this post in threaded view
|

Re: Executable depending on all source files

Russell Wallace
On Sat, Aug 25, 2012 at 2:19 PM, Eric Noulard <[hidden email]> wrote:
> Does your VCS (git, cvs, svn,...) do globbing for adding/removing files ?

Git. And yes, of course it does.

> What you 'could do' is to craft some scripts (CMake or else) that
> may automagically update the extensive list of sources in your CMakeLists.txt.
> This script may be launched by a CMake custom target of yours, e.g.
> then you'll be able to do
>
> make up_src_list
>
> instead of editing the CMakeLists.txt manually,

Sure, that would have been my fallback, treat CMakeLists.txt as object
code and write a Python script to maintain it automatically. But
adding an extra layer like that is strictly inferior to a solution
that works within CMake.
--

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
Reply | Threaded
Open this post in threaded view
|

Re: Executable depending on all source files

Eric Noulard
2012/8/25 Russell Wallace <[hidden email]>:
> On Sat, Aug 25, 2012 at 2:19 PM, Eric Noulard <[hidden email]> wrote:
>> Does your VCS (git, cvs, svn,...) do globbing for adding/removing files ?
>
> Git. And yes, of course it does.

No sorry, I wasn't clear enough
unless I'm wrong you can do:

git add blah*.c

but :
   1) If you add an extra blah-whatever.c file after the git command
       then git won't handle the file.

   2) When you manually suppress a file you still have to do
       git rm blah-whatever.c

   3) In my example, git is not doing the globbing, the shell does.
       I know you can ask git to handle a pattern of file (and not the shell)
       but this like FILE(GLOB ...) for cmake

My point is when file "appear" or "disappear" you have to *manually*
inform git about it. Updating the list of source from within a CMakeLists.txt
is exactly the same process.

>> What you 'could do' is to craft some scripts (CMake or else) that
>> may automagically update the extensive list of sources in your CMakeLists.txt.
>> This script may be launched by a CMake custom target of yours, e.g.
>> then you'll be able to do
>>
>> make up_src_list
>>
>> instead of editing the CMakeLists.txt manually,
>
> Sure, that would have been my fallback, treat CMakeLists.txt as object
> code and write a Python script to maintain it automatically. But
> adding an extra layer like that is strictly inferior to a solution
> that works within CMake.

You can write a CMake-script that create a FileList.cmake which
contains only a variable definition:
set(SOURCE_LIST blah.c toto.c)

then in your CMakeLists.txt you do

add_custom_target(GenSrcLst
                                 COMMAND ${CMAKE_COMMAND} -P YourScript.cmake)

include(FileList.cmake)
add_executable(YourExe ${SOURCE_LIST})

that way your CMakeLists.txt is almost as before and
you can find the way you want to re-generate FileList.cmake
**when needed** with a

make GenSrcLst

without considering the whole CMakeLists.txt an "object file".

All "within" CMake.

I still don't find it "necessary" but it should work without too
much manual  edition.

You will still need to git add / rm the files.
--
Erk
Le gouvernement représentatif n'est pas la démocratie --
http://www.le-message.org
--

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
Reply | Threaded
Open this post in threaded view
|

Re: Executable depending on all source files

Russell Wallace
No, you can type e.g. 'git add .' to add all newly created files to
the repository.

It is true that you do have to prompt git to do that, it won't go off
looking for new files on its own initiative. And I'm not expecting
cmake to go off looking for new files on its own initiative either; as
another poster observes, that could cause slowdown for very large
projects. I expect to have to prompt cmake about new files (by
cleaning up the build directory). But that's a very different thing
from trying to keep file lists in sync by hand!

On Sat, Aug 25, 2012 at 7:01 PM, Eric Noulard <[hidden email]> wrote:

> No sorry, I wasn't clear enough
> unless I'm wrong you can do:
>
> git add blah*.c
>
> but :
>    1) If you add an extra blah-whatever.c file after the git command
>        then git won't handle the file.
>
>    2) When you manually suppress a file you still have to do
>        git rm blah-whatever.c
>
>    3) In my example, git is not doing the globbing, the shell does.
>        I know you can ask git to handle a pattern of file (and not the shell)
>        but this like FILE(GLOB ...) for cmake
>
> My point is when file "appear" or "disappear" you have to *manually*
> inform git about it. Updating the list of source from within a CMakeLists.txt
> is exactly the same process.
>
>>> What you 'could do' is to craft some scripts (CMake or else) that
>>> may automagically update the extensive list of sources in your CMakeLists.txt.
>>> This script may be launched by a CMake custom target of yours, e.g.
>>> then you'll be able to do
>>>
>>> make up_src_list
>>>
>>> instead of editing the CMakeLists.txt manually,
>>
>> Sure, that would have been my fallback, treat CMakeLists.txt as object
>> code and write a Python script to maintain it automatically. But
>> adding an extra layer like that is strictly inferior to a solution
>> that works within CMake.
>
> You can write a CMake-script that create a FileList.cmake which
> contains only a variable definition:
> set(SOURCE_LIST blah.c toto.c)
>
> then in your CMakeLists.txt you do
>
> add_custom_target(GenSrcLst
>                                  COMMAND ${CMAKE_COMMAND} -P YourScript.cmake)
>
> include(FileList.cmake)
> add_executable(YourExe ${SOURCE_LIST})
>
> that way your CMakeLists.txt is almost as before and
> you can find the way you want to re-generate FileList.cmake
> **when needed** with a
>
> make GenSrcLst
>
> without considering the whole CMakeLists.txt an "object file".
>
> All "within" CMake.
>
> I still don't find it "necessary" but it should work without too
> much manual  edition.
>
> You will still need to git add / rm the files.
> --
> Erk
> Le gouvernement représentatif n'est pas la démocratie --
> http://www.le-message.org
--

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
Reply | Threaded
Open this post in threaded view
|

Re: Executable depending on all source files

Eric Noulard
2012/8/25 Russell Wallace <[hidden email]>:
> No, you can type e.g. 'git add .' to add all newly created files to
> the repository.

Yes I know but git handling is "binary" either a file is handled
by git or not.

With CMake a source could be
  - to be added to some add_library (1 or several)
  - to be added to some add_executable (1 or several)
  - configure with configure_file(...)
  - simply installed with install(...)


> It is true that you do have to prompt git to do that, it won't go off
> looking for new files on its own initiative. And I'm not expecting
> cmake to go off looking for new files on its own initiative either; as
> another poster observes, that could cause slowdown for very large
> projects. I expect to have to prompt cmake about new files (by
> cleaning up the build directory).

Like I said even if the new file is a "cpp" file, should CMake add
it to add_executable or add_library or...

I know that you want to specify the "to be added" file spec using
a GLOB expression but then what we may need currently would be
a mechanism to cleanly trigger the refresh or the list of file.
FILE(GLOB ...) was not meant for that.

In my opinion if (I don't know if it's reasonable) we would want
to fullfil your need we would need something like a new variable type:

set(MYSOURCES "*.cpp" CACHE FILELIST)

then

cmake --refresh
would freshen such type of variables.


> But that's a very different thing
> from trying to keep file lists in sync by hand!

From my experience with various modest size projects using CMake
keeping the list of file in sync by hand was fast and efficient,
but obviously I'm not sitting in your chair.

Usually people seems to want "pattern matching list of file" when
they switch to CMake or begin to use it on an existing project,
when CMake is there as build system I think people just
get used to manually add some file once upon a time.

Just curious,
Are you currently moving a lot of project to CMake?

--
Erk
Le gouvernement représentatif n'est pas la démocratie --
http://www.le-message.org
--

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
Reply | Threaded
Open this post in threaded view
|

Re: Executable depending on all source files

Russell Wallace
On Sun, Aug 26, 2012 at 8:55 AM, Eric Noulard <[hidden email]> wrote:
> Like I said even if the new file is a "cpp" file, should CMake add
> it to add_executable or add_library or...

If different C++ source files have different purposes, I would put
them in different directories.

> I know that you want to specify the "to be added" file spec using
> a GLOB expression but then what we may need currently would be
> a mechanism to cleanly trigger the refresh or the list of file.
> FILE(GLOB ...) was not meant for that.

That's okay, I'm happy to trigger the refresh by deleting and
re-creating the build directory. CMake seems to work fine for this as
it currently stands. My biggest concern right now is the various
problems with correctly finding and linking with boost, which is what
I wanted cmake for in the first place.

> Just curious,
> Are you currently moving a lot of project to CMake?

No, just one project.
--

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
Reply | Threaded
Open this post in threaded view
|

Re: Executable depending on all source files

Eric Noulard
2012/8/26 Russell Wallace <[hidden email]>:
> On Sun, Aug 26, 2012 at 8:55 AM, Eric Noulard <[hidden email]> wrote:
>> Like I said even if the new file is a "cpp" file, should CMake add
>> it to add_executable or add_library or...
>
> If different C++ source files have different purposes, I would put
> them in different directories.

Ok, this is a common way of work but currently CMake does not enforce that,
so we cannot rely on it either.

>> I know that you want to specify the "to be added" file spec using
>> a GLOB expression but then what we may need currently would be
>> a mechanism to cleanly trigger the refresh or the list of file.
>> FILE(GLOB ...) was not meant for that.
>
> That's okay, I'm happy to trigger the refresh by deleting and
> re-creating the build directory. CMake seems to work fine for this as
> it currently stands. My biggest concern right now is the various
> problems with correctly finding and linking with boost, which is what
> I wanted cmake for in the first place.

Boost+CMake specialist will probably answer those
this is clearly not my expertise area.

>> Just curious,
>> Are you currently moving a lot of project to CMake?
>
> No, just one project.

Then I bet in a couple of week you'll probably be please
with the CMake way of work.

Not saying that CMake should not improve but as with
other tool startup time exists.

--
Erk
Le gouvernement représentatif n'est pas la démocratie --
http://www.le-message.org
--

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
Reply | Threaded
Open this post in threaded view
|

Re: Executable depending on all source files

Rolf Eike Beer
In reply to this post by Russell Wallace
Russell Wallace wrote:
> On Sun, Aug 26, 2012 at 8:55 AM, Eric Noulard <[hidden email]>
wrote:

> > Like I said even if the new file is a "cpp" file, should CMake add
> > it to add_executable or add_library or...
>
> If different C++ source files have different purposes, I would put
> them in different directories.
>
> > I know that you want to specify the "to be added" file spec using
> > a GLOB expression but then what we may need currently would be
> > a mechanism to cleanly trigger the refresh or the list of file.
> > FILE(GLOB ...) was not meant for that.
>
> That's okay, I'm happy to trigger the refresh by deleting and
> re-creating the build directory. CMake seems to work fine for this as
> it currently stands. My biggest concern right now is the various
> problems with correctly finding and linking with boost, which is what
> I wanted cmake for in the first place.
You need to rerun CMake. Explicitely doing "cmake ." in the build directory
should work, no need to delete everything.

Eike
--
--

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

signature.asc (205 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Executable depending on all source files

Alexander Neundorf-3
In reply to this post by Russell Wallace
On Sunday 26 August 2012, Russell Wallace wrote:
> On Sun, Aug 26, 2012 at 8:55 AM, Eric Noulard <[hidden email]>
wrote:

> > Like I said even if the new file is a "cpp" file, should CMake add
> > it to add_executable or add_library or...
>
> If different C++ source files have different purposes, I would put
> them in different directories.
>
> > I know that you want to specify the "to be added" file spec using
> > a GLOB expression but then what we may need currently would be
> > a mechanism to cleanly trigger the refresh or the list of file.
> > FILE(GLOB ...) was not meant for that.
>
> That's okay, I'm happy to trigger the refresh by deleting and
> re-creating the build directory.

No need to do that, you can rerun cmake either by manually rerunning it, e.g.
in the buildtree simply do "cmake .", or via "make rebuild_cache".

So if you use
file(GLOB ....)
in the CMakeLists.txt to collect your source files, "make rebuild_cache" will
rerun cmake and glob again.

Alex
--

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