flags.make:10: *** missing separator when adding library with add_subdirectory
See original GitHub issueI successfully created a native node addon with napi and cmakejs. But when adding a simple library the unix make file, generated by cmake-js explodes with
[ 50%] Linking CXX static library liblib_name.a [ 50%] Built target lib_name CMakeFiles/spielwiese.dir/flags.make:10: *** missing separator. Stop. make[1]: *** [CMakeFiles/Makefile2:72: CMakeFiles/spielwiese.dir/all] Error 2 make: *** [Makefile:130: all] Error 2 ERR! OMG Process terminated: 2
Minimized example project: https://github.com/Superlokkus/spielwiese/tree/napi
The root CMakeLists should be close or intented to be close to cmakejs example boilerplate version, just with an additional function PARSE_CMAKEJS_PROPERTIES
to also build it via a cmake CLI command, for nice developing with IDEs like CLion. However the problem persisits when removing the PARSE_CMAKEJS_PROPERTIES
function.
I added the library with a add_subdirectory
, if you remove https://github.com/Superlokkus/spielwiese/blob/napi/CMakeLists.txt#L47 aka add_subdirectory(src/lib_name)
and change https://github.com/Superlokkus/spielwiese/blob/napi/CMakeLists.txt#L63 aka target_link_libraries(${PROJECT_NAME} PUBLIC ${CMAKE_JS_LIB} lib_name)
to target_link_libraries(${PROJECT_NAME} PUBLIC ${CMAKE_JS_LIB})
and also remove
https://github.com/Superlokkus/spielwiese/blob/napi/src/spielwiese.cpp#L3 aka #include <lib_name/lib_name.hpp>
,
the project builds again incl. the mocha test. However add the example library and you get the error again.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:5 (4 by maintainers)
Top GitHub Comments
I had the same problem. Thank you for saving my time.
Truns out
because the output of node.js it contains a new line, expect a PR to correct your documentation