这是我正在使用的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已添加为external/libwebsockets
下的git子模块。使用上面的配置
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
配置脚本?
答案 0 :(得分:0)
找不到以下文件:
lws_config.h:没有这样的文件或目录 编译终止。
从第43行的libwebsockets.h
引用时:
libwebsockets.h:43:24:
这是在编译main.c
:
/home/Project/server/src/main.c:2:0中包含的文件:
你知道你是否有'lws_config.h"在您的子模块树中?