aboutsummaryrefslogtreecommitdiff
path: root/cmake/modules/FindDetours.cmake
blob: e31bc8fb502f7c4e74b9ec09df0858da2b52b4b4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#.rst:
# FindDetours
# --------
# Finds the Detours library
#
# This will define the following target:
#
#   windows::Detours - The Detours library

if(NOT TARGET windows::Detours)
  find_path(DETOURS_INCLUDE_DIR NAMES detours.h
                                NO_CACHE)

  find_library(DETOURS_LIBRARY_RELEASE NAMES detours
                                       ${${CORE_PLATFORM_LC}_SEARCH_CONFIG}
                                       NO_CACHE)
  find_library(DETOURS_LIBRARY_DEBUG NAMES detoursd
                                     ${${CORE_PLATFORM_LC}_SEARCH_CONFIG}
                                     NO_CACHE)

  include(SelectLibraryConfigurations)
  select_library_configurations(DETOURS)

  include(FindPackageHandleStandardArgs)
  find_package_handle_standard_args(Detours
                                    REQUIRED_VARS DETOURS_LIBRARY DETOURS_INCLUDE_DIR)

  if(DETOURS_FOUND)
    add_library(windows::Detours UNKNOWN IMPORTED)
    set_target_properties(windows::Detours PROPERTIES
                                           INTERFACE_INCLUDE_DIRECTORIES "${DETOURS_INCLUDE_DIR}"
                                           IMPORTED_LOCATION "${DETOURS_LIBRARY_RELEASE}")
    if(DETOURS_LIBRARY_DEBUG)
      set_target_properties(windows::Detours PROPERTIES
                                             IMPORTED_LOCATION_DEBUG "${DETOURS_LIBRARY_DEBUG}")
    endif()
    set_property(GLOBAL APPEND PROPERTY INTERNAL_DEPS_PROP windows::Detours)
  endif()
endif()