<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
I had a similar issue with CMAKE_SYSTEM_NAME. I have put platform
specific default settings into files called "Linux.cmake" and
"Windows.cmake",<br>
where the file is included as<br>
&nbsp; INCLUDE (${CMAKE_SYSTEM_NAME}.cmake)<br>
<br>
However it's not possible to initialize some variables, because this
include statement has to be after the PROJECT command.<br>
I tried to set CMAKE_EXE_LINKER_FLAGS_INIT inside these
platform-specific files, but it seems that it's too late to set them
after<br>
the PROJECT command. So I have a cycle:<br>
- I cannot use the above include statement before the PROJECT call<br>
- but if I use it after the PROJECT call I cannot set some variables
anymore (I can set them, but they have no effect, because in the above
example<br>
&nbsp; CMAKE_EXE_LINKER_FLAGS is initialized from
CMAKE_EXE_LINKER_FLAGS_INIT during the PROJECT call)<br>
<br>
Currently I work around this by not setting
CMAKE_EXE_LINKER_FLAGS_INIT, but CMAKE_EXE_LINKER_FLAGS inside my
Linux.cmake. This used to work fine with CMake 2.6, but 2.8 issues a
warning, that I am overwriting a cached variable.<br>
<br>
What is the recommended way to initialize platform-specific flags,
which are held in the cache?<br>
<br>
Regards,<br>
<br>
Martin<br>
<br>
Dieter Oberkofler wrote:
<blockquote cite="mid:4ac24969.0f345e0a.7ba3.ffffe2c1@mx.google.com"
 type="cite">
  <pre wrap="">Nothing wrong with calling project at the very beginning but in my case it
was quite at the end of the CMakeLists.txt file and this made it fail. I was
not aware of this "restriction" until now and did also not find any remarks
in the documentation.

  </pre>
  <blockquote type="cite">
    <pre wrap="">-----Original Message-----
From: Tyler Roscoe [<a class="moz-txt-link-freetext" href="mailto:tyler@cryptio.net">mailto:tyler@cryptio.net</a>]
Sent: Tuesday, September 29, 2009 19:45
To: Dieter Oberkofler
Cc: <a class="moz-txt-link-abbreviated" href="mailto:cmake@cmake.org">cmake@cmake.org</a>
Subject: Re: [CMake] CMAKE_SYSTEM not available

On Tue, Sep 29, 2009 at 07:42:09PM +0200, Dieter Oberkofler wrote:
    </pre>
    <blockquote type="cite">
      <pre wrap="">The installation looks ok but I guess I just found out what is wrong.
CMAKE_SYSTEM is only available after having used the PROJECT command.
Is this really a needed and required dependency?
      </pre>
    </blockquote>
    <pre wrap="">Is there some reason you want to avoid calling project()?

project() sets up a bunch of stuff. I guess you could try to call all
the relevant CMake modules yourself, but just putting a project(tmp) at
the top of your CMakeLists seems like a pretty good solution to me.

tyler
    </pre>
  </blockquote>
  <pre wrap=""><!---->
_______________________________________________
Powered by <a class="moz-txt-link-abbreviated" href="http://www.kitware.com">www.kitware.com</a>

Visit other Kitware open-source projects at <a class="moz-txt-link-freetext" href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a>

Please keep messages on-topic and check the CMake FAQ at: <a class="moz-txt-link-freetext" href="http://www.cmake.org/Wiki/CMake_FAQ">http://www.cmake.org/Wiki/CMake_FAQ</a>

Follow this link to subscribe/unsubscribe:
<a class="moz-txt-link-freetext" href="http://www.cmake.org/mailman/listinfo/cmake">http://www.cmake.org/mailman/listinfo/cmake</a>

  </pre>
</blockquote>
<br>
<br>
</body>
</html>