[CMake] detecting first cmake run ?

Filipe Sousa filipe at ipb.pt
Mon Mar 20 07:55:21 EST 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Alexander Neundorf wrote:
> Hi, 
>  
> I can remember there was already this question, but I can't find it in 
> the archive. 
> Is there a way to detect the first run of cmake on a project ? 
>  
> I think there was something like CMAKE_FIRST_RUN, but this doesn't exist. 
>  
> Bye 
> Alex 
>  
> 
Just for fun:

IF(NOT DEFINED RUN_COUNTER)
  SET(RUN_COUNTER 0 CACHE INTERNAL "run counter")
ELSE(NOT DEFINED RUN_COUNTER)
  MATH(EXPR RUN_COUNTER "${RUN_COUNTER} + 1")
  SET(RUN_COUNTER ${RUN_COUNTER} CACHE INTERNAL "run counter")
ENDIF(NOT DEFINED RUN_COUNTER)

MESSAGE(STATUS ${RUN_COUNTER})

IF(RUN_COUNTER EQUAL 0)
  SET(FIRST_RUN 1)
ENDIF(RUN_COUNTER EQUAL 0)

IF(FIRST_RUN)
  MESSAGE(STATUS FIRST_RUN)
ENDIF(FIRST_RUN)


- --
Filipe Sousa
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.1 (GNU/Linux)

iD8DBQFEHqY5bQdNYqwwwCwRAt6YAJ4ydhvcWZikauqVwUqFKSa+E9ZukQCfWDx0
KsgsSAVJOcnuS05CTV9ISks=
=3LjF
-----END PGP SIGNATURE-----


More information about the CMake mailing list