From 7abff8276843993fb531b951b3416e6eec757e69 Mon Sep 17 00:00:00 2001 From: Alexey Vishnyakov <vishnya@ispras.ru> Date: Fri, 4 Mar 2022 17:55:57 +0300 Subject: [PATCH 1/2] i#5395: Fix 32-bit build on Linux --- CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 040219ebf..ccaf3ab57 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -787,10 +787,13 @@ if (UNIX) if (suggest_override_avail) set(BASE_CXXONLY_FLAGS "${BASE_CXXONLY_FLAGS} -Wsuggest-override") endif () + # now that the user must set non-default -mNN we don't nec. need these: if (X86) if (X64) + set(BASE_CFLAGS "-m64 ${BASE_CFLAGS}") set(LD_FLAGS "-melf_x86_64") else (X64) + set(BASE_CFLAGS "-m32 ${BASE_CFLAGS}") set(LD_FLAGS "-melf_i386") endif (X64) elseif (ARM) -- GitLab From 7bcd254f2a44a2c1213b750ffcf2d519719b8582 Mon Sep 17 00:00:00 2001 From: Derek Bruening <bruening@google.com> Date: Mon, 7 Mar 2022 03:59:26 +0000 Subject: [PATCH 2/2] Update comment about -m32 --- CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ccaf3ab57..c036e094a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -787,7 +787,8 @@ if (UNIX) if (suggest_override_avail) set(BASE_CXXONLY_FLAGS "${BASE_CXXONLY_FLAGS} -Wsuggest-override") endif () - # now that the user must set non-default -mNN we don't nec. need these: + # Try to support users setting -m32 in CMAKE_C_FLAGS rather than the + # CFLAGS env var. if (X86) if (X64) set(BASE_CFLAGS "-m64 ${BASE_CFLAGS}") -- GitLab