[CMake] How to declare a text file as CMakeLists.txt dependency
Andreas Mohr
andi at lisas.de
Tue Apr 3 07:01:53 EDT 2012
Hi,
On Tue, Apr 03, 2012 at 05:33:15AM -0400, cmake-request at cmake.org wrote:
> Date: Tue, 03 Apr 2012 11:33:10 +0200
> From: Gregor Jasny <gjasny at googlemail.com>
> Subject: [CMake] How to declare a text file as CMakeLists.txt
> dependency
> To: cmake at cmake.org
> Message-ID: <4F7AC3D6.6020004 at googlemail.com>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> Hello,
>
> In my root project CMakeLists.txt file I'm using the file(STRINGS ...)
> command to read some version numbers from a text file. Now I'd like to
> declare this text file as a CMakeLists.txt dependency to re-trigger the
> CMake configuration step if a version number changes (Just like
> re-configuration is triggered if I touch any CMakeLists.txt file).
>
> Is there an easy way to accomplish this?
Hrmm, I should be knowing this fully, but somehow I'm currently not
entirely sure, but IMHO using configure_file() should provide exactly that.
I.e. configure_file() from original file to the destination file
which you then file(STRINGS...), and it should trigger re-configure
whenever the original file changed.
Andreas Mohr
More information about the CMake
mailing list