MantisBT - CMake
View Issue Details
0015312CMakeCMakepublic2014-12-16 17:002016-06-10 14:31
Alan Scott 
Kitware Robot 
normalminoralways
closedmoved 
AllAllAll
CMake 3.0.2 
 
0015312: setting CMAKE_AR doesn't work
From a user (Dave K):

when using the intel compilers, you need to use their "ar" tool, xiar. The first issue is that the intel ar utility is not automatically recognized when the compiler is intel. The second issue is that setting the CMAKE_AR variable does not propagate to the CMakeFiles/<version>/CMakeCCompiler and CMakeCXXCompiler files (so it's effectively ignored)

This becomes evident when using -ip and -ipo optimization flags (since they fail with static libraries linked with ar vs xiar)

No tags attached.
Issue History
2014-12-16 17:00Alan ScottNew Issue
2014-12-16 17:23Nils GladitzNote Added: 0037470
2014-12-16 17:25Nils GladitzNote Edited: 0037470bug_revision_view_page.php?bugnote_id=37470#r1646
2014-12-16 17:39Alan ScottNote Added: 0037471
2014-12-17 08:39Brad KingNote Added: 0037473
2016-06-10 14:29Kitware RobotNote Added: 0042689
2016-06-10 14:29Kitware RobotStatusnew => resolved
2016-06-10 14:29Kitware RobotResolutionopen => moved
2016-06-10 14:29Kitware RobotAssigned To => Kitware Robot
2016-06-10 14:31Kitware RobotStatusresolved => closed

Notes
(0037470)
Nils Gladitz   
2014-12-16 17:23   
(edited on: 2014-12-16 17:25)
You can try setting INTERPROCEDURAL_OPTIMIZATION [1] (or the configuration specific variants) which should add -ipo and trigger use of xiar.

[1] http://www.cmake.org/cmake/help/v3.0/prop_dir/INTERPROCEDURAL_OPTIMIZATION.html [^]

P.S. also exists as target property.

(0037471)
Alan Scott   
2014-12-16 17:39   
Thanks, that adds a second workaround for the bug that we know about. Note that it looks like it needs to be set in the CMakeLists.txt as it's not explicitly exposed to cmake/ccmake.

It would be nicer if either CMAKE_AR propagated correctly and was used (vs ignored) or was auto-detected.
(0037473)
Brad King   
2014-12-17 08:39   
The INTERPROCEDURAL_OPTIMIZATION property is the intended interface for enabling ipo, not a workaround. The code to detect and use xiar for ipo is here:

 http://www.cmake.org/gitweb?p=cmake.git;a=blob;f=Modules/Platform/Linux-Intel.cmake;hb=v3.0.2#l21 [^]

Also one can set CMAKE_AR on the *first* run in a given build tree. That is when CMakeFiles/${version}/CMake${lang}Compiler.cmake is created.
(0042689)
Kitware Robot   
2016-06-10 14:29   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.