- if(CMAKE_COMPILER_IS_GNUCC AND (NOT enable_model-checking))
- set(optCFLAGS "${optCFLAGS} -finline-functions ")
- if(WIN32)
- if (COMPILER_C_VERSION_MAJOR_MINOR STRGREATER "4.8")
+else()
+ set(optCFLAGS "-O0 ")
+endif()
+if(enable_compile_optimizations AND CMAKE_COMPILER_IS_GNUCC
+ AND (NOT enable_model-checking))
+ # This is redundant (already in -03):
+ set(optCFLAGS "${optCFLAGS} -finline-functions ")
+endif()
+
+# Configure LTO
+# TODO, provide an option to manually choose whether to use LTO
+# NOTE, cmake 3.0 has a INTERPROCEDURAL_OPTIMIZATION target
+# property for this (http://www.cmake.org/cmake/help/v3.0/prop_tgt/INTERPROCEDURAL_OPTIMIZATION.html)
+set(enable_lto OFF)
+if(enable_compile_optimizations
+ AND CMAKE_COMPILER_IS_GNUCC
+ AND (NOT enable_model-checking))
+ if(WIN32)
+ if (COMPILER_C_VERSION_MAJOR_MINOR STRGREATER "4.8")