]> granicus.if.org Git - libevent/commitdiff
Fix include bug.
authorJoakim Söderberg <joakim.soderberg@gmail.com>
Tue, 21 Jan 2014 10:19:02 +0000 (11:19 +0100)
committerJoakim Söderberg <joakim.soderberg@gmail.com>
Tue, 21 Jan 2014 10:19:02 +0000 (11:19 +0100)
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

index bc7c38d3e0bd7f777facaa84c496434a17443c55..35636186db2fcd640903744702d85fefac332fd6 100644 (file)
@@ -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