<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
<div name="messageBodySection" style="font-size: 14px; font-family: -apple-system, BlinkMacSystemFont, sans-serif;">Hi,
<div><br /></div>
<div>To manage specific flags for ar command, you can rely on rules override (see variable <a href="https://cmake.org/cmake/help/latest/variable/CMAKE_USER_MAKE_RULES_OVERRIDE.html">CMAKE_USER_MAKE_RULES_OVERRIDE</a> and <a href="https://cmake.org/cmake/help/latest/variable/CMAKE_USER_MAKE_RULES_OVERRIDE_LANG.html">CMAKE_USER_MAKE_RULES_OVERRIDE_<LANG></a>).</div>
<div><br /></div>
<div>I have attached some example I used in the past to manage cleanly 32 and 64 bits builds on AIX.</div>
<div>And to use these files, set variable CMAKE_USER_MAKE_RULES_OVERRIDE_CXX <b>before</b> the project command:</div>
<div>...</div>
<div>set (CMAKE_USER_MAKE_RULES_OVERRIDE_CXX /to/path/${CMAKE_CXX_COMPILER_ID}-CXX-Override.cmake)</div>
<div>…</div>
<div>project (…)</div>
<div><br /></div>
<div><br /></div>
<div>To create an archive holding the shared object may be the most efficient is to create a script (bash or Make script is OK) to do both actions and override variable CMAKE_CXX_CREATE_SHARED_LIBRARY:</div>
<div>set(CMAKE_CXX_CREATE_SHARED_LIBRARY<br />
                « /to/my/link/script <TARGET> <CMAKE_CXX_COMPILER> <CMAKE_SHARED_LIBRARY_CXX_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS>  <SONAME_FLAG><TARGET_SONAME> -o <OBJECT_DIR>/shr.so <OBJECTS> <LINK_LIBRARIES>)<br /></div>
<div><br /></div>
<div><br /></div>
</div>
<div name="messageReplySection" style="font-size: 14px; font-family: -apple-system, BlinkMacSystemFont, sans-serif;">Le 17 déc. 2018 à 23:07 +0100, Rob Boehne <robb@datalogics.com>, a écrit :<br />
<blockquote type="cite" style="margin: 5px 5px; padding-left: 10px; border-left: thin solid #1abc9c;">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt">AIX supports two types of shared libraries, AIX-style, and System 5 (SYSV) compatibility libraries.  CMake is currently set up to exclusively work with SYSV-style (read the ld man pages for -brtl).</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">To do this I’m attempting to set the commands to override linking shared libraries.  The default setup forces generating an exports list, which also gives me problems because I explicitly provide one (that is then overridden by the generated list, which comes out empty in my case).  The set commands below almost work, one of the problems is that I can’t see any way to pass flags to commands like “/bin/ar”.  Under AIX, tools like ar, nm, etc. have a strict “object file mode” that can be altered with the -X command line argument.  I couldn’t find any place to pass -X64 or -X32 to /bin/ar, and setting CMAKE_AR with a space in it results in CMAKE_AR==”/bin/ar;-X64” which is not what I want.  Adding double quotes fails because they aren’t escaped, so the command ends up being  sent with argv[0]==”/bin/ar -X64” which fails.  Escaping the space like you see below results in the same behavior.   I don’t have any static archives in the project, but I’m pretty sure there would be problems with them.   I want to create the output of the first command to look like the target filename but with a file extension of “so” rather than “a” but I don’t see any way to do that.</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">    elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "AIX")</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">        if(${CMAKE_CXX_COMPILER_ID} STREQUAL "XL")</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">            if(CMAKE_SIZEOF_VOID_P MATCHES "8")</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">                set(CMAKE_AR /bin/ar\ -X64)</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">            else()</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">                set(CMAKE_AR /bin/ar\ -X32)</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">            endif()</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">            # override the broken commands cmake uses to build shared libs on AIX with XLC</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">            set(CMAKE_SHARED_LIBRARY_SUFFIX ".a")</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">            set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">            set(CMAKE_SHARED_LINKER_FLAGS_INIT "")</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">            set(CMAKE_EXTRA_SHARED_LIBRARY_SUFFIXES ".so")</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">            set(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "-bM:SRE -bnoentry")</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">            set(CMAKE_CXX_CREATE_SHARED_LIBRARY</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">                "<CMAKE_CXX_COMPILER> <CMAKE_SHARED_LIBRARY_CXX_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS>  <SONAME_FLAG><TARGET_SONAME> -o <OBJECT_DIR>/shr.so <OBJECTS> <LINK_LIBRARIES>;<CMAKE_AR> -cru <TARGET> <OBJECT_DIR>/shr.so"</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">                 )</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:11.0pt"> </span></p>
<table class="MsoNormalTable" border="0" cellspacing="0" cellpadding="0" width="392" style="width:293.8pt;margin-left:-5.4pt;border-collapse:collapse">
<tbody>
<tr style="height:66.75pt">
<td width="101" style="width:76.0pt;padding:0in 5.4pt 0in 5.4pt;height:66.75pt">
<p class="MsoNormal" align="center" style="text-align:center;text-autospace:none"><span style="font-size:11.0pt"><img width="87" height="87" style="width:.9062in;height:.9062in" id="Picture_x0020_1" src="cid:CDC7B71C5C07488EBC57ECC24B80DA5D"  alt="cid:image002.png@01D3D0E3.DCFE6710" class="existing-inline-image" /></span></p>
</td>
<td width="290" style="width:217.8pt;padding:0in 5.4pt 0in 5.4pt;height:66.75pt">
<p class="MsoNormal" style="text-autospace:none"><b><span style="font-size:11.0pt;font-family:"Arial",sans-serif;color:#E83C21">Rob Boehne</span></b><span style="font-size:11.0pt"></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Arial",sans-serif">Senior Software Architect | Datalogics, Inc.</span><span style="font-size:11.0pt"></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:11.0pt"><a href="tel:(312)%20853-8351"><span style="font-size:10.0pt;font-family:"Arial",sans-serif;color:#0B4CB4">+1.312.853.8351</span></a></span><span style="font-size:10.0pt;font-family:"Arial",sans-serif"> | <a href="mailto:robb@datalogics.com"><span style="color:#0B4CB4">robb@datalogics.com</span></a></span><span style="font-size:11.0pt"></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:11.0pt"><a href="http://www.datalogics.com/"><span style="font-size:10.0pt;font-family:"Arial",sans-serif;color:#0B4CB4">datalogics.com</span></a></span><span style="font-size:10.0pt;font-family:"Arial",sans-serif"> | <a href="http://blogs.datalogics.com/"><span style="color:#0B4CB4">blogs.datalogics.com</span></a></span><span style="font-size:11.0pt"></span></p>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Arial",sans-serif">Connect with us: <a href="https://www.facebook.com/DatalogicsInc"><span style="color:#0B4CB4">Facebook</span></a> | <a href="https://twitter.com/DatalogicsInc"><span style="color:#0B4CB4">Twitter</span></a> | <a href="https://www.linkedin.com/company/datalogics?actionToken=p=p%3Dbiz-company-login%26c%3D3217e65a-bdc2-4b38-8f9c-13c982e8c529%26m%3Dcompany_feed%26n%3D0&t=a%3DisFolloweeOfPoster%253Dfalse%2526distanceFromActor%253D-1%2526actorType%253D%2526likedByUser%253Dfalse%2526targetId%253D%2526recentCommentUrns%253D%2526targetType%253D%2526sponsoredFlag%253DORGANIC%2526verbType%253Dlinkedin%25253Ashare%2526objectType%253Dlinkedin%25253Aarticle%2526totalShares%253D0%2526activityId%253Durn%25253Ali%25253Aactivity%25253A6263731876121362433%2526recentLikerUrns%253D%2526actorId%253Durn%25253Ali%25253Acompany%25253A14000%2526totalComments%253D0%2526relevanceScore%253D0.0%2526recentCommenterUrns%253D%2526isPublic%253Dtrue%2526time%253D-1%2526totalLikes%253D0%2526objectId%253Durn%25253Ali%25253Aarticle%25253A7793179909183391510%2526distanceFromNestedActor%253D-1%26s%3DORG"><span style="color:#0B4CB4">LinkedIn</span></a> | <a href="https://www.youtube.com/user/Datalogics"><span style="color:#0B4CB4">YouTube</span></a></span><span style="font-size:11.0pt"></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Arial",sans-serif"> </span><span style="font-size:11.0pt"></span></p>
<p class="MsoNormal"> </p>
</div>
--<br />
<br />
Powered by www.kitware.com<br />
<br />
Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ<br />
<br />
Kitware offers various services to support the CMake community. For more information on each offering, please visit:<br />
<br />
CMake Support: http://cmake.org/cmake/help/support.html<br />
CMake Consulting: http://cmake.org/cmake/help/consulting.html<br />
CMake Training Courses: http://cmake.org/cmake/help/training.html<br />
<br />
Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html<br />
<br />
Follow this link to subscribe/unsubscribe:<br />
https://cmake.org/mailman/listinfo/cmake<br /></blockquote>
<div></div>
</div>
</body>
</html>