Skip to content

Commit bebe9d9

Browse files
authored
Merge pull request #3 from CommanderPho/copilot/fix-cmake-build-error-hidapi
Fix Linux CMake build failure: hidapi cmake_minimum_required < 3.5 incompatible with CMake 3.31+
2 parents c4cbe88 + 3eb64fa commit bebe9d9

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

.github/workflows/build.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ jobs:
6161
if: runner.os == 'Linux'
6262
run: |
6363
sudo apt-get update
64-
sudo apt-get install -y libgl1-mesa-dev libxkbcommon-dev libxcb-cursor0
64+
sudo apt-get install -y libgl1-mesa-dev libxkbcommon-dev libxcb-cursor0 \
65+
libudev-dev libusb-1.0-0-dev
6566
6667
- name: Install Qt
6768
uses: jurplel/install-qt-action@v4

CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,16 @@ if(EMOTIVLSL_BUILD_EMOTIV)
8080
FetchContent_Declare(
8181
hidapi
8282
GIT_REPOSITORY https://github.com/libusb/hidapi.git
83-
GIT_TAG hidapi-0.14.0
83+
GIT_TAG hidapi-0.15.0
8484
GIT_SHALLOW ON
8585
EXCLUDE_FROM_ALL
8686
)
87+
# hidapi uses cmake_minimum_required(VERSION 3.1.3), which CMake 3.31+
88+
# no longer supports (compatibility with < 3.5 was removed). Setting
89+
# CMAKE_POLICY_VERSION_MINIMUM suppresses the error for sub-projects.
90+
set(CMAKE_POLICY_VERSION_MINIMUM "3.5")
8791
FetchContent_MakeAvailable(hidapi)
92+
unset(CMAKE_POLICY_VERSION_MINIMUM)
8893

8994
# tiny-AES-c (ECB decryption for Emotiv data stream)
9095
# We only need the source files, not a built library, so we use SOURCE_DIR-only population.

0 commit comments

Comments
 (0)