[CMake] The C compiler "/usr/bin/cc" is not able to compile a simple test program.

Micha Hergarden micha.hergarden at gmail.com
Sun Jul 30 04:54:45 EDT 2017


On 30-07-17 04:36, jupiter wrote:
> I thought if I add -DCMAKE_CC_COMPILER=gcc that error should go, no,
> it still compile with the specific default cc:
>
> /usr/bin/cc ....
>
> How could I fix it?
>
> Thank you.
>
> On Sun, Jul 30, 2017 at 11:51 AM, jupiter <jupiter.hce at gmail.com
> <mailto:jupiter.hce at gmail.com>> wrote:
>
>     Hi,
>
>     How can I set up the cmake not to check /usr/bin/cc but to check
>     $CC (which link to gcc without hard corded path in the environment)?
>
>     Thank you.
>
>     Regards
>
>
>
>
>
Hello Jupiter,

Running the following sets the compiler to gcov:

CC=/usr/bin/gcov cmake ../

This outputs:

-- The C compiler identification is unknown
-- The CXX compiler identification is GNU 7.1.1
-- Check for working C compiler: /usr/bin/gcov
-- Check for working C compiler: /usr/bin/gcov -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done


As you can see cmake definitely uses the CC environment variable. What
is your OS? What do you set $CC to? What is the full commandline you use
to call cmake?
What happens if you set it the way I did?

Regards,
Micha
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20170730/964f60cc/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 525 bytes
Desc: OpenPGP digital signature
URL: <http://public.kitware.com/pipermail/cmake/attachments/20170730/964f60cc/attachment.sig>


More information about the CMake mailing list