Hi all,
I've been searching for an answer to the following problem, with no luck:
I have a CMake build that reads in some data from an external
(non-CMake) file during configuration.
I want to tell CMake that the configuration depends on this file, so
that the --check-build-system / check_cache steps will know to
automatically rebuild the project files / Makefiles / etc., whenever I
edit the external file.
Is this possible?
Here is an example test case to demonstrate the problem, I want the
project to know to rebuild when I change the version.txt file:
--
# Here is the test CMakeLists file that uses an external file:
$ cat CMakeLists.txt
cmake_minimum_required(VERSION 2.6)
file(STRINGS "version.txt" VERSION)
add_library(test t.cpp)
add_definitions("-DVERSION=@VERSION@")
# And here is the external file:
$ cat version.txt
1
# Do our first build.
$ make
[100%] Building CXX object CMakeFiles/test.dir/t.cpp.o
Linking CXX static library libtest.a
[100%] Built target test
# Modify the external file.
$ echo 2 > version.txt
# Now we rerun make, but nothing is rebuilt because CMake
# doesn't know the configuration depends on version.txt
$ make
[100%] Built target test
--
Thanks in advance,
- Daniel
--
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