question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

flags.make:10: *** missing separator when adding library with add_subdirectory

See original GitHub issue

I 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:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
Pospelovecommented, May 25, 2019

I had the same problem. Thank you for saving my time.

0reactions
Superlokkuscommented, May 24, 2019

Truns out

execute_process(COMMAND node -p "require('node-addon-api').include"
        WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
        OUTPUT_VARIABLE NODE_ADDON_API_DIR 

because the output of node.js it contains a new line, expect a PR to correct your documentation

Read more comments on GitHub >

github_iconTop Results From Across the Web

Missing Separator error - Code
I get a missing separator error, when I change PRIVATE to PUBLIC specificator in target_include_directories statement. I have 3 shared libraries and I...
Read more >
Unix make file fails with cmakejs when adding a dependency
Using CMake 3.13 it fails to generate a Makefile because of errors in the install target syntax. Once this is fixed it works...
Read more >
cmake-variables - man pages section 7
This the full path to the build directory that is currently being pro- cessed by cmake. Each directory added by add_subdirectory() will cre- ......
Read more >
cmake - Cross-Platform Makefile Generator.
Adds flags to the compiler command line for sources in the current directory and below. This command can be used to add any...
Read more >
cmake(1) - Linux man page
Process the given cmake file as a script written in the CMake language. No configure or generate step is performed and the cache...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found