我正在尝试在CMakeLists
文件中指定Crypto ++库,但我总是收到错误。
这是我的CMakeLists
文件:
cmake_minimum_required(VERSION 2.8)
project( Recognition )
find_package( OpenCV REQUIRED )
find_package ( CURL REQUIRED )
find_package ( CRYPTOPP REQUIRED )
add_executable( Recognition Recognition.cpp )
target_link_libraries( Recognition ${OpenCV_LIBS} ${CURL_LIBRARY} ${CRYPTOPP_LIBRARY})
以下是我得到的错误:
By not providing "FindCRYPTOPP.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "CRYPTOPP",
but CMake did not find one.
Could not find a package configuration file provided by "CRYPTOPP" with any
of the following names:
CRYPTOPPConfig.cmake
cryptopp-config.cmake
Add the installation prefix of "CRYPTOPP" to CMAKE_PREFIX_PATH or set
"CRYPTOPP_DIR" to a directory containing one of the above files. If
"CRYPTOPP" provides a separate development package or SDK, be sure it has
been installed.
-- Configuring incomplete, errors occurred!
感谢您的帮助!
答案 0 :(得分:5)
CMake在包中没有Crypto ++库的模块,因此您必须提供自己的模块。您可以尝试使用following(我已经使用过一次)或谷歌搜索“查找CryptoPP cmake”。
完成文件后,将其放在某处并指向CMake以搜索该位置的文件。假设您已将其放在contrib/cmake
子文件夹中的sources目录下,那么CMake代码将为:
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/contrib/cmake")
因此,您现在需要使用find_package
设置模块搜索的路径,但是请注意,您应该以命名.cmake
文件的相同方式提供包名称。例如,如果您有CryptoPP.cmak
e,那么您应该输入以下内容:
find_package ( CryptoPP REQUIRED )