According to Microsoft, the math macros are not part of standard C/C++:<br><a href="http://msdn.microsoft.com/en-us/library/4hwaceh6(VS.80).aspx">http://msdn.microsoft.com/en-us/library/4hwaceh6(VS.80).aspx</a><br><br>I'm not going to quibble with them on that point, as they were nice enough to provided them with:<br>
_USE_MATH_DEFINES<br><br>as an alternative. The problem is the config.h approach is I now have to include a config.h everywhere I want to use a math macro. Even worse is if I put all my platform dependent options in that file. If I put an unrelated macro change in that file, I just retriggered a rebuild for many files not requiring a rebuild. The potential for triggering unnecessary rebuilds anytime that file is regenerated is just not worth it.<br>
<br>I will quibble with Microsoft that Visual Studio does not detect when the compilation options change.<br><br>Regards,<br><br>Juan<br><br><div class="gmail_quote">On Mon, Aug 31, 2009 at 8:45 PM, Philip Lowman <span dir="ltr"><<a href="mailto:philip@yhbt.com">philip@yhbt.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="gmail_quote"><div class="im">On Mon, Aug 31, 2009 at 8:02 PM, j s <span dir="ltr"><<a href="mailto:j.s4403@gmail.com" target="_blank">j.s4403@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
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:<br>
#ifdef WIN32<br>#include "config.hh"<br>#endif<br><br>would trigger a compilation on all platforms if config.hh changed.<br><br>I want everything to recompile on Windows, but not on my linux builds.<br></blockquote>
</div><div><br>I think when he meant a config file he meant one created by CMake dynamically (which would only affect one build anyways).<br><br>In other words:<br><br><a href="http://config.h.in" target="_blank">config.h.in</a>:<br>
#cmakedefine FOO<br>
<br>CMakeLists.txt:<br>set(FOO true)<br>configure_file(${CMAKE_CURRENT_SOURCE_DIR}/<a href="http://config.h.in" target="_blank">config.h.in</a><br> ${CMAKE_CURRENT_BINARY_DIR}/config.h)<br>include_directories(${CMAKE_CURRENT_BINARY_DIR})<br>
<br>config.h now includes "#define FOO 1"<br><br><br>Of course if all you need is the "unborkify MSVC so it supports math.h" define then it's probably not worth it. :)<br><br></div></div><br>-- <br>
<font color="#888888">
Philip Lowman<br>
</font></blockquote></div><br>