CMake add_custom_command pas en cours d'exécution

Je suis en train d'utiliser add_custom_command pour générer un fichier lors de la compilation. La commande ne semblait jamais être exécuté, alors j'ai fait ce fichier de test.

cmake_minimum_required( VERSION 2.6 )

add_custom_command(
  OUTPUT hello.txt
  COMMAND touch hello.txt
  DEPENDS hello.txt
)

J'ai essayé de courir:

cmake .  
make

Et hello.txt n'a pas été généré. Qu'ai-je fait de mal?

  • add_custom_target peut une alternative à add_custom_command