Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Specify Crypto++ library in a CMakeLists file

I am trying to specify the Crypto++ library in my CMakeLists file but I always get an error.

Here is my CMakeLists file:

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})

And here is the errors I get:

 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!

Thank you for your help!

like image 806
Omar Lahlou Avatar asked Apr 16 '15 15:04

Omar Lahlou


1 Answers

CMake doesn't have a module for the Crypto++ library in the package so you have to provide your own. You can try the following(I've used it once) or google for the "Find CryptoPP cmake".

When you are done with the file, place it somewhere and point CMake to search for the file in that location. Suppose you have placed it under your sources directory in contrib/cmake subfolder, then CMake code will be:

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/contrib/cmake")

So you set the path for the modules search now you need to use find_package, note, however, that you should provide the package name in the same fashion your .cmake file is named. For example, if you have CryptoPP.cmake, then you should put the following:

find_package ( CryptoPP REQUIRED )
like image 163
ixSci Avatar answered Nov 11 '22 12:11

ixSci