Question

I am compiling code for an embedded system. The system is the Parallax Propeller for anyone curious, but you do not need to be familiar with it to answer my question.

The custom version of GCC (propgcc) has a new input and output file type: a .cogc file can be compiled into a .cog file.

I found CMake's add_custom_command (for anyone running across this that hasn't seen it, you may be interested in the documentation here) but I have not been able to figure out how to use it correctly. All examples I have seen use an exact file name for input and output instead of wildcards or the like. I don't want to compile a specific file, foo.cogc... I want allow the user of my toolchain file to compile any .cogc file.

So, short and sweet: how do I allow a user of my toolchain file to use a line such as

add_executable(foo.elf foo.cogc)

Thanks,

David

Was it helpful?

Solution

What you want to achieve is known in "make" lingvo as a "custom build rule". This feature is intentionally disabled in CMake.

The link here http://www.cmake.org/pipermail/cmake/2010-June/037733.html suggests what you could do: define a function that generates a custom command for its argument, then explicitly apply this function for each source file with extension cogc.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top