[CMake] CMake finds wrong ar/ranlib/nm

Auer, Jens jens.auer at cgi.com
Tue Jul 28 04:39:17 EDT 2015


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
scl enable 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?

Best wishes,
  Jens Auer


--
Dr. Jens Auer | CGI | Software Engineer
CGI Deutschland Ltd. & Co. KG
Rheinstraße 95 | 64295 Darmstadt | Germany
T: +49 6151 36860 154
jens.auer at cgi.com<mailto:jens.auer at cgi.com>
Unsere Pflichtangaben gemäß § 35a GmbHG / §§ 161, 125a HGB finden Sie unter de.cgi.com/pflichtangaben<http://de.cgi.com/pflichtangaben>.

CONFIDENTIALITY NOTICE: Proprietary/Confidential information belonging to CGI Group Inc. and its affiliates may be contained in this message. If you are not a recipient indicated or intended in this message (or responsible for delivery of this message to such person), or you think for any reason that this message may have been addressed to you in error, you may not use or copy or deliver this message to anyone else. In such case, you should destroy this message and are asked to notify the sender by reply e-mail.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20150728/fca5e2bb/attachment-0001.html>


More information about the CMake mailing list