# Fixes the following linker error:
# /usr/bin/ld.gold: error: .../LLVMgold.so: could not load plugin library:
# .../LLVMgold.so: cannot open shared object file: No such file or directory
# /usr/bin/ld.gold: fatal error: .../crtbegin_dynamic.o: unsupported ELF machine number 183

--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -38,7 +38,7 @@
 option(enable_lex_debug "Enable debugging info for lexical scanners in release builds [development]" OFF)
 
 if(CMAKE_BUILD_TYPE STREQUAL "Release")
-  if (CYGWIN OR MINGW OR NOT "${CMAKE_TOOLCHAIN_FILE}" STREQUAL "")
+  if (CYGWIN OR MINGW OR NOT "${CMAKE_TOOLCHAIN_FILE}" STREQUAL "" OR CMAKE_CROSSCOMPILING)
     set(CMAKE_INTERPROCEDURAL_OPTIMIZATION FALSE)
   else()
     set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
