On Fri, Jun 6, 2008 at 9:00 AM, Bill Hoffman <<a href="mailto:bill.hoffman@kitware.com">bill.hoffman@kitware.com</a>> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div></div><div class="Wj3C7c">Martin Apel wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Mike Jackson wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
typically, the PROJECT() statement is the first line of your CMakeLists.txt. Could you explain your project layout a bit more?<br>
<br>
<br>
</blockquote>
I found out, that CMAKE_CXX_FLAGS is set to the compound of $ENV{CXXFLAGS} and the platform-specific default at the time, the PROJECT statement is executed.<br>
In order to preset CMAKE_CXX_FLAGS I tried to set $ENV{CXXFLAGS} from within the CMakeFile. Thus this setting has to be done before the PROJECT statement, otherwise<br>
CMAKE_CXX_FLAGS is already set. So I tried to include an external file by<br>
INCLUDE (${CMAKE_SYSTEM_NAME}.cmake)<br>
before the PROJECT statement. This doesn't work, because ${CMAKE_SYSTEM_NAME} is not set at that time.<br>
<br>
When setting CMAKE_CXX_FLAGS after the PROJECT statement, the CMake-local variable is set correctly, but the cache is not updated. The situation I tried to achieve, was to preset<br>
the cache variable CMAKE_CXX_FLAGS to include certain compiler flags. If the user looked at the cache e.g. by using ccmake, he would also see and be able to edit those additional flags.<br>
By setting the flags later, you only change the CMake-local variable, but never the cache value, which is somewhat irritating, because the compile happens with other flags than can be seen using<br>
ccmake.<br>
</blockquote>
<br></div></div>
You want to use this variable:<br>
CMAKE_USER_MAKE_RULES_OVERRIDE<br>
<br>
You can set that to a file that will be loaded at the right time so you can set the cache variables yourself.</blockquote><div><br>Wow this is an old thread. Sorry for the late response.<br><br>I think
what's needed here is a way to detect the platform and allow people to
modify CMAKE_CXX_FLAGS and friends before they get cemented in stone in
the cache. IIRC doesn't CMAKE_USER_MAKE_RULES_OVERRIDE put the onus on
the user to know the proper platform, compiler, etc. before they set
the flags?<br><br></div></div>-- <br>Philip Lowman