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下找动态库,如果是其余系统则按之前的找
时间: 2024-03-14 13:47:13 浏览: 147
解决linux下出现/lib64/libstdc++.so.6: version `CXXABI_1.3.8' not found问题
可以这样改造:
```
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/` 下找动态库。
阅读全文