[CMake] Generating Source Files

Jeremy Cowgar jeremy at cowgar.com
Wed Apr 8 16:37:32 EDT 2009


Bill Hoffman wrote:
> Jeremy Cowgar wrote:
>
>>
>>
>> INCLUDE( "${CMAKE_BINARY_DIR}/interpreter/int.cmake" )
>>
> 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.

No, "${CMAKE_BINARY_DIR}/interpreter/int.cmake" does not change.

SET( EU_CORE_UPDATE 0 )
FOREACH( file ${EU_CORE_FILES} )
  MESSAGE( "Checking file: ${file}" )
  IF( ${file} IS_NEWER_THAN "${CMAKE_SOURCE_DIR}/interpreter/int.cmake" )
    SET( EU_CORE_UPDATE 1 )
  ENDIF()
ENDFOREACH()

That should compare ${file} to determine if it's newer than the 
int.cmake file right? The int.cmake file is generated by the translator. 
EU_CORE_FILES contains a list of files that make up the translator 
source code (.e files). If any of those .e files (EU_CORE_FILES) are 
newer than int.cmake, then it should trigger a new translation run via: 
(which will generate a new int.cmake file as a result of the new 
translation):

IF( EU_CORE_UPDATE )
  MESSAGE( "Translating interpreter..." )
  EXECUTE_PROCESS(
    COMMAND ${TRANSLATOR} -cmakefile "${CMAKE_SOURCE_DIR}/int.ex"
    WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/interpreter" )
ENDIF()

At least that's what I was hoping for. Do I have something wrong?

Jeremy



More information about the CMake mailing list