[CMake] How to force package target generate a file before proceeding
Shyrokov, Sasha
Sasha-Shyrokov at idexx.com
Tue Feb 17 16:14:36 EST 2015
Hi,
I would like to include a generated file into a package. I have something like that:
include(CPack)
add_custom_command (OUTPUT hgHash.txt
COMMAND hg --debug id -i >hgHash.txt
COMMENT "Getting hg hash")
add_custom_target (hg_hash
DEPENDS hgHash.txt
COMMENT "hg_hash target")
Now the following would solve my problems, but it does not work:
add_dependencies(package hg_hash)
I get:
Cannot add target-level dependencies to non-existent target "package".
I know I have CPack configured properly, because if I create the file manually it gets included. I also can add the dependency on one of my libraries, but I only want to generate this file when package is executed.
What am I missing?
Thanks,
Sasha
More information about the CMake
mailing list