[CMake] triggering rebuild on windows
Philip Lowman
philip at yhbt.com
Mon Aug 31 21:45:19 EDT 2009
On Mon, Aug 31, 2009 at 8:02 PM, j s <j.s4403 at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090831/d5bfe2f5/attachment.htm>
More information about the CMake
mailing list