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

Andy Cedilnik andy . cedilnik at kitware . com
31 Oct 2003 14:37:49 -0500


Hi Amitha,

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)

			Andy

On Fri, 2003-10-31 at 14:29, Amitha Perera wrote:
> Is there a way to force CMake to re-run itself from within a
> CMakeLists.txt file?
> 
> The VXL project auto-determines a bunch of configuration options based
> on TRY_COMPILE and TRY_RUN tests. If the source for these tests is
> modified, I want to force CMake to re-run those tests, ignoring the
> cached values.