mirror of
https://github.com/libgit2/libgit2.git
synced 2026-06-22 06:26:26 +00:00
Make a distinction between generated headers and "translated" headers. This is important to support build-time dependencies when headers are updated. Generated headers are those which contain build-time feature specifications, like `git2_features.h` that are internal to the build and `experimental.h` that contain API information. Translated headers are the headers that are in `include/git2`, but may be translated to have a unique prefix like `incklude/git2-experimental`. This distinction is important so that the CMakeFiles.txt depend on the in-tree include files (`src/include`) and the generated header files _but not_ the translated header files. Otherwise there are two `pack.h` and it's unclear whether the in-tree build is targeting the one in `src/include` or the one in the build tree. Without this, updating an in-tree header file like `pack.h` would not cause a rebuild of its dependencies.
29 lines
1.4 KiB
CMake
29 lines
1.4 KiB
CMake
|
|
file(GLOB SRC_XDIFF "*.c" "*.h")
|
|
list(SORT SRC_XDIFF)
|
|
|
|
add_library(xdiff OBJECT ${SRC_XDIFF})
|
|
target_include_directories(xdiff SYSTEM PRIVATE
|
|
"${PROJECT_SOURCE_DIR}/include"
|
|
"${PROJECT_SOURCE_DIR}/src/util"
|
|
"${PROJECT_BINARY_DIR}/gen_headers"
|
|
${LIBGIT2_SYSTEM_INCLUDES}
|
|
${LIBGIT2_DEPENDENCY_INCLUDES})
|
|
|
|
# the xdiff dependency is not (yet) warning-free, disable warnings
|
|
# as errors for the xdiff sources until we've sorted them out
|
|
if(MSVC)
|
|
set_source_files_properties(xdiffi.c PROPERTIES COMPILE_FLAGS -WX-)
|
|
set_source_files_properties(xemit.c PROPERTIES COMPILE_FLAGS -WX-)
|
|
set_source_files_properties(xhistogram.c PROPERTIES COMPILE_FLAGS -WX-)
|
|
set_source_files_properties(xmerge.c PROPERTIES COMPILE_FLAGS -WX-)
|
|
set_source_files_properties(xutils.c PROPERTIES COMPILE_FLAGS -WX-)
|
|
set_source_files_properties(xpatience.c PROPERTIES COMPILE_FLAGS -WX-)
|
|
else()
|
|
set_source_files_properties(xdiffi.c PROPERTIES COMPILE_FLAGS "-Wno-sign-compare -Wno-unused-parameter")
|
|
set_source_files_properties(xemit.c PROPERTIES COMPILE_FLAGS "-Wno-sign-compare -Wno-unused-parameter")
|
|
set_source_files_properties(xhistogram.c PROPERTIES COMPILE_FLAGS "-Wno-sign-compare")
|
|
set_source_files_properties(xutils.c PROPERTIES COMPILE_FLAGS "-Wno-sign-compare")
|
|
set_source_files_properties(xpatience.c PROPERTIES COMPILE_FLAGS "-Wno-sign-compare")
|
|
endif()
|