1

Despite setting the CMAKE_CXX_COMPILER and CMAKE_C_COMPILER in CMake, doing make on the Makefiles generated by CMake invokes the clang linker.

I want it to use the system g++and gcc compiler. I am on OSX Sierra.

Am I missing a setting somewhere? Here is my CMake setting screenshot.

With clang, I can't get a C++ library compiled as it cannot find libpng which is sitting right in my \usr\local\lib. I thought I give it a go with system g++ and gcc compilers.

CMake setting clang linker why?

dr_rk
  • 4,395
  • 13
  • 48
  • 74
  • 5
    gcc is an alias for clang on OSX (please complain to Apple). – Marc Glisse Mar 24 '17 at 09:57
  • The standard way to set up CMake to use the compiler you want is: starting with an empty binary directory, set up your environment (`PATH`, `CC`, `CXX` variables etc.) to the compiler you want to use. Then run CMake in that environment. Does it work for you if you do this? – Angew is no longer proud of SO Mar 24 '17 at 09:58
  • Thank you for pointing about `gcc` and aliases! Good point about emptying the binary directory. It still failed after emptying and re-compiling.. `clang` doesn't have `\usr\local\lib` in its library path and so the linker fails. I have posted a new question: http://stackoverflow.com/questions/42997218/add-library-search-path-to-clang – dr_rk Mar 24 '17 at 10:39

1 Answers1

0

As stated in the comments by Mark Glisse,

gcc is an alias for clang on OSX (please complain to Apple).

starball
  • 20,030
  • 7
  • 43
  • 238