From: Joakim Söderberg Date: Tue, 21 Jan 2014 10:19:02 +0000 (+0100) Subject: Fix include bug. X-Git-Tag: release-2.1.4-alpha~42^2~3 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=20244671cd3c66ce81ae85dcb9a3f1312c78a25e;p=libevent Fix include bug. On systems where a previous version of Libevent is installed we don't want the system version of the headers to be included before the ones in the build tree. This happened on my OSX system where I had an ancient version of Libevent installed. It would then load the incorrect event-config.h and fail because the system introspection macros weren't set properly. --- diff --git a/CMakeLists.txt b/CMakeLists.txt index bc7c38d3..35636186 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -611,7 +611,12 @@ set(SRC_EXTRA ) add_definitions(-DHAVE_CONFIG_H) -include_directories(./ ./compat ./include) + +# We use BEFORE here so we don't accidentally look in system directories +# first for some previous versions of the headers that are installed. +include_directories(BEFORE ${PROJECT_SOURCE_DIR} + ${PROJECT_SOURCE_DIR}/compat + ${PROJECT_SOURCE_DIR}/include) if(WIN32) list(APPEND SRC_CORE @@ -641,7 +646,7 @@ source_group("Source Extra" FILES ${SRC_EXTRA}) # Generate the configure headers. # (Place them in the build dir so we don't polute the source tree with generated files). -include_directories(${CMAKE_CURRENT_BINARY_DIR}/include) +include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}/include) configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/event-config.h.cmake