[Cmake] Force re-run of CMake from within CMake?

Amitha Perera perera at cs . rpi . edu
Fri, 31 Oct 2003 14:48:42 -0500


On Fri 31 Oct 2003, Andy Cedilnik wrote:
> Global generate always ignores results of try compile. So All you have
> to do is to somehow force global generate. One of the tricks is this:
> 
> IF(FORCE_GLOBAL_GENERATE)
>   FILE(WRITE "${CMAKE_CURRENT_BINARY_DIR}/some_file" "whatever")
>   SET(FORCE_GLOBAL_GENERATE OFF BOOL "" FORCE)
> ENDIF(FORCE_GLOBAL_GENERATE)
> IF(EXISTS ${CMAKE_CURRENT_BINARY_DIR}/some_file)
> CONFIGURE_FILE(${CMAKE_CURRENT_BINARY_DIR}/some_file
>   ${CMAKE_CURRENT_BINARY_DIR}/some_file.done)
> ENDIF(EXISTS ${CMAKE_CURRENT_BINARY_DIR}/some_file)

I apologise: this is still not clear to me. Is FORCE_GLOBAL_GENERATE a
special internal variable? When is it set? What role does the
CONFIGURE_FILE play in this? Why will this cause CMake to re-run?

Thanks,
Amitha.