Compile with warnings on Unix.

The warnings got disabled at some point; this re-enables some of them, and
fixes some of the warnings.

Change-Id: I290a4fdfad18cea85e9177ba57744d97b6856bb2
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4152ecc..7deaeb5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -614,6 +614,12 @@
   SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /ignore:4049")
 ENDIF (MSVC)
 
+# GCC is not strict enough by default, so enable most of the warnings.
+IF ("${UNIX}")
+  SET(CMAKE_CXX_FLAGS
+      "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wno-sign-compare -Wno-unused")
+ENDIF ("${UNIX}")
+
 ADD_SUBDIRECTORY(internal/ceres)
 
 OPTION(BUILD_DOCUMENTATION