Trying to create a custom target

I am trying to create a custom target which creates a downloadable image after linking.

I have an executable target, let’s call it some_ELF. I want to produce an image using an objcopy variant (diab compiler’s ddump, however).

I added

  1. add_executable ( “some_ELF<file list> )

  2. add_custom_command ( OUTPUT “some_bin”, COMMAND "ddump <options> -o “some_bin”* ), DEPENDS some_ELF )

  3. add_custom_target ( “BIN” DEPENDS “some_bin” )

First works well, more or less (my other post regarding IO redirect).

Third apparently also works. I get a corresponding directory under <BUILD>/CmakeFiles/. When I inspect build.make, I can see that BIN is added as .PHONY target.

Second does not show up in the entire <BUILD> tree. No rule is created to execute ddump … in dependency of some_ELF producing some_BIN

It appears that cmake does not properly connects (or, more likely, I havent configured it to do so) the .PHONY target with the file created by the custom command.

What am I missing?


Is that , in the source? That probably ends up triggering a warning anyways, but that shouldn’t be there.

It was the similar code, illustrating what I did. After having slept over it, I found the problem to be a typo in the targets DEPENDS. The real DEPENDS name contains some difficult to read characters, like 1,l.
I fell into that trap :expressionless: .

When typing the dependency correctly, then it surprisingly works. :wink:

Thanks anyways