0

I'm trying to build 32bit shared library on 64bit system using cmake:

CMAKE_C_FLAGS=-m32;CMAKE_CXX_FLAGS=-m32;CMAKE_LD_FLAGS=-m32 -L/usr/lib/i386-linux-gnu;CMAKE_SHARED_LIBRARY_C_FLAGS=-m32;CMAKE_SHARED_LIBRARY_CXX_FLAGS=-m32;CMAKE_SYSTEM_LIBRARY_PATH=/usr/lib/i386-linux-gnu;CFLAGS=-m32;LDFLAGS=-m32;CXXFLAGS=-m32 cmake

As you can see, I tried to add all variables I've found on stack overflow, but cmake is still adding 64bit libxml2 instead of 32 bit:

-- checking for module 'libxml-2.0'
--   found libxml-2.0, version 2.7.8
-- xmllint program not found. Install it if you want validate generated doc file.
-- Found LibXml2: /usr/lib/x86_64-linux-gnu/libxml2.so

How to force cmake to use 32 bit version located at /usr/lib/i386-linux-gnu?

GSerg
  • 76,472
  • 17
  • 159
  • 346
Jan
  • 410
  • 1
  • 7
  • 15
  • Already asked: http://stackoverflow.com/questions/1272357/how-to-compile-a-32-bit-binary-on-a-64-bit-linux-machine-with-gcc-cmake – Vertexwahn Nov 05 '13 at 10:49
  • @Vertexwahn: Except the poster obviously did read it. They just have something wrong in the settings apparently. – Jan Hudec Jan 28 '14 at 21:49
  • There is no `CMAKE_LD_FLAGS`, the cmake variable is called `CMAKE_EXE_LINKER_FLAGS`. It takes defaults from _environment_ variable `LDFLAGS` though. The semicolon-separated string you wrote is not a valid syntax for anything. And it contains mix of environment and cmake variables. Can you reproduce the exact commands you used? – Jan Hudec Jan 28 '14 at 21:52

1 Answers1

0

The variable is not called CMAKE_LD_FLAGS, it is called CMAKE_EXE_LINKER_FLAGS.

Jan Hudec
  • 73,652
  • 13
  • 125
  • 172