I am creating a target to generate a script using add_custom_target(). Now I want to install it, but:
install(TARGETS) fails with “install TARGETS given target “script” which is not an executable, library, or module.” and I can’t find a way to tell cmake that this target has TYPE EXECUTABLE
install(PROGRAMS) would allow me to specify “TYPE EXECUTABLE”, but does not appear to let me specify a file from build tree, only source tree
What did I miss ?
Moreover, the “correct way” to use add_custom_target() seems to be together with add_custom_command() if we want proper dependency handling. But then it seems I have to give different names to the “command” (which takes the output file name) and to the target. And then I’m at a loss as to how install(TARGETS) can be used at all: specifying the file name does not work as it is not a target name, and specifying the target name naturally does not work as it’s not the file name. So what ?