diff --git a/cmake/linux-compiler-i386-multilib.cmake b/cmake/linux-compiler-i386-multilib.cmake index e3cebcc094..2a6ba10290 100644 --- a/cmake/linux-compiler-i386-multilib.cmake +++ b/cmake/linux-compiler-i386-multilib.cmake @@ -4,9 +4,15 @@ set(CMAKE_SYSTEM_PROCESSOR i686) # It could be i?86-*linux-gnu, x86_64-*linux-gnu, x86_64-*linux-gnux32, etc. # Leave it generic to only support amd64 or x32 to i386 with any compiler. -if("$ENV{CC}" STREQUAL "" OR "$ENV{CXX}" STREQUAL "") +if ("$ENV{CC}" STREQUAL "") set(CMAKE_C_COMPILER cc -m32) +else() + set(CMAKE_C_COMPILER $ENV{CC} -m32) +endif() +if ("$ENV{CXX}" STREQUAL "") set(CMAKE_CXX_COMPILER c++ -m32) +else() + set(CMAKE_CXX_COMPILER $ENV{CXX} -m32) endif() # cmake 2.8.5 correctly sets CMAKE_LIBRARY_ARCHITECTURE for Debian multiarch.