0

Here is the cmake configuration that i am using

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 have been added as a git submodule under external/libwebsockets . I am getting the following error while building with above configuration

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

can someone please help me out with where i am going wrong and if i am writing the CMake configuration script correctly ?

georoot
  • 3,557
  • 1
  • 30
  • 59

1 Answers1

0

The following file cannot be found:

lws_config.h: No such file or directory compilation terminated.

When referenced from libwebsockets.h at line 43:

libwebsockets.h:43:24:

This is generated whilst compiling main.c:

In file included from /home/Project/server/src/main.c:2:0:

Do you know whether you have `lws_config.h" in your submodule tree?

snoopy
  • 328
  • 1
  • 12
  • there is no lws_config.h file . its actually lws_config.h.in and is generated by passing some cmake variables. the file is inside libwebsockets root folder – georoot Jun 14 '17 at 06:10
  • It seems that your `lws_config.h` file is not being generated then. Based on information you've currently given, I cannot help with that. – snoopy Jun 14 '17 at 06:13
  • @georoot I can help if you give more information, such as your submodule `CMakeLists.txt` file – snoopy Jun 14 '17 at 06:38