Re: [CMake] Build-system dependency (as opposed to target)

2016-06-09 Thread James Turner

> On 9 Jun 2016, at 09:51, Petr Kmoch  wrote:
> 
> I believe you're looking for the directory property CMAKE_CONFIGURE_DEPENDS ( 
> https://cmake.org/cmake/help/latest/prop_dir/CMAKE_CONFIGURE_DEPENDS.html ). 
> Adding a file path to that property causes any changes to that file to 
> trigger a regeneration:
> 
>   set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS version)
> 
> If you are using CMake old enough not to have this property, an alternative 
> workaround is to run configure_file() on the file (even if you never use the 
> configured result). This will introduce the exact same dependency.

That is indeed exactly what I needed, I am trying to figure out if I would ever 
have got that from Googling. I never think of ‘running Cmake again’ as 
‘configure’ but it makes sense now you pointed it out.

Thank you again,
James



smime.p7s
Description: S/MIME cryptographic signature
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

Re: [CMake] Build-system dependency (as opposed to target)

2016-06-09 Thread Petr Kmoch
Hi James,

I believe you're looking for the directory property CMAKE_CONFIGURE_DEPENDS
( https://cmake.org/cmake/help/latest/prop_dir/CMAKE_CONFIGURE_DEPENDS.html
). Adding a file path to that property causes any changes to that file to
trigger a regeneration:

  set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS version)

If you are using CMake old enough not to have this property, an alternative
workaround is to run configure_file() on the file (even if you never use
the configured result). This will introduce the exact same dependency.

Petr
​
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

[CMake] Build-system dependency (as opposed to target)

2016-06-09 Thread James Turner
Hi,

Is there a way to make the entire build-system depend on a file? I have some 
data I’m reading into my CMakeList.txt via file(READ), and I want changes to 
that file to effectively act as if the CMakeList.txt itself was modified.

The read values are used to populate some variables via string parsing, which 
is then used in generated headers and a few other places:

> # read 'version' file into a variable (stripping any newlines or spaces)
> file(READ version versionFile)
> string(STRIP ${versionFile} FOO_VERSION)

The file is part of the source distribution alongside the build-system, it’s 
not user-supplied or anything complex like that.

Right now changes to the file contents don’t trigger the downstream variables 
being updated.

Kind regards,
James



smime.p7s
Description: S/MIME cryptographic signature
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake