1 set(VORBIS_PUBLIC_HEADERS
2 ../include/vorbis/codec.h
3 ../include/vorbis/vorbisenc.h
4 ../include/vorbis/vorbisfile.h
52 set(VORBISFILE_SOURCES
61 list(APPEND VORBIS_SOURCES vorbisenc.c)
65 list(APPEND VORBIS_SOURCES ../win32/vorbis.def)
66 list(APPEND VORBISENC_SOURCES ../win32/vorbisenc.def)
67 list(APPEND VORBISFILE_SOURCES ../win32/vorbisfile.def)
71 add_definitions(-D_CRT_SECURE_NO_WARNINGS)
72 add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
73 add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE)
76 if (NOT BUILD_FRAMEWORK)
77 add_library(vorbis ${VORBIS_HEADERS} ${VORBIS_SOURCES})
78 add_library(vorbisenc ${VORBISENC_SOURCES})
79 add_library(vorbisfile ${VORBISFILE_SOURCES})
81 get_version_info(VORBIS_VERSION_INFO "V_LIB_CURRENT" "V_LIB_AGE" "V_LIB_REVISION")
82 set_target_properties(vorbis PROPERTIES SOVERSION ${VORBIS_VERSION_INFO})
83 get_version_info(VORBISENC_VERSION_INFO "VE_LIB_CURRENT" "VE_LIB_AGE" "VE_LIB_REVISION")
84 set_target_properties(vorbisenc PROPERTIES SOVERSION ${VORBISENC_VERSION_INFO})
85 get_version_info(VORBISFILE_VERSION_INFO "VF_LIB_CURRENT" "VF_LIB_AGE" "VF_LIB_REVISION")
86 set_target_properties(vorbisfile PROPERTIES SOVERSION ${VORBISFILE_VERSION_INFO})
88 target_include_directories(vorbis
90 $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
91 $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
93 ${CMAKE_CURRENT_SOURCE_DIR}
95 target_include_directories(vorbisenc
97 $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
98 $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
100 ${CMAKE_CURRENT_SOURCE_DIR}
102 target_include_directories(vorbisfile
104 $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
105 $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
108 target_link_libraries(vorbis
110 PRIVATE $<$<BOOL:${HAVE_LIBM}>:m>
112 target_link_libraries(vorbisenc PUBLIC vorbis)
113 target_link_libraries(vorbisfile PUBLIC vorbis)
115 install(FILES ${VORBIS_PUBLIC_HEADERS} DESTINATION ${CMAKE_INSTALL_FULL_INCLUDEDIR}/vorbis)
117 install(TARGETS vorbis vorbisenc vorbisfile
119 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
120 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
121 ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
122 FRAMEWORK DESTINATION ${CMAKE_INSTALL_LIBDIR}
125 if(INSTALL_CMAKE_PACKAGE_MODULE)
127 set(CMAKE_INSTALL_CONFIGDIR ${CMAKE_INSTALL_LIBDIR}/cmake/Vorbis)
129 install(EXPORT VorbisTargets
130 DESTINATION ${CMAKE_INSTALL_CONFIGDIR}
135 include(CMakePackageConfigHelpers)
137 configure_package_config_file(${PROJECT_SOURCE_DIR}/cmake/VorbisConfig.cmake.in ${PROJECT_BINARY_DIR}/VorbisConfig.cmake
138 INSTALL_DESTINATION ${CMAKE_INSTALL_CONFIGDIR}
141 write_basic_package_version_file(${PROJECT_BINARY_DIR}/VorbisConfigVersion.cmake
142 COMPATIBILITY SameMajorVersion
145 install(FILES ${PROJECT_BINARY_DIR}/VorbisConfig.cmake ${PROJECT_BINARY_DIR}/VorbisConfigVersion.cmake
146 DESTINATION ${CMAKE_INSTALL_CONFIGDIR}
151 add_library(vorbis ${VORBIS_PUBLIC_HEADERS} ${VORBIS_HEADERS} ${VORBIS_SOURCES} ${VORBISFILE_SOURCES} ${VORBISENC_SOURCES})
152 set_target_properties(vorbis PROPERTIES
154 FRAMEWORK_VERSION ${PROJECT_VERSION}
155 MACOSX_FRAMEWORK_IDENTIFIER org.xiph.vorbis
156 MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${PROJECT_VERSION}
157 MACOSX_FRAMEWORK_BUNDLE_VERSION ${PROJECT_VERSION}
158 XCODE_ATTRIBUTE_INSTALL_PATH "@rpath"
159 PUBLIC_HEADER "${VORBIS_PUBLIC_HEADERS}"
162 target_link_libraries(vorbis ${OGG_LIBRARIES})