Only look for ZLib when it is used (if tests are included).

Also make the project language C.
This commit is contained in:
Joakim Soderberg 2013-12-19 10:46:04 +00:00
parent 4ac086abc4
commit f7805939d1
2 changed files with 14 additions and 11 deletions

View File

@ -59,13 +59,11 @@ include(CheckStructHasMember)
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()
@ -581,11 +579,16 @@ if (NOT EVENT__DISABLE_THREAD_SUPPORT)
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

View File

@ -68,14 +68,14 @@ IF(NOT GCOV_PATH)
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" )