On 7/28/2015 4:39 AM, Auer, Jens wrote:
Hi,

I am trying to use another compiler than the default one installed on my
system. I have to do this because I want to use a newer gcc than the one
on centos 7,so I installed RedHat Developer Toolset 3 with gcc 4.9. When
I call cmake with

sclenable devtoolset-3 “cmake ../src” in my build directory, it
generates makefiles which use the new compiler and linker, but still
uses the default /usr/bin/ar etc. This is problematic because I enable
whole-program-optimization in release mode, and this needs to use the ar
provided with gcc 4.9 to handle the link-time optimization object files.

I have tried various things to force cmake to use a specific ar, but
none of these worked:

-Manually set CMAKE_AR in the CMakeLists.txt

-Change CMAKE_AR in the cache

-Write my own toolchain file

With the toolchain file, cmake creates Makefiles but puts an empty ar
command in the lib “link” command, and building thus fails with an error.

Am I missing something?

This is an environment thing. Make sure the command line you are using is setup to find the other tools first in your PATH and it should work. CMake assumes the environment is setup to work with the compiler you want to use.

-Bill

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

Reply via email to