+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${optCFLAGS}")
+
+# Try to make Mac a bit more complient to open source standards
+if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_XOPEN_SOURCE")
+endif()
+
+set(TESH_OPTION "")
+if(enable_coverage)
+ find_program(GCOV_PATH gcov)
+ if(GCOV_PATH)
+ SET(COVERAGE_COMMAND "${GCOV_PATH}" CACHE TYPE FILEPATH FORCE)
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DCOVERAGE")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fprofile-arcs -ftest-coverage")
+ set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fprofile-arcs -ftest-coverage")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
+ set(TESH_OPTION --enable-coverage)
+ add_definitions(-fprofile-arcs -ftest-coverage)
+ endif()
+endif()
+
+if(NOT $ENV{CFLAGS} STREQUAL "")
+ message(STATUS "Add CFLAGS: \"$ENV{CFLAGS}\" to CMAKE_C_FLAGS")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} $ENV{CFLAGS}")
+endif()
+
+if(NOT $ENV{LDFLAGS} STREQUAL "")
+ message(STATUS "Add LDFLAGS: \"$ENV{LDFLAGS}\" to CMAKE_C_LINK_FLAGS")
+ set(CMAKE_C_LINK_FLAGS "${CMAKE_C_LINK_FLAGS} $ENV{LDFLAGS}")
+endif()
+
+if(enable_model-checking AND enable_compile_optimizations)
+ message(WARNING "Sorry for now GCC optimizations does not work with model checking.\nPlease turn off optimizations with command:\ncmake -Denable_compile_optimizations=off. ")
+endif()