[CMake] Generating Source Files

Bill Hoffman bill.hoffman at kitware.com
Wed Apr 8 17:15:48 EDT 2009


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...

-Bill



More information about the CMake mailing list