[CMake] triggering rebuild on windows

j s j.s4403 at gmail.com
Mon Aug 31 20:02:42 EDT 2009


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.

Regards,

Juan

On Mon, Aug 31, 2009 at 1:30 PM, David Cole <david.cole at kitware.com> wrote:

> Your original question was about why not everything was recompiling...
> Then, when a solution is offered, you say "but if I do that everything will
> recompile!"
>
> We thought that's what you wanted... :-)
>
>
> On Mon, Aug 31, 2009 at 2:22 PM, j s <j.s4403 at gmail.com> wrote:
>
>> That wouldn't be good for what I am trying to do.  I just need:
>> _USE_MATH_DEFINES
>>
>> for all files so that Visual C++ recognizes M_PI.  Creating a header file
>> dependency could trigger a huge storm of recompilations just by touching the
>> file.
>>
>> I'll just have to be careful around Visual C++.
>>
>> Juan
>>
>> On Mon, Aug 31, 2009 at 11:16 AM, Clinton Stimpson <clinton at elemtech.com>wrote:
>>
>>>  On Sunday 30 August 2009 12:20:51 pm Philip Lowman wrote:
>>> > On Tue, Aug 25, 2009 at 1:32 PM, j s <j.s4403 at gmail.com> wrote:
>>> > > I am using the Visual Studio generator from the cmake binary
>>> > > distribution. If I change flags using ADD_DEFINITIONS, I notice that
>>> it
>>> > > doesn't trigger a rebuild of all the affected files.
>>> > >
>>> > > Is this by design?
>>> >
>>> > I've known and worked around this limitation for a few years now.  The
>>> > easiest thing to do is clean the entire solution if you change any
>>> compile
>>> > flags whatsoever (unless you know exactly what you changed and the
>>> impact
>>> > of doing it).
>>> >
>>> > The problem is that VS doesn't remember the old flags when you open up
>>> a
>>> > project file with new flags so isn't capable of cleaning the project
>>> for
>>> > you.  This issue could probably be worked around in CMake itself one
>>> way or
>>> > another but it's never been worked on to my knowledge.
>>>
>>> Or how about putting it into a configured header file instead?
>>> Visual Studio rebuilds correctly if you do it that way.
>>>
>>> Clint
>>>
>>>
>>
>> _______________________________________________
>> 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
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090831/02648806/attachment.htm>


More information about the CMake mailing list