Skip to content

Commit 8a43161

Browse files
committed
cmake: always include our own headers first
With c26ce78 (Merge branch 'AndreyG/cmake/modernization', 2017-06-28), we have recently introduced a regression in the way we are searching for headers. We have made sure to always include our own headers first, but due to the changes in c26ce78 this is no longer guaranteed. In fact, this already leads the compiler into picking "config.h" from the "deps/regex" dependency, if it is used. Fix the issue by declaring our internal include directories up front, before any of the other search directories is added.
1 parent e5c9723 commit 8a43161

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/CMakeLists.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ SET(LIBGIT2_PC_REQUIRES "")
1111
# pc file.
1212
SET(LIBGIT2_PC_LIBS "")
1313

14-
SET(LIBGIT2_INCLUDES "")
14+
SET(LIBGIT2_INCLUDES
15+
"${CMAKE_CURRENT_BINARY_DIR}"
16+
"${CMAKE_SOURCE_DIR}/src"
17+
"${CMAKE_SOURCE_DIR}/include")
1518
SET(LIBGIT2_LIBS "")
1619
SET(LIBGIT2_LIBDIRS "")
1720

@@ -329,8 +332,6 @@ CONFIGURE_FILE(features.h.in git2/sys/features.h)
329332

330333
SET(GIT2INTERNAL_OBJECTS ${SRC_H} ${SRC_GIT2} ${SRC_OS} ${SRC_SSH} ${SRC_SHA1})
331334

332-
LIST(APPEND LIBGIT2_INCLUDES ${CMAKE_CURRENT_BINARY_DIR} "${CMAKE_SOURCE_DIR}/src" "${CMAKE_SOURCE_DIR}/include")
333-
334335
IF (CMAKE_VERSION VERSION_GREATER 2.8.7)
335336
ADD_LIBRARY(git2internal OBJECT ${GIT2INTERNAL_OBJECTS})
336337
IDE_SPLIT_SOURCES(git2internal)

0 commit comments

Comments
 (0)