0
0
mirror of https://github.com/obsproject/obs-studio.git synced 2024-09-20 13:08:50 +02:00
obs-studio/cmake/Modules/FindDetours.cmake

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

76 lines
2.0 KiB
CMake
Raw Normal View History

2021-05-16 21:56:33 +02:00
# Once done these will be defined:
#
# * DETOURS_FOUND
# * DETOURS_INCLUDE_DIRS
# * DETOURS_LIBRARIES
2021-05-16 21:56:33 +02:00
#
# For use in OBS:
#
# DETOURS_INCLUDE_DIR
2021-05-16 21:56:33 +02:00
find_package(PkgConfig QUIET)
if(PKG_CONFIG_FOUND)
pkg_check_modules(_DETOURS QUIET detours)
2021-05-16 21:56:33 +02:00
endif()
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(_lib_suffix 64)
2021-05-16 21:56:33 +02:00
else()
set(_lib_suffix 32)
2021-05-16 21:56:33 +02:00
endif()
find_path(
DETOURS_INCLUDE_DIR
NAMES detours.h
HINTS ENV DETOURS_PATH ${DETOURS_PATH} ${CMAKE_SOURCE_DIR}/${DETOURS_PATH}
${_DETOURS_INCLUDE_DIRS}
PATHS /usr/include /usr/local/include /opt/local/include /sw/include
PATH_SUFFIXES include)
2021-05-16 21:56:33 +02:00
find_library(
DETOURS_LIB
NAMES ${_DETOURS_LIBRARIES} detours
HINTS ENV DETOURS_PATH ${DETOURS_PATH} ${CMAKE_SOURCE_DIR}/${DETOURS_PATH}
${_DETOURS_LIBRARY_DIRS}
PATHS /usr/lib /usr/local/lib /opt/local/lib /sw/lib
PATH_SUFFIXES
lib${_lib_suffix}
lib
libs${_lib_suffix}
libs
bin${_lib_suffix}
bin
../lib${_lib_suffix}
../lib
../libs${_lib_suffix}
../libs
../bin${_lib_suffix}
../bin)
2021-05-16 21:56:33 +02:00
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Detours DEFAULT_MSG DETOURS_LIB
DETOURS_INCLUDE_DIR)
2021-05-16 21:56:33 +02:00
mark_as_advanced(DETOURS_INCLUDE_DIR DETOURS_LIB)
if(DETOURS_FOUND)
set(DETOURS_INCLUDE_DIRS ${DETOURS_INCLUDE_DIR})
set(DETOURS_LIBRARIES ${DETOURS_LIB})
if(NOT TARGET Detours::Detours)
if(IS_ABSOLUTE "${DETOURS_LIBRARIES}")
add_library(Detours::Detours UNKNOWN IMPORTED)
set_target_properties(Detours::Detours PROPERTIES IMPORTED_LOCATION
"${DETOURS_LIBRARIES}")
else()
add_library(Detours::Detours INTERFACE IMPORTED)
set_target_properties(Detours::Detours PROPERTIES IMPORTED_LIBNAME
"${DETOURS_LIBRARIES}")
endif()
set_target_properties(
Detours::Detours PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
"${DETOURS_INCLUDE_DIRS}")
endif()
2021-05-16 21:56:33 +02:00
endif()