Quantcast

How to declare a text file as CMakeLists.txt dependency

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

How to declare a text file as CMakeLists.txt dependency

Gregor Jasny
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?

Thanks,
Gregor
--

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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to declare a text file as CMakeLists.txt dependency

Andreas Mohr
Hi,

On Tue, Apr 03, 2012 at 05:33:15AM -0400, [hidden email] wrote:

> Date: Tue, 03 Apr 2012 11:33:10 +0200
> From: Gregor Jasny <[hidden email]>
> Subject: [CMake] How to declare a text file as CMakeLists.txt
> dependency
> To: [hidden email]
> Message-ID: <[hidden email]>
> 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
--

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
Loading...