Philip Lowman wrote: > On Wed, Sep 30, 2009 at 5:24 AM, Martin Apel <[email protected] > <mailto:[email protected]>> wrote: > > I had a similar issue with CMAKE_SYSTEM_NAME. I have put platform > specific default settings into files called "Linux.cmake" and > "Windows.cmake", > where the file is included as > INCLUDE (${CMAKE_SYSTEM_NAME}.cmake) > > However it's not possible to initialize some variables, because > this include statement has to be after the PROJECT command. > 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 > the PROJECT command. So I have a cycle: > - I cannot use the above include statement before the PROJECT call > - 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 > CMAKE_EXE_LINKER_FLAGS is initialized from > CMAKE_EXE_LINKER_FLAGS_INIT during the PROJECT call) > > 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. > > What is the recommended way to initialize platform-specific flags, > which are held in the cache? > > > 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. > > For example: > http://www.cmake.org/Wiki/CMake_FAQ#Make_Override_Files > <avk-blocked://www.cmake.org/Wiki/CMake_FAQ#Make_Override_Files> > > -- > Philip Lowman Hi Philip,
thanks for the info. This did the trick. Martin
_______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
