--- CMakeLists.txt.orig	2017-10-19 11:03:03 UTC
+++ CMakeLists.txt
@@ -51,6 +51,19 @@ if( ${TARGET_OS} STREQUAL "Linux" )
     message("Unsupported architecture: ${TARGET_ARCHITECTURE}" )
     return()
   endif()
+elseif( ${TARGET_OS} STREQUAL "FreeBSD" )
+  set(OS "FREEBSD")
+  set(OSNAME "FreeBSD")
+  # this is very hacky!
+  if( ${TARGET_ARCHITECTURE} STREQUAL "amd64" )
+    set(ARCHNAME x86-64)
+    set(ARCH X86)
+    set(WRDSZ 64)
+    set(TARGET_ARCHITECTURE x86_64)
+  else()
+    message("Unsupported architecture: ${TARGET_ARCHITECTURE}" )
+    return()
+  endif()
 else()
   message("Unsupported OS: ${TARGET_OS}" )
   return()
@@ -59,7 +72,8 @@ endif()
 # The cmake documentation states that these are set.  They are not so we 
 # set them here
 set(CMAKE_HOST_SYSTEM_NAME ${TARGET_OS})
-set(CMAKE_HOST_SYSTEM_PROCESSOR ${TARGET_ARCHITECTURE})
+# also a hack
+set(CMAKE_HOST_SYSTEM_PROCESSOR "x86-64")
 
 # If we are not building as a part of LLVM, build Flang as an
 # standalone project, using LLVM as an external library:
@@ -296,7 +310,7 @@ endif()
 # Add appropriate flags for GCC
 if (LLVM_COMPILER_IS_GCC_COMPATIBLE)
   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fno-common -Woverloaded-virtual -Wcast-qual -fno-strict-aliasing -pedantic -Wno-long-long -Wall -W -Wno-unused-parameter -Wwrite-strings")
-  option(WITH_WERROR "Compile with '-Werror' C compiler flag" ON)
+  option(WITH_WERROR "Compile with '-Werror' C compiler flag" OFF)
   if (WITH_WERROR)
      set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")
   endif ()
