CMake custom command issue
I was having an issue with namespaces and compiling a Lex-generated lexer, so I though that the simplest solution would simply be to wrap namespace constructs around Lex's output before compiling (I know, it's not really an elegant solution, but I couldn't think of anything much better).
Here is a snippet from my CMakeLists.txt: Code:
find_program (LEX_TOOL NAMES lex flex) Code:
-- Configuring done |
Without having analyzed the Makefile in-depth, it looks like there are unbalanced quotes in the line
Code:
COMMAND ${SED_TOOL} -e "1 s@.*@#include \"config.hpp\"\\nnamespace LANG_NAMESPACE {\\nnamespace lexyacc {\\n\\n&@" -e "$ s@.*@&\\n}}\\n@" ${CMAKE_CURRENT_BINARY_DIR}/lex_lexer.cpp.temp > ${CMAKE_CURRENT_BINARY_DIR}/lex_lexer.cpp |
Quote:
|
Oops, my bad. I guess I miscounted them when I first looked.
Does your sed command work as specified, but independently of make? Does the input file exist? Non-empty? Where its supposed to be when make runs? --- rod. |
Quote:
I think that the biggest problem is that I don't understand how the command is executed by CMake. Is it passed unmodified to bash? Does CMake interpret certain quotes and escape characters? I thought that CMake interprets them becasue Kate doesn't highlight single quotes, and even if I do try them, CMake interprets the '#' characters as the start of a comment. And then bash says that there's an unmatched single quote. |
I found that CMake inserts a backslash before every space in the Makefile. Why is that, and how to fix it?
CMakeLists.txt: Code:
${SED_TOOL} -e "'1 s@.*@\#include \"config.hpp\"\\nnamespace LANG_NAMESPACE {\\nnamespace lexyacc {\\n\\n&@'" -e "'\$ s@.*@&\\n}}\\n@'" Code:
/bin/sed -e '1\ s@.*@#include\ "config.hpp"\nnamespace\ LANG_NAMESPACE\ {\nnamespace\ lexyacc\ {\n\n&@' -e '$\ s@.*@&\n}}\n@' |
All times are GMT -5. The time now is 05:27 AM. |