yet add_custom_command question:
i have project in output of 1 custom command used input another, in different directory. example:
directory lib/cmakelists.txt
contains:
add_custom_command( output libfoo.xx command <command build libfoo.xx> ) add_custom_target(libfoo depends libfoo.xx)
directory test/cmakelists.txt
contains:
add_custom_command(output test.yy command <command build test.yy> depends "${project_binary_dir}/lib/libfoo.xx" )
so need make sure libfoo build before test.yy. docs depends clause of add_custom_command() can have file-level dependencies. let's try , see happens:
no rule make target 'lib/libfoo.xx', needed 'test/test.yy'. stop.
if on other hand, attempt create target-level dependency saying depends libfoo
, error changes to:
no rule make target 'libfoo', needed 'test/test.yy'. stop.
so seems neither file-level or target-level dependencies work here. there way have output 1 custom command input custom command, in different directory?
you try in test/cmaklists.txt
add
add_custom_target(test depends test.yy)
and add
add_dependencies(test libfoo)
in top-level cmakelists.txt
.
disclaimer: didn't test , i'm cmake beginner. tell if works!
Comments
Post a Comment