Open BBplux opened 1 year ago
cmake --DOGG_ROOT=/usr/local/
FindOgg.cmake:
if(OGG_INCLUDE_DIR) # Already in cache, be silent set(OGG_FIND_QUIETLY TRUE) endif() find_package(PkgConfig QUIET) pkg_check_modules(PC_OGG QUIET ogg) set(OGG_VERSION_STRING ${PC_OGG_VERSION}) message(${OGG_ROOT}) find_path(OGG_INCLUDE_DIR ogg/ogg.h HINTS ${PC_OGG_INCLUDEDIR} ${PC_OGG_INCLUDE_DIRS} ${OGG_ROOT} PATH_SUFFIXES include ) message(${OGG_INCLUDE_DIR}) # MSVC built ogg may be named ogg_static. # The provided project files name the library with the lib prefix. find_library(OGG_LIBRARY NAMES ogg ogg_static libogg libogg_static HINTS ${PC_OGG_LIBDIR} ${PC_OGG_LIBRARY_DIRS} ${OGG_ROOT} PATH_SUFFIXES lib ) # Handle the QUIETLY and REQUIRED arguments and set OGG_FOUND # to TRUE if all listed variables are TRUE. include(FindPackageHandleStandardArgs) find_package_handle_standard_args(Ogg REQUIRED_VARS OGG_LIBRARY OGG_INCLUDE_DIR VERSION_VAR OGG_VERSION_STRING ) if(OGG_FOUND) set(OGG_LIBRARIES ${OGG_LIBRARY}) set(OGG_INCLUDE_DIRS ${OGG_INCLUDE_DIR}) if(NOT TARGET Ogg::ogg) add_library(Ogg::ogg UNKNOWN IMPORTED) set_target_properties(Ogg::ogg PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${OGG_INCLUDE_DIRS}" IMPORTED_LOCATION "${OGG_LIBRARIES}" ) endif() endif() mark_as_advanced(OGG_INCLUDE_DIR OGG_LIBRARY)
output:
/usr/local/ OGG_INCLUDE_DIR-NOTFOUND CMake Error at /usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:230 (message): Could NOT find Ogg (missing: OGG_LIBRARY OGG_INCLUDE_DIR) Call Stack (most recent call first): /usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE) cmake/FindOgg.cmake:77 (find_package_handle_standard_args) CMakeLists.txt:70 (find_package)
# ls /usr/local/include/ogg config_types.h ogg.h os_types.h # ls /usr/local/lib cmake libogg.a libopus.a pkgconfig python3.10
the "/usr/local" has libogg and ogg.h ,but can't find ogg
FindOgg.cmake:
output:
the "/usr/local" has libogg and ogg.h ,but can't find ogg