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(CheckCSourceCompiles)
include(CheckPrototypeDefinition) include(CheckPrototypeDefinition)
include(FindZLIB) # -> HAVE_LIBZ
# Setup compiler flags for coverage. # Setup compiler flags for coverage.
if (EVENT__COVERAGE) if (EVENT__COVERAGE)
if(NOT CMAKE_COMPILER_IS_GNUCXX) if(NOT CMAKE_COMPILER_IS_GNUCC)
if (NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") 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()
@ -581,11 +579,16 @@ if (NOT EVENT__DISABLE_THREAD_SUPPORT)
endif() endif()
endif() endif()
if (ZLIB_LIBRARY) if (NOT EVENT__DISABLE_TESTS)
set(EVENT__HAVE_ZLIB 1) # Zlib is only used for testing.
set(EVENT__HAVE_ZLIB_H) find_package(ZLIB)
include_directories(${ZLIB_INCLUDE_DIRS})
list(APPEND LIB_APPS ${ZLIB_LIBRARIES}) 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() endif()
set(SRC_EXTRA set(SRC_EXTRA

View File

@ -68,14 +68,14 @@ IF(NOT GCOV_PATH)
MESSAGE(FATAL_ERROR "gcov not found! Aborting...") MESSAGE(FATAL_ERROR "gcov not found! Aborting...")
ENDIF() # NOT GCOV_PATH 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. # 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.") 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_CXX_COMPILER_ID}" STREQUAL "Clang")
MESSAGE(FATAL_ERROR "Compiler is not GNU gcc! Aborting...") MESSAGE(FATAL_ERROR "Compiler is not GNU gcc! Aborting...")
ENDIF() ENDIF()
ENDIF() # NOT CMAKE_COMPILER_IS_GNUCXX ENDIF() # NOT CMAKE_COMPILER_IS_GNUCC
IF ( NOT CMAKE_BUILD_TYPE STREQUAL "Debug" ) IF ( NOT CMAKE_BUILD_TYPE STREQUAL "Debug" )
MESSAGE( WARNING "Code coverage results with an optimized (non-Debug) build may be misleading" ) MESSAGE( WARNING "Code coverage results with an optimized (non-Debug) build may be misleading" )