now using Findpcre.cmake find libpcre lib dir: PCRE_LIBRARY-NOTFOUND include files /usr/include now using Findyaml.cmake find libyaml lib dir: YAML_LIBRARY-NOTFOUND include files /usr/include
时间: 2024-03-14 12:49:43 浏览: 220
这是一段 CMake 的输出,说明当前的 CMake 脚本正在尝试使用 Findpcre.cmake 和 Findyaml.cmake 来查找 libpcre 和 libyaml 的位置。其中,PCRE_LIBRARY-NOTFOUND 和 YAML_LIBRARY-NOTFOUND 表示 CMake 没有找到相应的库文件,而 /usr/include 则是已经找到的头文件目录。可能需要安装相应的库文件或者修改 CMakeLists.txt 文件中的相关配置来解决这个问题。
相关问题
message("now using Findpcre.cmake find libpcre") FIND_PATH(PCRE_INCLUDE_DIR pcre.h /usr/include/) FIND_LIBRARY(PCRE_LIBRARY libpcre.a /usr/lib/x86_64-linux-gnu/) message("lib dir: ${PCRE_LIBRARY} include files ${PCRE_INCLUDE_DIR}") if(PCRE_INCLUDE_DIR AND PCRE_LIBRARY) set(PCRE_FOUND TRUE) endif(PCRE_INCLUDE_DIR AND PCRE_LIBRARY)改造一下,如果是centos系统那去/usr/lib64下找动态库,如果是其余系统则按之前的找
可以这样改造:
```
message("now using Findpcre.cmake to find libpcre")
if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_SYSTEM_VERSION MATCHES "centos")
FIND_PATH(PCRE_INCLUDE_DIR pcre.h /usr/include/)
FIND_LIBRARY(PCRE_LIBRARY libpcre.a /usr/lib64/)
else()
FIND_PATH(PCRE_INCLUDE_DIR pcre.h /usr/include/)
FIND_LIBRARY(PCRE_LIBRARY libpcre.a /usr/lib/x86_64-linux-gnu/)
endif()
message("lib dir: ${PCRE_LIBRARY} include files ${PCRE_INCLUDE_DIR}")
if(PCRE_INCLUDE_DIR AND PCRE_LIBRARY)
set(PCRE_FOUND TRUE)
endif(PCRE_INCLUDE_DIR AND PCRE_LIBRARY)
```
这样,如果系统是 Linux 并且版本是 centos,就会去 `/usr/lib64` 下找动态库;否则就按照之前的方式去 `/usr/lib/x86_64-linux-gnu/` 下找动态库。
message("now using Findyaml.cmake find libyaml") FIND_PATH(YAML_INCLUDE_DIR yaml.h /usr/include/) FIND_LIBRARY(YAML_LIBRARY libyaml.a /usr/lib/x86_64-linux-gnu/) message("lib dir: ${YAML_LIBRARY} include files ${YAML_INCLUDE_DIR}") if(YAML_INCLUDE_DIR AND YAML_LIBRARY) set(YAML_FOUND TRUE) endif(YAML_INCLUDE_DIR AND YAML_LIBRARY)改造一下,如果是centos系统那去/usr/lib64下找动态库,如果是其余系统则按之前的找
好的,可以按照如下方式改造:
```
message("now using Findyaml.cmake find libyaml")
if(CMAKE_SYSTEM_NAME MATCHES "CentOS")
FIND_LIBRARY(YAML_LIBRARY libyaml.so /usr/lib64/)
else()
FIND_LIBRARY(YAML_LIBRARY libyaml.a /usr/lib/x86_64-linux-gnu/)
endif()
FIND_PATH(YAML_INCLUDE_DIR yaml.h /usr/include/)
message("lib dir: ${YAML_LIBRARY} include files ${YAML_INCLUDE_DIR}")
if(YAML_INCLUDE_DIR AND YAML_LIBRARY)
set(YAML_FOUND TRUE)
endif(YAML_INCLUDE_DIR AND YAML_LIBRARY)
```
这样,当系统名称匹配"CentOS"时,就会去`/usr/lib64/`下找动态库libyaml.so,否则就按之前的方式去`/usr/lib/x86_64-linux-gnu/`下找静态库libyaml.a。
阅读全文