[CMake] Optional .cmake files and rebuilding makefiles
Brad King
brad.king at kitware.com
Tue Jul 12 13:38:20 EDT 2005
Richard Wackerbarth wrote:
> Following Brad's suggestion, I have
>
> SET(HAS_PASSED_MY_TEST 0)
> INCLUDE(${CMAKE_CURRENT_BINARY_DIR}/Passed_My_Test.cmake OPTIONAL)
>
> IF (NOT HAS_PASSED_MY_TEST)
> ADD_TEST( RunMyTest
> ${CMAKE_CURRENT_BINARY_DIR}/MyTestProgram
> )
> ENDIF (NOT HAS_PASSED_MY_TEST)
>
>
> If the test succeeds, it writes the file
> ${CMAKE_CURRENT_BINARY_DIR}/Passed_My_Test.cmake
> as
> SET(HAS_PASSED_MY_TEST 1)
>
> The next time that cmake runs, the test is suppressed until I clean out
> the binary directory tree.
> This is just what I want to happen.
>
> My problem is that it takes some additional change to get cmake to run.
> If I run the test and have no other changes, the next run still
> includes the test because nothing triggers cmake to run.
> But as soon as I change some other CMakeList.txt file, cmake runs and
> rebuilds the makefiles to suppress the test.
>
> How can I set up a dependency which both tolerates the non-existence of
> "Passed_My_Test.cmake" and triggers the rebuilding of the makefiles
> when this file is created or changes?
CMake should be able to re-run automatically when the file is removed.
Please submit a bug report here:
http://www.cmake.org
for this to be investigated.
Meanwhile you can probably fix the problem by writing an empty file
instead of deleting it. The new modification time should cause CMake to
re-run.
-Brad
More information about the CMake
mailing list