include(CheckCSourceCompiles)
include(CheckPrototypeDefinition)
-include(FindZLIB) # -> HAVE_LIBZ
-
# Setup compiler flags for coverage.
if (EVENT__COVERAGE)
- if(NOT CMAKE_COMPILER_IS_GNUCXX)
+ if(NOT CMAKE_COMPILER_IS_GNUCC)
if (NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
- message(FATAL_ERROR "Compiler is not GNU gcc! Aborting... You can set this on the command line using CC=/usr/bin/gcc CXX=/usr/bin/g++ cmake <options> ..")
+ message(FATAL_ERROR "Trying to compile coverage support (--DEVENT__COVERAGE) but compiler is not GNU gcc! Aborting... You can set this on the command line using CC=/usr/bin/gcc CXX=/usr/bin/g++ cmake <options> ..")
endif()
endif()
endif()
endif()
-if (ZLIB_LIBRARY)
- set(EVENT__HAVE_ZLIB 1)
- set(EVENT__HAVE_ZLIB_H)
- include_directories(${ZLIB_INCLUDE_DIRS})
- list(APPEND LIB_APPS ${ZLIB_LIBRARIES})
+if (NOT EVENT__DISABLE_TESTS)
+ # Zlib is only used for testing.
+ find_package(ZLIB)
+
+ if (ZLIB_LIBRARY)
+ set(EVENT__HAVE_ZLIB 1)
+ set(EVENT__HAVE_ZLIB_H)
+ include_directories(${ZLIB_INCLUDE_DIRS})
+ list(APPEND LIB_APPS ${ZLIB_LIBRARIES})
+ endif()
endif()
set(SRC_EXTRA
MESSAGE(FATAL_ERROR "gcov not found! Aborting...")
ENDIF() # NOT GCOV_PATH
-IF(NOT CMAKE_COMPILER_IS_GNUCXX)
+IF(NOT CMAKE_COMPILER_IS_GNUCC AND NOT CMAKE_COMPILER_IS_GNUCXX)
# 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")
MESSAGE(FATAL_ERROR "Compiler is not GNU gcc! Aborting...")
ENDIF()
-ENDIF() # NOT CMAKE_COMPILER_IS_GNUCXX
+ENDIF() # NOT CMAKE_COMPILER_IS_GNUCC
IF ( NOT CMAKE_BUILD_TYPE STREQUAL "Debug" )
MESSAGE( WARNING "Code coverage results with an optimized (non-Debug) build may be misleading" )