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

关于FindPackage的一个问题 #4

Open
Juddd opened this issue Aug 22, 2022 · 2 comments
Open

关于FindPackage的一个问题 #4

Juddd opened this issue Aug 22, 2022 · 2 comments

Comments

@Juddd
Copy link

Juddd commented Aug 22, 2022

请问find_package(GLOG)成功后如何用cmakelist.txt中把这个库的位置打印出来?我试着用message打印,好像只有message(${GLOG_FOUND})的值为1,你页面上说的GLOG_INCLUDE_DIR、GLOG_INCLUDES、GLOG_LIBRARY、GLOG_LIBRARIES这几个值都为空,但我想把这库的位置打印出来,请问我该怎么办呢

@Juddd Juddd changed the title 请问find_package(GLOG)成功后如何用cmakelist.txt中把这个库的位置打印出来? 关于FindPackage的一个问题 Aug 22, 2022
@BrightXiaoHan
Copy link
Owner

你好,应该是只有内置模块会确定有这几个变量,如果是像glog这种,可能只会有target。https://cliutils.gitlab.io/modern-cmake/chapters/basics.html 这个教程的 Targets are your friend 章节,对target有详细的介绍。也就是说glog创建了一个target叫glog,里面应该已经包含了头文件,库文件等等,但是并没有将这些作为单独的变量设置出来。具体的它暴露了哪些变量,可以看glog中的CMakeLists.txt。

@Juddd
Copy link
Author

Juddd commented Sep 2, 2022

嗯,我通过这里定义的print_target_properties把所有属性都打印出来:
print_target_properties(glog::glog)
image

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

2 participants