Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could NOT find Ogg #94

Open
BBplux opened this issue Sep 22, 2022 · 0 comments
Open

Could NOT find Ogg #94

BBplux opened this issue Sep 22, 2022 · 0 comments

Comments

@BBplux
Copy link

BBplux commented Sep 22, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant