简体   繁体   中英

How to use glog in third party (C++ program)? I have added it in CMakeLists.txt but there still be file not found

CMakeLists.txt in the project source path:

在此处输入图像描述

The fatal error (fatal error: glog/logging.h: No such file or directory):

在此处输入图像描述

How to correctly include it as header file? Thanks for helping.

I have not used GLOG but I guess it is similiar to Boost:

set(find_package(Boost REQUIRED))
find_package(Boost 1.75.0 COMPONENTS program_options filesystem REQUIRED)
if(Boost_FOUND)
  include_directories(${Boost_INCLUDE_DIR})
  target_link_libraries( PhysGeo_lib PUBLIC ${Boost_LIBRARIES} )
else()
  message("'Boost' can not be located on this machine!")
endif()

and then just include proper header files:

// Boost

#include <boost/program_options/option.hpp>
#include <boost/program_options/options_description.hpp>
#include <boost/program_options/parsers.hpp>
#include <boost/program_options/variables_map.hpp>

#include <boost/filesystem/path.hpp>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM