[CMake] How can I change the compiler?

Maik Beckmann beckmann.maik at googlemail.com
Sun Nov 22 04:53:49 EST 2009


2009/11/22 Taesoo Kwon <taesoobear at gmail.com>:
> I am sorry that this should be an recurring question.
> But I wasn't able to find any working solution after hours of search.
>
> What I tried is as follows:
>
> /root/CMakeLists.txt
>
> set(CMAKE_CXX_COMPILER mpic++)
> set(CMAKE_C_COMPILER mpicc)

The CMakeLists.txt files define the project structure, but the
compiler is property of the system, not the project.

export CC=mpicc
export CXX=mpic++
mkdir build
cd build
cmake ..
make VERBOSE=1

should work.

HTH,
 -- Maik


More information about the CMake mailing list