[CMake] using two different compilers together
Alexander Neundorf
a.neundorf-work at gmx.net
Wed Feb 25 15:35:10 EST 2009
On Wednesday 25 February 2009, Alex Flint wrote:
> 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
I guess this should be
nvcc -o bar.cu.o -c bar.cu
?
I think this means support adding for another language, cuda.
For a quite simple example you can have a look at the files for assembler
support:
CMakeDetermineASMCompiler.cmake (loaded first)
CMakeTestASMCompiler.cmake (loaded 2nd)
CMakeASMInformation.cmake (loaded 3rd)
CMakeASMCompiler.cmake.in (configured by CMakeDetermineASMCompiler.cmake to
CMakeASMCompiler.cmake in the build tree, so it's loaded every time cmake
runs on the build tree)
If you set CMAKE_CUDA_LINKER_PREFERENCE lower than 10 (that's the value for C
in CMakeCCompiler.cmake.in then always the C or C++ linkers will be used if
you mix these languages.
Alex
More information about the CMake
mailing list