[CMake] How to build for 32bit using multiarch?
Mathias Gaunard
mathias.gaunard at ens-lyon.org
Tue Nov 29 04:50:13 EST 2011
On 11/28/2011 05:58 PM, Kishore Jonnalagadda wrote:
> I have recently moved to using 64bit Kubuntu Oneiric when supports
> multiarch. I understand that building 32 bit from my 64 install is as
> simple as adding the "-m32" option to gcc. Asking cmake to add that
> flag is easy but i don't know how to ask cmake to only look for 32 bit
> libraries in FindPackage() class. I have all the 32bit library (Qt)
> dependencies installed and they are in /usr/lib/i386-linux-gnu. By
> adding the "-m32" option compilation succeeds but as expected linking
> fails complaining that i am trying to link to 64 bit libraries.
>
> So, how do i ask cmake to look for 32bit libs?
I personally haven't found a good solution for this either.
What I currently do is the following
set(CMAKE_SYSTEM_PROCESSOR i386)
set(CMAKE_SYSTEM_LIBRARY_PATH /lib32 /usr/lib32 /usr/local/lib32)
set(FIND_LIBRARY_USE_LIB64_PATHS OFF)
set(CMAKE_IGNORE_PATH /lib /usr/lib /usr/local/lib)
Unfortunately the CMAKE_IGNORE_PATH is required. I created a bug about this.
More information about the CMake
mailing list