mirror of
https://github.com/ROCm/composable_kernel.git
synced 2026-07-03 21:58:13 +00:00
[CK] [Security] pin getopt library to specific commit ## Motivation Making sure that FetchContent_Declare is pulling third-party code from a specific commit hash instead of the tip of main branch to avoid accidentally pulling potentially harmful code. ## Technical Details <!-- Explain the changes along with any relevant GitHub links. --> ## Test Plan <!-- Explain any relevant testing done to verify this PR. --> ## Test Result <!-- Briefly summarize test outcomes. --> ## Submission Checklist - [ ] Look over the contributing guidelines at https://github.com/ROCm/ROCm/blob/develop/CONTRIBUTING.md#pull-requests.
30 lines
870 B
CMake
30 lines
870 B
CMake
# Copyright (c) Advanced Micro Devices, Inc., or its affiliates.
|
|
# SPDX-License-Identifier: MIT
|
|
|
|
add_library(getopt::getopt INTERFACE IMPORTED GLOBAL)
|
|
|
|
if(WIN32)
|
|
include(FetchContent)
|
|
|
|
FetchContent_Declare(
|
|
getopt
|
|
GIT_REPOSITORY https://github.com/apwojcik/getopt.git
|
|
GIT_TAG e8531ed21b44f5a723c1dd700701b2a58ce3ea01
|
|
SYSTEM
|
|
)
|
|
|
|
set(__build_shared_libs ${BUILD_SHARED_LIBS})
|
|
set(BUILD_SHARED_LIBS OFF CACHE INTERNAL "")
|
|
|
|
FetchContent_MakeAvailable(getopt)
|
|
|
|
# Restore the old value of BUILD_SHARED_LIBS
|
|
set(BUILD_SHARED_LIBS ${__build_shared_libs} CACHE BOOL "Type of libraries to build" FORCE)
|
|
|
|
FetchContent_GetProperties(getopt)
|
|
|
|
target_link_libraries(getopt::getopt INTERFACE wingetopt)
|
|
target_include_directories(getopt::getopt INTERFACE ${getopt_SOURCE_DIR}/src)
|
|
endif()
|
|
|