[CMake] Should changing, adding or removing add_definitions call trigger a recompile of affected files

Philip Lowman philip at yhbt.com
Fri Dec 12 00:09:31 EST 2008


On Wed, Dec 10, 2008 at 3:53 PM, David Cole <david.cole at kitware.com> wrote:

> Why wouldn't having this:// CMAKE_CXX_FLAGS = '@CMAKE_CXX_FLAGS@'
>
> in the header.h.in file at configure time solve the issue of recompiling
> if you change the compilation flags? If you change the flags, CMake will
> change header.h when it configures it...
>
> Or this:
> #if 0
> CMAKE_CXX_FLAGS = '@CMAKE_CXX_FLAGS@'
> #endif
>
> if you're worried about whether the flags contain something that might
> break a compiler if found on a comment line... (Like a \ at the end of the
> line...?)
>
> Am I missing something?
>

That's a good suggestion except you wouldn't be able to do it with
CMAKE_CXX_FLAGS, you'd have to coax the definitions out of CMake some other
way because CMAKE_CXX_FLAGS doesn't contain the results of
ADD_DEFINITIONS().

There is unfortunately another major drawback to this solution.  If you
don't already use a <config.h> include file in your software project, it's
going to be a lot of work to switch.

-- 
Philip Lowman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20081212/5eda917c/attachment-0001.htm>


More information about the CMake mailing list