[CMake] configure_file without continuous re-build

Tyler Roscoe tyler at cryptio.net
Tue Jan 12 15:51:11 EST 2010


On Tue, Jan 12, 2010 at 02:09:36PM -0600, Daniel Blezek wrote:
> CONFIGURE_FILE(${DCMTK_SOURCE_DIR}/osconfig.h.in
>                ${DCMTK_BINARY_DIR}/include/dcmtk/config/osconfig.h)
> 
> However, every time I touch a CMake file, ³osconfig.h² is regenerated,
> causing nearly the entire library to re-build because of dependancies.  Is
> this a good/proper/recommended way to guard against regeneration of the
> file?

You could configure_file() to a temporary location, then
'cmake -E copy_if_different' from the temp location to the real
location. This way, the real osconfig.h is only updated (and the
dependent parts of the build are re-compiled) if something has changed.

tyler


More information about the CMake mailing list