On 1. Jun, 2010, at 16:23 , Hariharan wrote:

> First off, I apologize if this is a very newbie-level question.
> I need to set the value of a variable based on based on generated files,
> using the "file" command. Something like:
> file(GLOB varFoo "*.cpp")
> 
> Here the cpp files are generated, so the value of varFoo comes up as empty
> when the build runs the first time. Is there any way to add a dependency on
> the file generation step to the "file" command?

Such a design is very likely to never work properly. Always try very hard to 
avoid file(GLOB). Presumably you are using ADD_CUSTOM_COMMAND to generate the 
files, right? So you should be able to infer the names of the generated files. 
It might be a bit more work to program, but is definitely worth the effort.

The problem with file(GLOB) is that CMake is a Meta-buildsystem which generates 
a build-systems for various generators. This also means that CMake will not be 
able to tell when you add or remove files, requiring you to remember to re-run 
CMake by hand.

Michael

_______________________________________________
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 via email to