Skip to content

Commit

Permalink
Update CMake to use gameinput package if needed (#275)
Browse files Browse the repository at this point in the history
  • Loading branch information
walbourn authored Oct 25, 2024
1 parent a700d0f commit 8c4dfe7
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -339,10 +339,15 @@ include(CheckIncludeFileCXX)

if(BUILD_GAMEINPUT)
message(STATUS "Using GameInput for GamePad/Keyboard/Mouse.")
set(CMAKE_REQUIRED_QUIET ON)
CHECK_INCLUDE_FILE_CXX(GameInput.h GAMEINPUT_HEADER)
if(NOT GAMEINPUT_HEADER)
message(FATAL_ERROR "Microsoft GDK required to build GameInput. See https://aka.ms/gdk")
find_package(gameinput CONFIG QUIET)
if(gameinput_FOUND)
target_link_libraries(${PROJECT_NAME} PUBLIC Microsoft::GameInput)
else()
set(CMAKE_REQUIRED_QUIET ON)
CHECK_INCLUDE_FILE_CXX(GameInput.h GAMEINPUT_HEADER)
if(NOT GAMEINPUT_HEADER)
message(FATAL_ERROR "Microsoft GDK required to build GameInput. See https://aka.ms/gdk")
endif()
endif()
target_compile_definitions(${PROJECT_NAME} PUBLIC USING_GAMEINPUT)
elseif(BUILD_WGI)
Expand Down

0 comments on commit 8c4dfe7

Please sign in to comment.