[CMake] Generating Source Files

Bill Hoffman bill.hoffman at kitware.com
Wed Apr 8 17:20:31 EDT 2009


Bill Hoffman wrote:
> Jeremy Cowgar wrote:
>> Bill Hoffman wrote:
>>> The file that is produced by the execute_process needs to be the one 
>>> that is included by cmake.   The idea was:
>>>
>>> if( file.cmake does not exist or it is older than eu core files)
>>>    generate file.cmake
>>>
>>> include(file.cmake)
>>
>> Bill, the problem is this section:
>>
>> SET( EU_CORE_UPDATE 0 )
>> FOREACH( file ${EU_CORE_FILES} )
>>  MESSAGE( "Checking ${file}" )
>>  IF( "${CMAKE_SOURCE_DIR}/source/${file}" IS_NEWER_THAN 
>> "${INT_BUILD_DIR}/int.cmake" )
>>    SET( EU_CORE_UPDATE 1 )
>>  ENDIF()
>> ENDFOREACH()
>>
>>
>> I added in a MESSAGE call. When I run cmake . then I get the message 
>> output and it does the right thing, if ${file} is newer than the 
>> int.cmake file, then everything is regenerated. However, now I move 
>> into my development cycle, I edit some code and then in my build 
>> directory type:
>>
>> C:\Develop\Euphoria\build > wmake
>>
>> When I issue that command, the MESSAGE( "Checking ..." ) is never 
>> displayed, and the code is never regenerated. I have to manually call 
>> cmake . and then things are regenerated as expected.
>>
> 
> If the included file is newer than the last run of cmake, cmake will 
> re-run during make.   In your code, it looks like you write two 
> different files:
> 
> "${CMAKE_SOURCE_DIR}/int.ex"
> and
> "${CMAKE_SOURCE_DIR}/interpreter/int.cmake"
> 
> I don't get it...
> 
Did you get a chance to try this:


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?

-Bill


More information about the CMake mailing list