set(CMAKE_BUILD_TYPE Release
CACHE STRING "Set build type to Debug o Release (default Release)" FORCE)
endif()
+string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LOWER)
# get rid of the extra default configurations
# what? why would you get id of other useful build types? - Ellzey
# Setup compiler flags for coverage.
if (EVENT__COVERAGE)
- if ((NOT CMAKE_COMPILER_IS_GNUCC) AND (NOT ${CMAKE_CXX_COMPILER_ID} STREQAL "Clang"))
- message(FATAL_ERROR "Trying to compile coverage support, but compiler is not GNU gcc! Try CC=/usr/bin/gcc CXX=/usr/bin/g++ cmake <options> ..")
- endif()
-
- if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
+ if (NOT "${CMAKE_BUILD_TYPE_LOWER}" STREQUAL "debug")
message(FATAL_ERROR "Coverage requires -DCMAKE_BUILD_TYPE=Debug")
endif()
message(STATUS "Setting coverage compiler flags")
- add_compiler_flags(-g -O0 -fprofile-arcs -ftest-coverage)
+
+ set(CMAKE_REQUIRED_LIBRARIES "--coverage")
+ add_compiler_flags(-g -O0 --coverage)
+ set(CMAKE_REQUIRED_LIBRARIES "")
endif()
# GCC specific options.
# - Added support for Clang.
# - Some additional usage instructions.
#
+# 2016-11-02, Azat Khuzhin
+# - Adopt for C compiler only (libevent)
+#
# USAGE:
# 1. Copy this file into your cmake modules path.
#
MESSAGE(FATAL_ERROR "gcov not found! Aborting...")
ENDIF() # NOT GCOV_PATH
-IF(NOT CMAKE_COMPILER_IS_GNUCC AND NOT CMAKE_COMPILER_IS_GNUCXX)
+IF(NOT CMAKE_COMPILER_IS_GNUCC)
# Clang version 3.0.0 and greater now supports gcov as well.
MESSAGE(WARNING "Compiler is not GNU gcc! Clang Version 3.0.0 and greater supports gcov as well, but older versions don't.")
- IF(NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
+ IF(NOT "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang")
MESSAGE(FATAL_ERROR "Compiler is not GNU gcc! Aborting...")
ENDIF()
ENDIF() # NOT CMAKE_COMPILER_IS_GNUCC