在 CMakeLists 文件中指定 Crypto++ 库
Specify Crypto++ library in a CMakeLists file
我试图在我的 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!
感谢您的帮助!
CMake 在包中没有用于 Crypto++ 库的模块,因此您必须提供自己的模块。您可以尝试 following(我用过一次)或 google 作为 "Find CryptoPP cmake"。
完成文件后,将其放在某处并指向 CMake 以在该位置搜索文件。假设你把它放在你的 sources 目录下的 contrib/cmake
子文件夹中,那么 CMake 代码将是:
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/contrib/cmake")
因此您设置了模块搜索的路径,现在您需要使用 find_package
,但是请注意,您应该以与 .cmake
文件命名相同的方式提供包名称。例如,如果您有 CryptoPP.cmak
e,那么您应该输入以下内容:
find_package ( CryptoPP REQUIRED )
我试图在我的 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!
感谢您的帮助!
CMake 在包中没有用于 Crypto++ 库的模块,因此您必须提供自己的模块。您可以尝试 following(我用过一次)或 google 作为 "Find CryptoPP cmake"。
完成文件后,将其放在某处并指向 CMake 以在该位置搜索文件。假设你把它放在你的 sources 目录下的 contrib/cmake
子文件夹中,那么 CMake 代码将是:
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/contrib/cmake")
因此您设置了模块搜索的路径,现在您需要使用 find_package
,但是请注意,您应该以与 .cmake
文件命名相同的方式提供包名称。例如,如果您有 CryptoPP.cmak
e,那么您应该输入以下内容:
find_package ( CryptoPP REQUIRED )