mirror of
https://github.com/ZDoom/ZMusic.git
synced 2024-11-27 06:02:28 +00:00
b3c4b55dab
- Prefer target properties instead of setting variables whenever possible. A zmusic-obj target now exists to represent the commonality between zmusic and zmusiclite. - Factored out as much as possible from global settings to per target settings which will make it easier to support using ZMusic as a submodule. Moved helper functions into a ZUtility.cmake module. - We now generate and install ZMusicConfig.cmake so find_package(ZMusic) will work either automatically or given ZMusic_DIR is set. - CPack is enabled although some refinement is still needed. - Requires CMake >= 3.13 which is newer than I would normally like, but given how no one like to refactor these things it may be better to deal with the short term pain of going a little aggressive on the requirement in order to avoid having to make things ugly. Especially given that these scripts have a tendency to be copy/pasted into sister projects. CMake itself has very few dependencies so users of old Linux distros should be able to easily compile a supported version of CMake. - On Windows CMake >= 3.15 is required for redistributable results. - Cleaned out bits that were copied from GZDoom but not relevant to ZMusic.
37 lines
908 B
CMake
37 lines
908 B
CMake
# - Find Game Music Emulation
|
|
#
|
|
# GME_INCLUDE_DIR - where to find gme.h
|
|
# GME_LIBRARY - Path to gme library.
|
|
# GME_FOUND - True if gme found.
|
|
|
|
|
|
if(GME_INCLUDE_DIR AND GME_LIBRARY)
|
|
# Already in cache, be silent
|
|
set(GME_FIND_QUIETLY TRUE)
|
|
endif()
|
|
|
|
if(NOT GME_INCLUDE_DIR)
|
|
find_path(GME_INCLUDE_DIR gme.h)
|
|
endif()
|
|
|
|
if(NOT GME_LIBRARY)
|
|
find_library(GME_LIBRARY NAMES gme)
|
|
endif()
|
|
|
|
# handle the QUIETLY and REQUIRED arguments and set GME_FOUND to TRUE if
|
|
# all listed variables are TRUE
|
|
include(FindPackageHandleStandardArgs)
|
|
find_package_handle_standard_args(GME DEFAULT_MSG GME_LIBRARY GME_INCLUDE_DIR)
|
|
|
|
if(GME_FOUND)
|
|
add_library(gme UNKNOWN IMPORTED)
|
|
set_target_properties(gme
|
|
PROPERTIES
|
|
IMPORTED_LOCATION "${GME_LIBRARY}"
|
|
INTERFACE_INCLUDE_DIRECTORIES "${GME_INCLUDE_DIR}"
|
|
)
|
|
|
|
# Legacy variables
|
|
set(GME_INCLUDE_DIRS ${GME_INCLUDE_DIR})
|
|
set(GME_LIBRARIES ${GME_LIBRARY})
|
|
endif()
|