On 02/17/2012 03:35 PM, Andrea Crotti wrote:
..
I can make the question much simpler, is it possible to generate targets
dynamically with CMake?
I was trying the following (nonsense), a simple loop over a list
that first generates a custom command and another loop
that generates a target for every command.
set(target_list uno due tre)
foreach (t ${target_list})
set(t_cmd ${t}.out)
add_custom_command(OUTPUT ${t_cmd}
COMMAND "ls ${t} > ${t_cmd}"
)
endforeach ()
foreach (t ${target_list})
message("analyzing target ${t}")
set(t_cmd ${t}.out)
add_custom_target(${t}
COMMAND ${t_cmd}
)
endforeach ()
I would suppose that this should work but it doesn't:
make[3]: uno.out: Command not found
make[3]: *** [CMakeFiles/uno] Error 127
make[2]: *** [CMakeFiles/uno.dir/all] Error 2
make[1]: *** [CMakeFiles/uno.dir/rule] Error 2
make: *** [uno] Error 2
Any idea why?
--
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake