void-packages/srcpkgs/cmake/patches/race.patch

26 lines
1.3 KiB
Diff

At very least under musl, cmake has some racey behavior.
This workaround fixes that until a real fix is available.
https://gitlab.kitware.com/cmake/cmake/issues/19590
--- Modules/CMakeParseImplicitIncludeInfo.cmake
+++ Modules/CMakeParseImplicitIncludeInfo.cmake
@@ -226,6 +226,17 @@ function(cmake_parse_implicit_include_info text lang dir_var log_var state_var)
get_filename_component(dir "${CMAKE_BINARY_DIR}/${CMAKE_MATCH_1}" ABSOLUTE)
list(APPEND implicit_dirs "${dir}")
string(APPEND log " collapse relative include dir [${d}] ==> [${dir}]\n")
+ elseif("${d}" MATCHES [[^.* (/usr.*)$]])
+ # We've hit an unfortunate race where the output of something else prefixes
+ # our actual line... so perform a hacky workaround, at least until it's fixed
+ # https://gitlab.kitware.com/cmake/cmake/issues/19590
+ if(IS_ABSOLUTE "${CMAKE_MATCH_1}")
+ get_filename_component(dir "${CMAKE_MATCH_1}" ABSOLUTE)
+ list(APPEND implicit_dirs "${CMAKE_MATCH_1}")
+ string(APPEND log " collapse include dir [${CMAKE_MATCH_1}] ==> [${dir}]\n")
+ else()
+ string(APPEND log " skipping relative include dir [${d}]\n")
+ endif()
else()
string(APPEND log " skipping relative include dir [${d}]\n")
endif()