diff --git a/CMakeLists.txt b/CMakeLists.txt index 8df5d4378..a29e0bdd7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -98,6 +98,7 @@ if(WIN32) endif() set(CMAKE_CXX_STANDARD 11) +set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON) # Optional features # diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 00719e301..17920c07a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -89,8 +89,12 @@ endif() if(OPENAL) find_package(OpenAL REQUIRED) - include_directories(${OPENAL_INCLUDE_DIR}) - target_link_libraries(86Box ${OPENAL_LIBRARY}) + if(TARGET OpenAL::OpenAL) + target_link_libraries(86Box OpenAL::OpenAL) + else() + include_directories(${OPENAL_INCLUDE_DIR}) + target_link_libraries(86Box ${OPENAL_LIBRARY}) + endif() endif() find_package(SDL2 REQUIRED)