I’m running into an issue with a custom target dependency that I want to assign to all source files. In this case, I have a helper library (lets call it utils) that builds a couple source
files that each depend on an output file from a separate process. It would look something like this:
# Show CMake how to build the file we need
# Create a target that requires the output file
add_custom_target(customTarget DEPENDS out.txt
# Create a list of source files
# Make all source files depend on the new target
# Assign source files to utils library, etc.
When CMake runs, two folders are created (in the folder bin/obj/system/libs/utils/CMakeFiles). They are called utils.dir and customTarget.dir. In utils.dir, we find our build.make file
and see the rules to produce the compiled object as well as the custom target:
The problem seems to be how the custom target is defined. For the object files, its simply the target name. The target itself appears to have a fully qualified path. This is giving me the
gmake: *** No rule to make target `customTarget, needed by ` system/libs/utils/CMakeFiles/utils.dir/helpers.o'. Stop.
If I manually edit the make file and change the target to the fully qualified name (and manually execute make) then the compilation succeeds. Is there something that I am doing wrong that
is incorrectly assigning the target name? Is there an alternative to the “set_source_files_properties” command that would behave better?