[CMake] Reading settings from generated files
Andrea Gualano
gualano at imavis.com
Tue May 20 13:00:44 EDT 2008
Hello everybody,
I have solved my original problem with a good amount of shell scripting,
but this seems to defy the purpose of a cross-platform tool.
Also, my question looks closely related to this other recent thread:
"Custom-Targets with unknown outputs", so I think this discussion may be
useful to other people.
Eric Noulard wrote:
> If you want to override a CACHE entry which may already exist you'll
> have to use FORCE
> SET (CMAKE_C_FLAGS "${MORE_FLAGS}" CACHE STRING "generated flags" FORCE)
> But in fact I don't know if CMake -P may/currently shares the
> CMakeCache.txt?
Actually, it looks like cmake -P does not modify the cache.
> Basically your need is to be able to run CMake twice, the first one
> fort generating
> some files and the second one to build.
>
> May be your read_flags.cmake could generate a file more_flags.cmake
> then your CMakeList.txt should do
>
> IF(EXISTS more_flags.cmake)
> INCLUDE(more_flags.cmake)
> ENDIF(EXISTS more_flags.cmake)
>
>
> or
> INCLUDE(more_flags.cmake OPTIONAL)
What I have done (and it does work) is:
- cmake
- make custom_target #this also generates more_flags.cmake
- cmake #again
- make
What is missing now, is that the second cmake should be invoked by the
custom target. This should make all dependecies work right.
Has anyone ever used this kind of two phase configuration?
Thanks,
Andrea
--
Andrea Gualano
ImaVis S.r.l.
email: gualano at imavis.com
More information about the CMake
mailing list