这是我的cmakelists.txt:
project( WolframMachine )
cmake_minimum_required(VERSION 3.1)
set (CMAKE_CXX_STANDARD 11)
set(CMAKE_SUPPRESS_REGENERATION true)
include(ExternalProject)
set(Boost_INCLUDE_DIR "C:/boost_1_66_0")
set(Boost_LIBRARY_DIR "C:/boost_1_66_0/lib64-msvc-14.0")
SET("OpenCV_DIR" "C:/opencv-3.4.1/build")
SET(dlib_DIR "C:/dlib-19.13/") # <============ DLIB
find_package( OpenCV COMPONENTS core imgproc highgui aruco optflow plot REQUIRED )
find_package(dlib REQUIRED) # <============ DLIB
add_subdirectory(dlibtest)
跑步cmake-gui让我跟随:
手动设置dlib_DIR没有帮助。我该如何解决这个问题?
UPD :尝试了其他dlib_DIR值但没有成功:
SET(dlib_DIR "C:/dlib-19.13/build/dlib/CMakeFiles/Export/lib/cmake/dlib")
给出了同样的错误:
并设置
SET(dlib_DIR "C:/dlib-19.13/build/dlib/config")
给出了另一个毫无意义的错误:
答案 0 :(得分:1)
您可以在顶级CMakeLists.txt中尝试这些吗?
SET(dlib_ROOT "C:/dlib-19.13/")
或
SET(dlib_DIR "C:/dlib-19.13/" CACHE STRING "")
答案 1 :(得分:0)
看起来dlib并不是设计用find_package添加的。你要做的是将它添加为子目录:
add_subdirectory(C:/dlib-19.13 dlib_build)
并将结果库添加到二进制文件中:
target_link_libraries( ${CUR_PROJECT_NAME} ${OpenCV_LIBS} ${Boost_LIBRARIES} dlib::dlib)
# ---------------------------------------------------------------------------^^^^^^^^^^
答案 2 :(得分:0)
这是我遵循的步骤,
要安装dlib,请将链接更改为所需版本
wget http://dlib.net/files/dlib-19.6.tar.bz2
tar xvf dlib-19.6.tar.bz2
cd dlib-19.6/
mkdir build
cd build
cmake ..
cmake --build . --config Release
sudo make install
sudo ldconfig
在您的项目中,
find_package(dlib REQUIRED)
target_link_libraries(try_convex dlib::dlib)