Co-authored-by: aleksandr.vodyanov <aleksandr.vodyanov@avroid.tech> Reviewed-on: https://git.avroid.tech/Conan/conan_build/pulls/9
57 lines
1.9 KiB
Diff
57 lines
1.9 KiB
Diff
Backport in 1.3.6 some build improvements of 1.3.7:
|
|
* link to libm
|
|
* usage of find_package to discover Ogg and link with Ogg:ogg target
|
|
|
|
--- a/CMakeLists.txt
|
|
+++ b/CMakeLists.txt
|
|
@@ -4,6 +4,7 @@ project(vorbis)
|
|
# Required modules
|
|
include(GNUInstallDirs)
|
|
include(CheckIncludeFiles)
|
|
+include(CheckLibraryExists)
|
|
|
|
# Build options
|
|
option(BUILD_SHARED_LIBS "Build shared library" OFF)
|
|
@@ -52,18 +53,12 @@ endfunction()
|
|
|
|
message(STATUS "Configuring ${PROJECT_NAME} ${PROJECT_VERSION}")
|
|
|
|
+# Find math library
|
|
+
|
|
+check_library_exists(m floor "" HAVE_LIBM)
|
|
+
|
|
# Find ogg dependency
|
|
-if(NOT OGG_ROOT)
|
|
- find_package(PkgConfig QUIET)
|
|
- pkg_check_modules(PC_OGG QUIET ogg)
|
|
- find_path(OGG_INCLUDE_DIRS NAMES ogg/ogg.h HINTS ${PC_OGG_INCLUDE_DIRS} PATH_SUFFIXES ogg)
|
|
- find_library(OGG_LIBRARIES NAMES ogg HINTS ${PC_OGG_LIBRARY_DIRS})
|
|
-else()
|
|
- find_path(OGG_INCLUDE_DIRS NAMES ogg/ogg.h HINTS ${OGG_ROOT}/include PATH_SUFFIXES ogg)
|
|
- find_library(OGG_LIBRARIES NAMES ogg HINTS ${OGG_ROOT}/lib ${OGG_ROOT}/lib64)
|
|
-endif()
|
|
-include(FindPackageHandleStandardArgs)
|
|
-find_package_handle_standard_args(OGG DEFAULT_MSG OGG_INCLUDE_DIRS OGG_LIBRARIES)
|
|
+find_package(Ogg REQUIRED)
|
|
|
|
add_subdirectory(lib)
|
|
|
|
--- a/lib/CMakeLists.txt
|
|
+++ b/lib/CMakeLists.txt
|
|
@@ -83,9 +83,12 @@ if (NOT BUILD_FRAMEWORK)
|
|
get_version_info(VORBISFILE_VERSION_INFO "VF_LIB_CURRENT" "VF_LIB_AGE" "VF_LIB_REVISION")
|
|
set_target_properties(vorbisfile PROPERTIES SOVERSION ${VORBISFILE_VERSION_INFO})
|
|
|
|
- target_link_libraries(vorbis ${OGG_LIBRARIES})
|
|
- target_link_libraries(vorbisenc ${OGG_LIBRARIES} vorbis)
|
|
- target_link_libraries(vorbisfile ${OGG_LIBRARIES} vorbis)
|
|
+ target_link_libraries(vorbis
|
|
+ PUBLIC Ogg::ogg
|
|
+ PRIVATE $<$<BOOL:${HAVE_LIBM}>:m>
|
|
+ )
|
|
+ target_link_libraries(vorbisenc PUBLIC vorbis)
|
|
+ target_link_libraries(vorbisfile PUBLIC vorbis)
|
|
|
|
install(FILES ${VORBIS_PUBLIC_HEADERS} DESTINATION ${CMAKE_INSTALL_FULL_INCLUDEDIR}/vorbis)
|
|
|