zdoom-macos-deps/deps/sdl2_mixer/lib/cmake/SDL2_mixer/Findlibxmp.cmake

45 lines
1.4 KiB
CMake
Raw Normal View History

2024-01-24 11:34:08 +00:00
include(FindPackageHandleStandardArgs)
find_package(PkgConfig QUIET)
pkg_check_modules(PC_XMP QUIET libxmp)
2022-07-09 14:01:49 +00:00
find_library(libxmp_LIBRARY
NAMES xmp
2024-01-24 11:34:08 +00:00
HINTS ${PC_XMP_LIBDIR}
2022-07-09 14:01:49 +00:00
)
find_path(libxmp_INCLUDE_PATH
NAMES xmp.h
2024-01-24 11:34:08 +00:00
HINTS ${PC_XMP_INCLUDEDIR}
2022-07-09 14:01:49 +00:00
)
2024-01-24 11:34:08 +00:00
if(PC_XMP_FOUND)
get_flags_from_pkg_config("${libxmp_LIBRARY}" "PC_XMP" "_libxmp")
endif()
set(libxmp_COMPILE_OPTIONS "${_libxmp_compile_options}" CACHE STRING "Extra compile options of libxmp")
set(libxmp_LINK_LIBRARIES "${_libxmp_link_libraries}" CACHE STRING "Extra link libraries of libxmp")
2022-07-09 14:01:49 +00:00
2024-01-24 11:34:08 +00:00
set(libxmp_LINK_OPTIONS "${_libxmp_link_options}" CACHE STRING "Extra link flags of libxmp")
2022-07-09 14:01:49 +00:00
2024-01-24 11:34:08 +00:00
set(libxmp_LINK_DIRECTORIES "${_libxmp_link_directories}" CACHE PATH "Extra link flags of libxmp")
2022-07-09 14:01:49 +00:00
find_package_handle_standard_args(libxmp
REQUIRED_VARS libxmp_LIBRARY libxmp_INCLUDE_PATH
)
if(libxmp_FOUND)
if(NOT TARGET libxmp::libxmp)
add_library(libxmp::libxmp UNKNOWN IMPORTED)
set_target_properties(libxmp::libxmp PROPERTIES
IMPORTED_LOCATION "${libxmp_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${libxmp_INCLUDE_PATH}"
INTERFACE_COMPILE_OPTIONS "${libxmp_COMPILE_OPTIONS}"
INTERFACE_LINK_LIBRARIES "${libxmp_LINK_LIBRARIES}"
2024-01-24 11:34:08 +00:00
INTERFACE_LINK_OPTIONS "${libxmp_LINK_OPTIONS}"
INTERFACE_LINK_DIRECTORIES "${libxmp_LINK_DIRECTORIES}"
2022-07-09 14:01:49 +00:00
)
endif()
endif()