[CMake] configure_file without continuous re-build
Daniel Blezek
Blezek.Daniel at mayo.edu
Tue Jan 12 17:07:25 EST 2010
Hi Mike,
Sorry, I guess I wasn't quite clear. The re-builds occur when I touch any
CMakeLists.txt file in the entire project. Since we're under active
development, new source files are being added fairly frequently. I didn't
want re-builds to trigger each time a developer adds a new class.
I believe that configure_file() is re-run whenever CMake does a
"Generate", not only when the .in file is modified. On a normal build this
isn't an issue, but is a problem for us.
Putting the "NOT EXISTS" guard seems to solve the problem, but is a little
ugly.
Cheers,
-dan
On 1/12/10 3:00 PM, "Michael Jackson" <mike.jackson at bluequartz.net> wrote:
> you shouldn't have to do that. There are multitudes of projects that
> do exactly what you are doing and don't have continuous rebuilds. Now,
> having said that I am _assuming_ that osconfig.h.in is NOT being
> changed, generated, updated or in any way changed? osconfig.h.in being
> changed would cause "configure_file()" to re-run which will regenerate
> the osconfig.h file.
>
> Early in the HDF5/CMake port we were doing exactly that which
> caused HDF5 to be rebuilt just about completely because the "H5conf.h"
> file was always being generated at cmake time.
>
> _________________________________________________________
> Mike Jackson mike.jackson at bluequartz.net
> BlueQuartz Software www.bluequartz.net
> Principal Software Engineer Dayton, Ohio
>
> On Jan 12, 2010, at 3:51 PM, Tyler Roscoe wrote:
>
>> 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
>> _______________________________________________
>> 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
>
> _______________________________________________
> 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
--
Daniel Blezek, PhD
Medical Imaging Informatics Innovation Center
P 127 or (77) 8 8886
T 507 538 8886
E blezek.daniel at mayo.edu
Mayo Clinic
200 First St. S.W.
Harwick SL-44
Rochester, MN 55905
mayoclinic.org
More information about the CMake
mailing list