Skip to content

fix for the apply of the HWLOC security patch #854

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 18 additions & 16 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -131,21 +131,14 @@ elseif(WINDOWS AND NOT UMF_DISABLE_HWLOC)
set(HWLOC_ENABLE_TESTING OFF)
set(HWLOC_SKIP_LSTOPO ON)
set(HWLOC_SKIP_TOOLS ON)
set(HWLOC_PATCH
git
apply
${PROJECT_SOURCE_DIR}/cmake/fix_coverity_issues.patch
||
(exit 0))

message(STATUS "Will fetch hwloc from ${UMF_HWLOC_REPO}")

FetchContent_Declare(
hwloc_targ
GIT_REPOSITORY ${UMF_HWLOC_REPO}
GIT_TAG ${UMF_HWLOC_TAG}
PATCH_COMMAND ${HWLOC_PATCH} SOURCE_SUBDIR contrib/windows-cmake/
FIND_PACKAGE_ARGS)
SOURCE_SUBDIR contrib/windows-cmake/ FIND_PACKAGE_ARGS)

FetchContent_GetProperties(hwloc_targ)
if(NOT hwloc_targ_POPULATED)
Expand All @@ -162,20 +155,13 @@ elseif(WINDOWS AND NOT UMF_DISABLE_HWLOC)
message(STATUS " LIBHWLOC_LIBRARY_DIRS = ${LIBHWLOC_LIBRARY_DIRS}")
elseif(NOT UMF_DISABLE_HWLOC)
include(FetchContent)
set(HWLOC_PATCH
git
apply
${PROJECT_SOURCE_DIR}/cmake/fix_coverity_issues.patch
||
(exit 0))

message(STATUS "Will fetch hwloc from ${UMF_HWLOC_REPO}")

FetchContent_Declare(
hwloc_targ
GIT_REPOSITORY ${UMF_HWLOC_REPO}
GIT_TAG ${UMF_HWLOC_TAG}
PATCH_COMMAND ${HWLOC_PATCH})
GIT_TAG ${UMF_HWLOC_TAG})

FetchContent_GetProperties(hwloc_targ)
if(NOT hwloc_targ_POPULATED)
Expand Down Expand Up @@ -222,6 +208,22 @@ elseif(NOT UMF_DISABLE_HWLOC)
message(STATUS " LIBHWLOC_LIBRARY_DIRS = ${LIBHWLOC_LIBRARY_DIRS}")
endif()

if(hwloc_targ_SOURCE_DIR)
# apply security patch for HWLOC
execute_process(
COMMAND git apply ${PROJECT_SOURCE_DIR}/cmake/fix_coverity_issues.patch
WORKING_DIRECTORY ${hwloc_targ_SOURCE_DIR}
OUTPUT_VARIABLE UMF_HWLOC_PATCH_OUTPUT
ERROR_VARIABLE UMF_HWLOC_PATCH_ERROR)

if(UMF_HWLOC_PATCH_OUTPUT)
message(STATUS "HWLOC patch command output:\n${UMF_HWLOC_PATCH_OUTPUT}")
endif()
if(UMF_HWLOC_PATCH_ERROR)
message(WARNING "HWLOC patch command output:\n${UMF_HWLOC_PATCH_ERROR}")
endif()
endif()

# This build type check is not possible on Windows when CMAKE_BUILD_TYPE is not
# set, because in this case the build type is determined after a CMake
# configuration is done (at the build time)
Expand Down
Loading