[CMake] using two different compilers together

Alex Flint alex.flint at gmail.com
Wed Feb 25 11:36:57 EST 2009


Hi there,

I'm trying to compile different parts of my application with different
compilers and I'm wondering how to do this within cmake. (The reason I
need this is that I'm using nvidia's cuda but the specifics of cuda
don't matter.) If I was to compile manually then my basic workflow
looks like this:

# compile the regular parts
g++ -o foo.cpp.o -c foo.cpp
...
# compile the cuda parts
nvcc -o bar.cu.o -c bar.cu.o
...
# link them together like normal (nvcc produces gcc-compatible object files)
g++ -o myprog foo.cpp.o bar.cu.o ...

I've tried a few ways of using add_custom_command and/or
add_custom_target but I haven't gotten anywhere. Can anyone tell me
how to do this?

Cheers,
Alex


More information about the CMake mailing list