Sep 01

cmake hint: when the c compiler is set to a c++ compiler

Category: Linux   — Published by goeszen on September 1, 2015 at 5:04 pm

Here's what to do when CMAKE_C_COMPILER is set to a C++ compiler.

While compiling openCV, I ran into this error message:

"The CMAKE_C_COMPILER is set to a C++ compiler"

when I executed

cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..

according to the openCV install guide

Via a github issue (more exactly here) I found the cure for that:

You need to tell cmake to use gcc as the compiler for c++ files, like so:

add this "-D CMAKE_C_COMPILER=gcc" to the cmake switches, for example:

cmake -D CMAKE_C_COMPILER=gcc -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local /tmp/opencv-3.0.0

Leave a Reply

=