Skip to content

Commit

Permalink
Merge pull request #854 from bratpiorka/rrudnick_hwloc_patch_fix_0.9
Browse files Browse the repository at this point in the history
fix for the apply of the HWLOC security patch
  • Loading branch information
bratpiorka authored Oct 31, 2024
2 parents e4fc864 + ef1e1cd commit 6874c42
Showing 1 changed file with 18 additions and 16 deletions.
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

0 comments on commit 6874c42

Please sign in to comment.