[CMake] Make add_custom_target depends on cmake macro/function

Mathieu Malaterre mathieu.malaterre at gmail.com
Mon Feb 23 07:37:24 EST 2015


Hi there,

I am trying to setup a rule which always execute, however it needs to
depends on a cmake macro. Here is an equivalent code:

[...]
cmake_minimum_required(VERSION 3.0)
string(TIMESTAMP curdate UTC)
add_custom_target(
  dummy ALL
  COMMAND echo "${curdate}"
  )
[...]

Is there any simple way to have the `dummy` rule re-execute the above
cmake TIMESTAMP macro ?

Thanks much,
-- 
Mathieu


More information about the CMake mailing list