SRB2/cmake/Modules/Findlibopenmpt.cmake
2024-03-23 04:50:19 +00:00

37 lines
940 B
CMake

include(LibFindMacros)
libfind_pkg_check_modules(libopenmpt_PKGCONF openmpt)
find_path(libopenmpt_INCLUDE_DIR
NAMES libopenmpt.h
PATHS
${libopenmpt_PKGCONF_INCLUDE_DIRS}
"${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include/libopenmpt"
"/usr/include/libopenmpt"
"/usr/local/include/libopenmpt"
)
find_library(libopenmpt_LIBRARY
NAMES openmpt
PATHS
${libopenmpt_PKGCONF_LIBRARY_DIRS}
"/usr/lib"
"/usr/local/lib"
)
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(libopenmpt
REQUIRED_VARS libopenmpt_LIBRARY libopenmpt_INCLUDE_DIR)
if(libopenmpt_FOUND AND NOT TARGET openmpt)
add_library(openmpt UNKNOWN IMPORTED)
set_target_properties(
openmpt
PROPERTIES
IMPORTED_LOCATION "${libopenmpt_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${libopenmpt_INCLUDE_DIR}"
)
add_library(libopenmpt::libopenmpt ALIAS openmpt)
endif()
mark_as_advanced(libopenmpt_LIBRARY libopenmpt_INCLUDE_DIR)