mirror of
https://github.com/libretro/pcsx2.git
synced 2025-03-04 15:37:36 +00:00
Add CheckLib.cmake
This commit is contained in:
parent
20716e13e4
commit
5f4fc4701f
36
cmake/CheckLib.cmake
Normal file
36
cmake/CheckLib.cmake
Normal file
@ -0,0 +1,36 @@
|
||||
include(FindPkgConfig OPTIONAL)
|
||||
|
||||
macro(_internal_message msg)
|
||||
message("${msg}")
|
||||
endmacro()
|
||||
|
||||
macro(check_lib var lib)
|
||||
set(_arg_list ${ARGN})
|
||||
|
||||
if(PKG_CONFIG_FOUND AND NOT ${var}_FOUND)
|
||||
string(TOLOWER ${lib} lower_lib)
|
||||
pkg_search_module(${var} QUIET ${lower_lib})
|
||||
endif()
|
||||
|
||||
if(${var}_FOUND)
|
||||
include_directories(${${var}_INCLUDE_DIRS})
|
||||
# Make sure include directories for headers found using find_path below
|
||||
# are re-added when reconfiguring
|
||||
include_directories(${${var}_INCLUDE})
|
||||
_internal_message("${lib} found")
|
||||
else()
|
||||
find_library(${var} ${lib})
|
||||
if(_arg_list)
|
||||
find_path(${var}_INCLUDE ${_arg_list})
|
||||
else()
|
||||
set(${var}_INCLUDE FALSE)
|
||||
endif()
|
||||
if(${var} AND ${var}_INCLUDE)
|
||||
include_directories(${${var}_INCLUDE})
|
||||
_internal_message("${lib} found")
|
||||
set(${var}_FOUND 1 CACHE INTERNAL "")
|
||||
else()
|
||||
_internal_message("${lib} not found")
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
Loading…
x
Reference in New Issue
Block a user