diff options
author | Andreas Schneider <asn@cryptomilk.org> | 2018-09-25 11:06:16 +0200 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2018-09-25 12:31:33 +0200 |
commit | 5a4072c35f70ab1849415f71865a0821d2ec885d (patch) | |
tree | d9cd15fced08cbc2fe406a1360a67f032a428b4c /cmake | |
parent | b6104430f7946ce833be74a1dc86236ada310573 (diff) | |
download | cmocka-5a4072c35f70ab1849415f71865a0821d2ec885d.tar.gz cmocka-5a4072c35f70ab1849415f71865a0821d2ec885d.tar.xz cmocka-5a4072c35f70ab1849415f71865a0821d2ec885d.zip |
cmake: Add toolchain file for m32 builds
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/Toolchain-cross-m32.cmake | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/cmake/Toolchain-cross-m32.cmake b/cmake/Toolchain-cross-m32.cmake new file mode 100644 index 0000000..7918c60 --- /dev/null +++ b/cmake/Toolchain-cross-m32.cmake @@ -0,0 +1,23 @@ +set(CMAKE_C_FLAGS "-m32" CACHE STRING "C compiler flags" FORCE) +set(CMAKE_CXX_FLAGS "-m32" CACHE STRING "C++ compiler flags" FORCE) + +set(LIB32 /usr/lib) # Fedora + +if(EXISTS /usr/lib32) + set(LIB32 /usr/lib32) # Arch, Solus +endif() + +set(CMAKE_SYSTEM_LIBRARY_PATH ${LIB32} CACHE STRING "system library search path" FORCE) +set(CMAKE_LIBRARY_PATH ${LIB32} CACHE STRING "library search path" FORCE) + +# this is probably unlikely to be needed, but just in case +set(CMAKE_EXE_LINKER_FLAGS "-m32 -L${LIB32}" CACHE STRING "executable linker flags" FORCE) +set(CMAKE_SHARED_LINKER_FLAGS "-m32 -L${LIB32}" CACHE STRING "shared library linker flags" FORCE) +set(CMAKE_MODULE_LINKER_FLAGS "-m32 -L${LIB32}" CACHE STRING "module linker flags" FORCE) + +# on Fedora and Arch and similar, point pkgconfig at 32 bit .pc files. We have +# to include the regular system .pc files as well (at the end), because some +# are not always present in the 32 bit directory +if(EXISTS ${LIB32}/pkgconfig) + set(ENV{PKG_CONFIG_LIBDIR} ${LIB32}/pkgconfig:/usr/share/pkgconfig:/usr/lib/pkgconfig:/usr/lib64/pkgconfig) +endiF() |