Closed valaxkong closed 6 months ago
I found the solutions.
FetchContent_Declare(
glog
GIT_REPOSITORY https://github.com/google/glog.git
GIT_TAG v0.6.0
)
FetchContent_GetProperties(glog)
if(NOT glog_POPULATED)
FetchContent_Populate(glog)
add_subdirectory(${glog_SOURCE_DIR} ${glog_BINARY_DIR})
endif()
And I will give a PR later.
add_subdirectory
mentioned in the docs does not use FetchContent
. You need to specify the build directory only for the latter explicitly.
The issue is not actionable. You can however extend the README
with a link to CMake reference documentation that explains how to use FetchContent
correctly if you want.
@sergiud I opened a PR which gives an example to show the usage of FetchContent and add_subdirectory. https://github.com/google/glog/pull/1067
I saw the README said glog can be incorporated into custom projects using the CMake command
add_subdirectory
. I tried it like thisWhen building as a submodule of my projects, I found those template codes in xxx.h.in files have not been replaced to generate xxx.h file. How to do things right? Thanks for your help.