From 20244671cd3c66ce81ae85dcb9a3f1312c78a25e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Joakim=20So=CC=88derberg?= Date: Tue, 21 Jan 2014 11:19:02 +0100 Subject: [PATCH] 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. --- CMakeLists.txt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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 -- 2.50.1