<!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">
Philip Lowman wrote:
<blockquote
cite="mid:f168bb790910070522r9c30042gf6d8ab27bd9f624@mail.gmail.com"
type="cite">
<div class="gmail_quote">On Wed, Sep 30, 2009 at 5:24 AM, Martin Apel
<span dir="ltr"><<a moz-do-not-send="true"
href="mailto:martin.apel@simpack.de">martin.apel@simpack.de</a>></span>
wrote:<br>
<blockquote class="gmail_quote"
style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div 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>
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>
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>
</div>
</blockquote>
<div><br>
You are correct that conditionals don't work prior to project() in the
toplevel file but they seem to work fine within the platform override
.cmake file itself. You might try having one flags file with whatever
conditionals you need for Linux, Windows, etc.<br>
<br>
For example:<br>
<a moz-do-not-send="true"
href="avk-blocked://www.cmake.org/Wiki/CMake_FAQ#Make_Override_Files">http://www.cmake.org/Wiki/CMake_FAQ#Make_Override_Files</a><br>
</div>
</div>
<br>
-- <br>
Philip Lowman<br>
</blockquote>
Hi Philip,<br>
<br>
thanks for the info. This did the trick.<br>
<br>
Martin<br>
<br>
</body>
</html>