On Mon, Aug 31, 2009 at 8:02 PM, j s <j.s4...@gmail.com> wrote:

> I am doing cross-platform compilation.  I don't want everything to
> recompile on all platforms.  That is a risk with having a configuration
> header file.  If I remember correctly, cmake would ignore conditional
> include guards when doing dependency scanning.  Therefore:
> #ifdef WIN32
> #include "config.hh"
> #endif
>
> would trigger a compilation on all platforms if config.hh changed.
>
> I want everything to recompile on Windows, but not on my linux builds.
>

I think when he meant a config file he meant one created by CMake
dynamically (which would only affect one build anyways).

In other words:

config.h.in:
#cmakedefine FOO

CMakeLists.txt:
set(FOO true)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in
                   ${CMAKE_CURRENT_BINARY_DIR}/config.h)
include_directories(${CMAKE_CURRENT_BINARY_DIR})

config.h now includes "#define FOO 1"


Of course if all you need is the "unborkify MSVC so it supports math.h"
define then it's probably not worth it. :)


-- 
Philip Lowman
_______________________________________________
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

Reply via email to