0
下面是我使用無法使用CMake編譯libwebsockets?
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子模塊的cmake的配置。我收到以下錯誤,而以上配置構建
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文件。其實際上是lws_config.h.in,並通過傳遞一些cmake變量來生成。該文件位於libwebsockets根文件夾內 – georoot
看來您的'lws_config.h'文件沒有被生成。根據你現在提供的信息,我無法幫助你。 – snoopy
@georoot如果您提供更多信息,例如您的子模塊'CMakeLists.txt'文件,我可以提供幫助 – snoopy