[CMake] FindPkgConfig and using -m32 on Linux

Jan Wielemaker jan at swi-prolog.org
Thu Jan 17 07:57:03 EST 2019


Hi,

I'm trying to build a complicated package for 32-bits on 64-bit Ubuntu.
I got very far using

    set(CMAKE_C_FLAGS -m32)
    set(CMAKE_LIBRARY_ARCHITECTURE i386-linux-gnu)

But right now, find_package(OpenSSL) is failing.  I think the problem is
with FindOpenSSL.cmake doing this (Ubuntu 18.04, CMake 3.10):

    if (UNIX)
      find_package(PkgConfig QUIET)
      pkg_check_modules(_OPENSSL QUIET openssl)
    endif ()

Ubuntu has, I think compatibe with the Linux standard, these .pc files
for the multilib installed OpenSSL:

    $ dpkg -L libssl1.0-dev | grep openssl.pc
    /usr/lib/x86_64-linux-gnu/pkgconfig/openssl.pc
    $ dpkg -L libssl1.0-dev:i386 | grep openssl.pc
    /usr/lib/i386-linux-gnu/pkgconfig/openssl.pc

Should CMake not use CMAKE_LIBRARY_ARCHITECTURE?  Is there some neat work
around?  Best I can now think of is to create a script pkg-config.i386,
make that set the proper search path and tell CMake to use this script :(

    Thanks --- Jan




More information about the CMake mailing list