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 a package configuration file provided by "Glog" with any of the following names: #519

Closed
850977164 opened this issue Jan 19, 2020 · 7 comments
Labels

Comments

@850977164
Copy link

850977164 commented Jan 19, 2020

I made this reference in the cmakelistes
image
But an error occurred in CMAKE as shown below

-- Boost version: 1.58.0
CMake Error at CMakeLists.txt:26 (find_package):
  By not providing "FindGlog.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "Glog", but
  CMake did not find one.

  Could not find a package configuration file provided by "Glog" with any of
  the following names:

    GlogConfig.cmake
    glog-config.cmake

  Add the installation prefix of "Glog" to CMAKE_PREFIX_PATH or set
  "Glog_DIR" to a directory containing one of the above files.  If "Glog"
  provides a separate development package or SDK, be sure it has been
  installed.

But I'm sure glog has installed
My English is not very good, but I really need your help

@sergiud
Copy link
Collaborator

sergiud commented Jan 19, 2020

You need to set CMAKE_PREFIX_PATH to glog installation directory as mentioned in your error message.

@YanB25
Copy link

YanB25 commented Dec 15, 2021

Sorry about replying to this closed issue.

I also encounter the same problem. I installed glog by apt, and expect glogConfig.cmake is also installed in the system. However, it is not. Therefore, find_package(glog REQUIRED) failed.

OS: ubuntu 18.04 LTS
Command: sudo apt install libgoogle-glog-dev
Glog installed path by apt: /usr/lib/x86_64-linux-gnu/
The corresponding glogConfig.cmake: Not found. Search by sudo find / -name "*cmake*".

I was wondering if it is an expected behaviour?

@sergiud
Copy link
Collaborator

sergiud commented Dec 15, 2021

I don't know. We do not maintain Ubuntu packages.

@rcywongaa-work
Copy link

As of Ubuntu 20.04 LTS, the installed glog version (0.4.0) comes with libglog.pc (installed under /usr/lib/x86_64-linux-gnu/pkgconfig/libglog.pc) but not Findglog.cmake / glogConfig.cmake / glog-config.cmake

Hence, to use it with CMake, one must follow the FindPkgConfig workflow

In a nutshell, add the following to the CmakeLists.txt

find_package(PkgConfig REQUIRED)
pkg_check_modules(glog REQUIRED libglog)

...

target_include_directories(...
  ${glog_INCLUDE_DIRS}
  ...
)

target_link_libraries(...
  ${glog_LIBRARIES}
  ...
)

@kfertakis
Copy link

Just to add on the above, in order for it to work on a mac, you might need to ${glog_LDFLAGS} in target_link_libraries if the linker complains.

@mkaur013
Copy link

mkaur013 commented Jul 8, 2022

Hello,
I am facing the same error
Cloned it from https://github.com/google/glog

CMake Error at handeye_calib_marker/CMakeLists.txt:30 (find_package):
  By not providing "FindGlog.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "Glog", but
  CMake did not find one.

  Could not find a package configuration file provided by "Glog" with any of
  the following names:

    GlogConfig.cmake
    glog-config.cmake

  Add the installation prefix of "Glog" to CMAKE_PREFIX_PATH or set
  "Glog_DIR" to a directory containing one of the above files.  If "Glog"
  provides a separate development package or SDK, be sure it has been
  installed.


-- Configuring incomplete, errors occurred!

I tried

cmake_minimum_required (VERSION 3.16)
project (myproj VERSION 1.0)

find_package (glog 0.6.0 REQUIRED)

add_executable (myapp main.cpp)
target_link_libraries (myapp glog::glog)

Also tried "cmake -DCMAKE_INSTALL_PREFIX=..."

Not fixed..please provide some solution

@sergiud
Copy link
Collaborator

sergiud commented Jul 8, 2022

Cloning glog is insufficient. You also need to compile it and possibly install the project. I also recommend taking a look at the CMake documentation for find_package.

@google google locked as resolved and limited conversation to collaborators Jul 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

6 participants