[CMake] PROJECT() command when cross compiling
kitts.mailinglists at gmail.com
Fri Jul 9 06:36:07 EDT 2010
On Wednesday 07 Jul 2010 8:54:52 pm Kishore wrote:
> On Friday 02 Jul 2010 12:36:17 am Kishore wrote:
> > On Friday 02 Jul 2010 12:07:07 am Alexander Neundorf wrote:
> > > On Thursday 01 July 2010, Kishore wrote:
> > > > It seems that the PROJECT() command does a fair bit behind the scenes
> > > > and is not documented enough. It seems to "reset" several variable
> > > > created before it was first called.
> > > >
> > > > Since i use cmake from cross compilation, i have created Platform
> > > > files for Generic-gcc.cmake and Generic-gcc-uc3b1256.cmake (for the
> > > > processor that I use)
> > > >
> > > > 1) It seems that these files are invoked inside the PROJECT() command
> > > > 2) The platform files set up some needed variables such as
> > > > CMAKE_C_FLAGS 3) When the PROJECT() command finishes, the variable
> > > > CMAKE_C_FLAGS is again empty.
> > >
> > > project() automatically enable the languages, if no languages are
> > > given, it tries C and C++. While doing this, a whole bunch of
> > > variables are set.
> > Fair enough. But then it should take into account the values i have set
> > for some of those variables in the platform modules. OTOH if it's wrong
> > to be setting those variables in the platform files where else should
> > they be set and what is the role of they platfrom modules?
> This does not seem to be well documented but the way to actually set the
> right values for those variable is to use the <VAR>_INIT form. This works
> as expected but is not a documented variable.
> Similarly, in my project, I want to configure in Release mode if the user
> does not explicitly specify any at cmake time. Again, the solution for
> this seems to be
> SET(CMAKE_BUILD_TYPE_INIT Release)
> i.e. set the variable CMAKE_BUILD_TYPE_INIT before the first call to
> PROJECT(). Hope this helps someone. I wonder how many such *_INIT
> variables are understood by cmake.
The price we pay for using undocumented features... And it turns out that
CMAKE_C_LINK_FLAGS_INIT is not an understood variable in cmake.
So far i know these work
CMake devs, are these variables just missing documentation or are they really
not meant to be used?
More information about the CMake