[CMake] 32 bits compilation on x64 platform - how to find system libraries

Marcel Loose loose at astron.nl
Mon Dec 7 05:43:54 EST 2009


Hi Olivier,

I think you need to set the global property FIND_LIBRARY_USE_LIB64_PATHS
to OFF.

BTW, I disagree with Mathieu that building 32-bit libraries/executables
on a 64-bit system is cross-compilation. These binaries can be run
without a problem on the host system. So, IMHO, you don't need a
toolchain file. The only thing you have to do is instruct gcc/g++ to
generate 32-bit objects/binaries, using the -m32 option, and tell CMake
to look in lib instead of lib64 by setting the aforementioned property.

Hope this helps. Best regards,
Marcel Loose.


On Mon, 2009-12-07 at 10:09 +0100, Olivier Pierard wrote:
> Mathieu Malaterre wrote:
> > On Fri, Dec 4, 2009 at 4:39 PM, Olivier Pierard
> > <olivier.pierard at cenaero.be> wrote:
> >   
> >> Dear all,
> >>
> >> In order to perform 32 bits compilation on 64 bits platform, how can I
> >> tell that all find_libraries for which no path is specified to look in
> >> /usr/lib instead of /usr/lib64 ?  Is there a configuration variable for
> >> cmake platform or a default searching directories variable ?
> >>
> >>     
> >
> > This is called CMAKE_FIND_ROOT_PATH
> >
> > See for example:
> >
> > http://gdcm.svn.sf.net/viewvc/gdcm/trunk/CMake/Toolchain-gcc-m32.cmake?view=markup
> >   
> Thank you Mathieu.
> 
> Problem is that cmake appends '(/usr)/lib64' automatically to the
> CMAKE_FIND_ROOT_PATH.  And since I want to switch between '/usr/lib' and
> '/usr/lib64', setting the ROOT_PATH to '/usr' or '/' always ends up with
> libraries found in /usr/lib64. Setting it to '/usr/lib' seems to be
> ignored because there is nothing in /usr/lib/lib64.
> 
> Olivier
> > You man need to read:
> > http://www.cmake.org/Wiki/CMake_Cross_Compiling
> >
> > Cheers
> >   
> 
> 



More information about the CMake mailing list