CMake错误:此项目中使用了以下变量,但将它们设置为NOTFOUND,OPENSSL_INCLUDE_DIR用作包含目录

时间:2018-10-31 11:17:04

标签: ubuntu cmake openssl webrtc libsourcey

我正在尝试运行 cmake 命令

cmake .. -DCMAKE_BUILD_TYPE=DEBUG -DBUILD_SHARED_LIBS=OFF         
-DBUILD_MODULES=OFF -DBUILD_APPLICATIONS=OFF          
-DBUILD_SAMPLES=OFF -DBUILD_TESTS=OFF          
-DWITH_WEBRTC=ON -DWITH_FFMPEG=ON          
-DBUILD_MODULE_base=ON -DBUILD_MODULE_crypto=ON          
-DBUILD_MODULE_http=ON -DBUILD_MODULE_json=ON          
-DBUILD_MODULE_av=ON -DBUILD_MODULE_net=ON          
-DBUILD_MODULE_socketio=ON -DBUILD_MODULE_symple=ON          - 
DBUILD_MODULE_util=ON -DBUILD_MODULE_uv=ON          
-DBUILD_MODULE_webrtc=ON -DWEBRTC_INCLUDE_DIRS=/tmp/webrtc-22215-ab42706-linux-x64/include/ 
-DWEBRTC_LIBRARIES=/tmp/webrtc-22215-ab42706-linux-x64/lib/ 
-DOPENSSL_INCLUDE_DIR=/usr/include/openssl

以错误结尾

 CMake Error: The following variables are used in this project, but
 they are set to NOTFOUND. Please set them or make sure they are set
 and tested correctly in the CMake files:
 /home/ubuntu/temp/libsourcey/src/av/OPENSSL_INCLUDE_DIR    used as
 include directory in directory /home/ubuntu/temp/libsourcey/src/av
 /home/ubuntu/temp/libsourcey/src/base/OPENSSL_INCLUDE_DIR    used as
 include directory in directory /home/ubuntu/temp/libsourcey/src/base
 /home/ubuntu/temp/libsourcey/src/crypto/OPENSSL_INCLUDE_DIR    used as
 include directory in directory /home/ubuntu/temp/libsourcey/src/crypto
 /home/ubuntu/temp/libsourcey/src/http/OPENSSL_INCLUDE_DIR    used as
 include directory in directory /home/ubuntu/temp/libsourcey/src/http
 /home/ubuntu/temp/libsourcey/src/json/OPENSSL_INCLUDE_DIR    used as
 include directory in directory /home/ubuntu/temp/libsourcey/src/json
 /home/ubuntu/temp/libsourcey/src/net/OPENSSL_INCLUDE_DIR    used as
 include directory in directory /home/ubuntu/temp/libsourcey/src/net
 /home/ubuntu/temp/libsourcey/src/socketio/OPENSSL_INCLUDE_DIR    used
 as include directory in directory
 /home/ubuntu/temp/libsourcey/src/socketio
 /home/ubuntu/temp/libsourcey/src/symple/OPENSSL_INCLUDE_DIR    used as
 include directory in directory /home/ubuntu/temp/libsourcey/src/symple
 /home/ubuntu/temp/libsourcey/src/util/OPENSSL_INCLUDE_DIR    used as
 include directory in directory /home/ubuntu/temp/libsourcey/src/util
 /home/ubuntu/temp/libsourcey/src/webrtc/OPENSSL_INCLUDE_DIR    used as
 include directory in directory /home/ubuntu/temp/libsourcey/src/webrtc

我手动设置了OpenSSL包含目录路径,然后也遇到了相同的错误

-DOPENSSL_INCLUDE_DIR=/usr/include/openssl 

如何解决此错误?

1 个答案:

答案 0 :(得分:0)

您的CMakeLists.txt将OPENSSL定义为必需的外部库。但是找不到。

find_library(OPENSSL ...)

查看cmake寻找库的路径。

查看路径find_library在查找库。 为了简化操作,您可以打印出find_library使用的变量。

使用message(STATUS ${VARIABLE_NAME})

打印变量