[CMake] Change archive creation flags

Will Dicharry wdicharry at stellarscience.com
Tue Nov 10 14:53:06 EST 2009


Brad King wrote:
> Will Dicharry wrote:
>> Hi All,
>>
>> This was asked a while ago at
>> http://www.cmake.org/pipermail/cmake/2009-January/026318.html, but it
>> doesn't look like there was a response to that question.
>>
>> I have the same problem:
>>
>> on 64 bit AIX, ar must be invoked with a "-X 64" flag.  Is there a way
>> to tell CMake to do this?
> 
> Please file a feature request to support -q64 on AIX:
> 
>   http://www.cmake.org/Bug
> 
> and send me the issue number.
> 
> Here are two work-arounds:
> 
> - Set the OBJECT_MODE env var
> 
> - Add this code (but only for the one platform) to CMakeLists.txt:
> 
>   foreach(step CREATE APPEND FINISH)
>     string(REPLACE "<CMAKE_AR>" "<CMAKE_AR> -X 64"
>       CMAKE_C_ARCHIVE_${step} "${CMAKE_C_ARCHIVE_${step}}")
>   endforeach()

Thanks for your response, I'll open the feature request. I tried the 
second work around (I can't get all of my users to use that environment 
variable from the first case).  Unfortunately it doesn't seem to be working:

 From CMake output:
-- The C compiler identification is VisualAge
-- The CXX compiler identification is VisualAge
-- Check for working C compiler: /usr/bin/mpcc
-- Check for working C compiler: /usr/bin/mpcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/mpCC
-- Check for working CXX compiler: /usr/bin/mpCC -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- CMAKE_C_ARCHIVE_CREATE = <CMAKE_AR> -X 64 cr <TARGET> <LINK_FLAGS> 
<OBJECTS>
-- CMAKE_C_ARCHIVE_APPEND = <CMAKE_AR> -X 64 r  <TARGET> <LINK_FLAGS> 
<OBJECTS>
-- CMAKE_C_ARCHIVE_FINISH = <CMAKE_RANLIB> <TARGET>
<snip>

Then, during make VERBOSE=1:
Linking CXX static library libHpmi.a
      cd /scr/dicharry/ICEPIC/BuildArea/hpmi/src/hpmi && 
/site/PET/pkgs/cmake-2.6.4/bin/cmake -P 
CMakeFiles/Hpmi.dir/cmake_clean_target.cmake
         cd /scr/dicharry/ICEPIC/BuildArea/hpmi/src/hpmi && 
/site/PET/pkgs/cmake-2.6.4/bin/cmake -E cmake_link_script 
CMakeFiles/Hpmi.dir/link.txt --verbose=1
/usr/bin/ar cr libHpmi.a  CMakeFiles/Hpmi.dir/Index.cpp.o 
CMakeFiles/Hpmi.dir/logger.c.o CMakeFiles/Hpmi.dir/power.c.o 
CMakeFiles/Hpmi.dir/segmented_vector.cpp.o 
CMakeFiles/Hpmi.dir/Singleton.cpp.o CMakeFiles/Hpmi.dir/Stack.cpp.o 
CMakeFiles/Hpmi.dir/Timer.cpp.o
ar: 0707-126 CMakeFiles/Hpmi.dir/Index.cpp.o is not valid with the 
current object file mode.
         Use the -X option to specify the desired object mode.
ar: 0707-126 CMakeFiles/Hpmi.dir/logger.c.o is not valid with the 
current object file mode.
         Use the -X option to specify the desired object mode.
ar: 0707-126 CMakeFiles/Hpmi.dir/power.c.o is not valid with the current 
object file mode.
         Use the -X option to specify the desired object mode.
ar: 0707-126 CMakeFiles/Hpmi.dir/segmented_vector.cpp.o is not valid 
with the current object file mode.
         Use the -X option to specify the desired object mode.
ar: 0707-126 CMakeFiles/Hpmi.dir/Singleton.cpp.o is not valid with the 
current object file mode.
         Use the -X option to specify the desired object mode.
ar: 0707-126 CMakeFiles/Hpmi.dir/Stack.cpp.o is not valid with the 
current object file mode.
         Use the -X option to specify the desired object mode.
ar: 0707-126 CMakeFiles/Hpmi.dir/Timer.cpp.o is not valid with the 
current object file mode.
         Use the -X option to specify the desired object mode.

Thanks again,
Will

> 
> -Brad
> 


-- 
Will Dicharry
Software Developer
Stellar Science Ltd Co
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3344 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://www.cmake.org/pipermail/cmake/attachments/20091110/407c1954/attachment.bin>


More information about the CMake mailing list