vgmstream/xmplay/CMakeLists.txt

34 lines
1014 B
CMake
Raw Normal View History

add_library(xmp-vgmstream SHARED
xmpfunc.h
xmpin.h
xmp_vgmstream.c
xmpin.def)
setup_target(xmp-vgmstream TRUE)
# Remove the prefix and set the suffix to .dll
set_target_properties(xmp-vgmstream PROPERTIES
PREFIX ""
SUFFIX ".dll")
# Make sure that the binary directory is included (for version.h)
target_include_directories(xmp-vgmstream PRIVATE ${CMAKE_BINARY_DIR})
# Link to the vgmstream library
target_link_libraries(xmp-vgmstream libvgmstream)
# Include the version string
if(MSVC)
add_dependencies(xmp-vgmstream version_h)
elseif(MINGW)
if(VGMSTREAM_VERSION)
target_compile_definitions(xmp-vgmstream PRIVATE VERSION="${VGMSTREAM_VERSION}")
endif()
# Also, on MinGW when using GCC, these flags need to be included to prevent requiring MinGW's runtime DLLs from being included, which does unfortunately increase the size of the DLL
if(NOT CMAKE_CXX_COMPILER_ID MATCHES Clang)
set_target_properties(xmp-vgmstream PROPERTIES
LINK_FLAGS "-static-libgcc -static-libstdc++")
endif()
endif()