qt5base-lts/cmake/QtFileConfigure.txt.in
Alexandru Croitor e510a4e327 CMake: Introduce qt_configure_file
It has the same kind of signature as file(GENERATE) but
creates the files at configure time rather than generation time.

CMake provides a few ways to generate files
file(WRITE) -> always overrides content
configure_file() -> only overrides if content changes, creates file
                    at configure time, can only take a file as input
file(GENERATE)   -> only overrides if content changes, creats file
                    at generation time, can take a string or file
                    as input

Because dealing with an input file is a hassle (need to create one,
make sure it's installed, make sure it's used correctly in the
various build types like super-build, non-prefix-build, etc)
people tend to use file(GENERATE) instead, which can take a string
argument, and is thus easier to use.

Unfortunately that introduces subtle bugs because the
file is created at generation time, but there are existence
checks which are done at configuration time.

Thus qt_configure_file allows creation of files at configure time,
without having to provide an input file. Underneath it uses
configure_file(). Once CMake 3.18 is released, the implementation
can be switched to use file(CONFIGURE).

Change-Id: Ic8f8d88541ef0b25d01af143352c8c9ba390ad5f
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-03-23 09:54:56 +01:00

2 lines
30 B
Plaintext

@__qt_file_configure_content@