[CMake] Generating Source Files
Jeremy Cowgar
jeremy at cowgar.com
Wed Apr 8 17:27:30 EDT 2009
Bill Hoffman wrote:
> So, you are saying that "${CMAKE_BINARY_DIR}/interpreter/int.cmake"
> changes and cmake does not re-run? Can you look in
> CMakeFiles/Makefile.cmake? Should be in your binary tree, and it
> should have int.cmake as a CMAKE_MAKEFILE_DEPENDS.
>
> If you do a make VERBOSE=1 it should say something like:
> Re-run cmake file: CMakeFiles/cmake.check_cache older than:
> ${CMAKE_BINARY_DIR}/interpreter/int.cmake.
>
> From my previous post?
Yes, but I am saying that int.cmake is NOT updated when I run wmake.
That right there is our disconnect. What causes int.cmake to be updated is:
EXECUTE_PROCESS(
COMMAND ${TRANSLATOR} -cmakefile "${CMAKE_SOURCE_DIR}/source/int.ex"
WORKING_DIR ${CMAKE_CURRENT_BINARY_DIR} )
That causes int.cmake to be updated, not anything I am doing. Now, that
is inside of an IF statement:
IF( EU_CORE_UPDATE )
MESSAGE( "Translating interpreter..." )
EXECUTE_PROCESS(
COMMAND ${TRANSLATOR} -cmakefile "${CMAKE_SOURCE_DIR}/source/int.ex"
WORKING_DIR ${CMAKE_CURRENT_BINARY_DIR} )
ENDIF()
Now, EU_CORE_UPDATE is initially set to 0, however, I have the FOREACH
loop checking to see if any of my source files, such as parser.e, are
newer than the int.cmake, meaning that the source has changed since the
last EXECUTE_PROCESS has taken place and that a new EXECUTE_PROCESS has
to take place to make the translated sources be up to date... The
FOREACH loop I use to detect this is:
SET( EU_CORE_UPDATE 0 )
FOREACH( file ${EU_CORE_FILES} )
IF( "${CMAKE_SOURCE_DIR}/source/${file}" IS_NEWER_THAN
"${CMAKE_CURRENT_BINARY_DIR}/int.cmake" )
SET( EU_CORE_UPDATE 1 )
ENDIF()
ENDFOREACH()
Jeremy
More information about the CMake
mailing list