diff options
author | fuzzard <fuzzard@kodi.tv> | 2024-05-11 21:40:02 +1000 |
---|---|---|
committer | fuzzard <fuzzard@kodi.tv> | 2024-05-18 11:27:12 +1000 |
commit | 67bca842751063a210bc52a05983d03c03951006 (patch) | |
tree | a28745bb88f9a64dc5f6f0f9085bbb77d80517fc | |
parent | 17e6d9969fd2651b240407e15024fd2f8de9e282 (diff) | |
download | xbmc-67bca842751063a210bc52a05983d03c03951006.tar.xz |
[cmake][modules] FindDetours cleanup and use core_target_link_libraries
-rw-r--r-- | cmake/modules/FindDetours.cmake | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/cmake/modules/FindDetours.cmake b/cmake/modules/FindDetours.cmake index e31bc8fb50..6d87c85ea6 100644 --- a/cmake/modules/FindDetours.cmake +++ b/cmake/modules/FindDetours.cmake @@ -5,35 +5,36 @@ # # This will define the following target: # -# windows::Detours - The Detours library +# ${APP_NAME_LC}::Detours - The Detours library -if(NOT TARGET windows::Detours) - find_path(DETOURS_INCLUDE_DIR NAMES detours.h - NO_CACHE) +if(NOT TARGET ${APP_NAME_LC}::${CMAKE_FIND_PACKAGE_NAME}) + find_path(DETOURS_INCLUDE_DIR NAMES detours.h) find_library(DETOURS_LIBRARY_RELEASE NAMES detours - ${${CORE_PLATFORM_LC}_SEARCH_CONFIG} - NO_CACHE) + ${${CORE_PLATFORM_LC}_SEARCH_CONFIG}) find_library(DETOURS_LIBRARY_DEBUG NAMES detoursd - ${${CORE_PLATFORM_LC}_SEARCH_CONFIG} - NO_CACHE) + ${${CORE_PLATFORM_LC}_SEARCH_CONFIG}) include(SelectLibraryConfigurations) select_library_configurations(DETOURS) + unset(DETOURS_LIBRARIES) 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}") + add_library(${APP_NAME_LC}::${CMAKE_FIND_PACKAGE_NAME} UNKNOWN IMPORTED) + set_target_properties(${APP_NAME_LC}::${CMAKE_FIND_PACKAGE_NAME} 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}") + set_target_properties(${APP_NAME_LC}::${CMAKE_FIND_PACKAGE_NAME} PROPERTIES + IMPORTED_LOCATION_DEBUG "${DETOURS_LIBRARY_DEBUG}") + endif() + else() + if(Detours_FIND_REQUIRED) + message(FATAL_ERROR "Detour libraries were not found.") endif() - set_property(GLOBAL APPEND PROPERTY INTERNAL_DEPS_PROP windows::Detours) endif() endif() |