我有一个简单的项目。它包含两个文件:
main.c
kernel.ispc
Run Code Online (Sandbox Code Playgroud)
(ispc 文件是https://ispc.github.io/ 的来源)
要手动编译文件,我将使用:
ispc --target=sse2 kernel.ispc -o kernel.o
gcc -c main.c -o main.o
gcc main.o kernel.o -o my_program
Run Code Online (Sandbox Code Playgroud)
所以对于我的 cmake 文件,它看起来像
project(my_program)
add_executable(my_program main.c)
Run Code Online (Sandbox Code Playgroud)
但当然它不会链接,因为它缺少 kernel.o 中的符号
所以问题是:如何让 cmakekernel.ispc使用ispc编译器进行编译,以及如何让 cmake 将其链接到my_program?