Skip to content

Commit 3feb097

Browse files
CopilotYouw
andauthored
cmake: centralize policy configuration in src CMake
Agent-Logs-Url: https://github.com/libusb/hidapi/sessions/0e1de066-e81e-4f84-ae45-dd164803580e Co-authored-by: Youw <5939659+Youw@users.noreply.github.com>
1 parent 6c56fcb commit 3feb097

5 files changed

Lines changed: 7 additions & 36 deletions

File tree

libusb/CMakeLists.txt

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,3 @@
1-
cmake_minimum_required(VERSION 3.6.3...3.25 FATAL_ERROR)
2-
3-
foreach(HIDAPI_CMAKE_POLICY CMP0156 CMP0179 CMP0181 CMP0200)
4-
if(POLICY ${HIDAPI_CMAKE_POLICY})
5-
cmake_policy(SET ${HIDAPI_CMAKE_POLICY} NEW)
6-
endif()
7-
endforeach()
8-
unset(HIDAPI_CMAKE_POLICY)
9-
101
list(APPEND HIDAPI_PUBLIC_HEADERS "hidapi_libusb.h")
112

123
add_library(hidapi_libusb

linux/CMakeLists.txt

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,3 @@
1-
cmake_minimum_required(VERSION 3.6.3...3.25 FATAL_ERROR)
2-
3-
foreach(HIDAPI_CMAKE_POLICY CMP0156 CMP0179 CMP0181 CMP0200)
4-
if(POLICY ${HIDAPI_CMAKE_POLICY})
5-
cmake_policy(SET ${HIDAPI_CMAKE_POLICY} NEW)
6-
endif()
7-
endforeach()
8-
unset(HIDAPI_CMAKE_POLICY)
9-
101
add_library(hidapi_hidraw
112
${HIDAPI_PUBLIC_HEADERS}
123
hid.c

mac/CMakeLists.txt

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,3 @@
1-
cmake_minimum_required(VERSION 3.4.3...3.25 FATAL_ERROR)
2-
3-
foreach(HIDAPI_CMAKE_POLICY CMP0156 CMP0179 CMP0181 CMP0200)
4-
if(POLICY ${HIDAPI_CMAKE_POLICY})
5-
cmake_policy(SET ${HIDAPI_CMAKE_POLICY} NEW)
6-
endif()
7-
endforeach()
8-
unset(HIDAPI_CMAKE_POLICY)
9-
101
list(APPEND HIDAPI_PUBLIC_HEADERS "hidapi_darwin.h")
112

123
add_library(hidapi_darwin

netbsd/CMakeLists.txt

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,3 @@
1-
cmake_minimum_required(VERSION 3.6.3...3.25 FATAL_ERROR)
2-
3-
foreach(HIDAPI_CMAKE_POLICY CMP0156 CMP0179 CMP0181 CMP0200)
4-
if(POLICY ${HIDAPI_CMAKE_POLICY})
5-
cmake_policy(SET ${HIDAPI_CMAKE_POLICY} NEW)
6-
endif()
7-
endforeach()
8-
unset(HIDAPI_CMAKE_POLICY)
9-
101
add_library(hidapi_netbsd
112
${HIDAPI_PUBLIC_HEADERS}
123
hid.c

src/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@ project(hidapi VERSION "${VERSION}" LANGUAGES C)
2626

2727
# Defaults and required options
2828

29+
foreach(HIDAPI_CMAKE_POLICY CMP0156 CMP0179 CMP0181 CMP0200)
30+
if(POLICY ${HIDAPI_CMAKE_POLICY})
31+
cmake_policy(SET ${HIDAPI_CMAKE_POLICY} NEW)
32+
endif()
33+
endforeach()
34+
unset(HIDAPI_CMAKE_POLICY)
35+
2936
if(NOT DEFINED HIDAPI_WITH_TESTS)
3037
set(HIDAPI_WITH_TESTS OFF)
3138
endif()

0 commit comments

Comments
 (0)