I have a simple project. It contains two files:
main.c
kernel.ispc
(ispc files are source for https://ispc.github.io/)
To manually compile the file I would just use:
ispc --target=sse2 kernel.ispc -o kernel.o
gcc -c main.c -o main.o
gcc main.o kernel.o -o my_program
So for my cmake file it would look intially look like
project(my_program)
add_executable(my_program main.c)
but of course it wont link as it's missing symbols that are in kernel.o
So the question is:
How do I get cmake to compile kernel.ispc
using the ispc
compiler, and how do I get cmake to then link it into my_program
?
Just use add_custom_command:
From CMake view,
.o
files are just another sources for executable: