On Mon, Feb 23, 2015 at 1:37 PM, Mathieu Malaterre
<mathieu.malate...@gmail.com> wrote:
> 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 ?

Nevermind, that was easy:


cmake_minimum_required(VERSION 3.0)
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/dummy.cmake
"string(TIMESTAMP curdate UTC)
execute_process(COMMAND echo \"\${curdate}\")"
)
add_custom_target(
  dummy ALL
  COMMAND cmake -P ${CMAKE_CURRENT_BINARY_DIR}/dummy.cmake
  )

Sorry for the noise,
-- 
Mathieu
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

Reply via email to