这是我正在使用的cmake配置
cmake_minimum_required (VERSION 3.0)
project (Project)
set (CMAKE_CXX_FLAGS_DEBUG "-std=c++11 -O0 -DDEBUG -g")
set (CMAKE_C_FLAGS_DEBUG "-std=c++11 -O0 -DDEBUG -g")
set (CMAKE_CXX_FLAGS_RELEASE "-std=c++11 -O3")
set (CMAKE_C_FLAGS_RELEASE "-std=c++11 -O3")
add_subdirectory (external/libwebsockets)
include_directories (external/libwebsockets/lib)
include_directories (src/globals)
add_library (libwebsockets SHARED IMPORTED)
add_executable (Project src/main.c)
target_link_libraries (Project libwebsockets)
Libwebsockets 已作为 git 子模块添加到 external/libwebsockets
下。使用上述配置构建时出现以下错误
In file included from /home/Project/server/src/main.c:2:0:
/home/Project/server/external/libwebsockets/lib/libwebsockets.h:43:24: fatal error: lws_config.h: No such file or directory
compilation terminated.
CMakeFiles/Project.dir/build.make:62: recipe for target 'CMakeFiles/Project.dir/src/main.c.o' failed
make[2]: *** [CMakeFiles/Project.dir/src/main.c.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/Project.dir/all' failed
make[1]: *** [CMakeFiles/Project.dir/all] Error 2
Makefile:149: recipe for target 'all' failed
make: *** [all] Error 2
有人可以帮助我解决我出错的地方以及我是否正确编写了CMake
配置脚本吗?
找不到以下文件:
lws_config.h:没有这样的文件或目录 编译终止。
当从第 43 行的 libwebsockets.h
引用时:
libwebsockets.h:43:24:
这是在编译main.c
时生成的:
在/home/Project/server/src/main.c:2:0 包含的文件中:
你知道你的子模块树中是否有'lws_config.h'吗?