[CMake] Test if found library is 32 or 64 bit

j s j.s4403 at gmail.com
Mon Jul 11 12:52:58 EDT 2011


The /usr/bin/file command on linux can be used to check the file type.

 ~> file /usr/lib/libpython2.6.so
/usr/lib/libpython2.6.so: symbolic link to `libpython2.6.so.1'
 ~> file /usr/lib/libpython2.6.so.1
/usr/lib/libpython2.6.so.1: symbolic link to `libpython2.6.so.1.0'
 ~> file /usr/lib/libpython2.6.so.1.0
/usr/lib/libpython2.6.so.1.0: ELF 64-bit LSB shared object, x86-64,
version 1 (SYSV), dynamically linked, stripped

~> file /lib32/libm.so.6
/lib32/libm.so.6: symbolic link to `libm-2.11.1.so'
 ~> file /lib32/libm-2.11.1.so
/lib32/libm-2.11.1.so: ELF 32-bit LSB shared object, Intel 80386,
version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux
2.6.15, stripped


Juan

On Mon, Jul 11, 2011 at 10:42 AM, joe <loeffel77 at yahoo.com> wrote:
> Hi,
> I've got a seemingly simple question. However, I failed to find an answer up to now.
>
> In my FindXXX module, I search a library with help of the find_library command on a 64-bit Linux. Now, I want to check, if the library is 32-bit (built with -m32) or 64-bit.
>
> How can I check this?
>
> Thanks in advance,
> Klaus.
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>


More information about the CMake mailing list