[CMake] cmake gives poor warning on missing double-quote?

Jakub Zakrzewski jzakrzewski at e2e.ch
Tue Sep 2 03:29:20 EDT 2014


Hi,

I don't think there's anything that can be done about it. CMake supports multi-line strings, what means that the parser cannot detect missing quote right away. In theory on such error the parser can be made to go back to opening quote and analyze the string to give a suggestion, but this is complicated. Just take a look:

set(MY_VAR "value)
set(ANOTHER "other")

For a human it's clear that, unless someone intentionally obfuscates the code, there's a double quote missing. But the parser sees it like this:

set(MY_VAR "value)\nset(ANOTHER "other")

Because string would not be analyzed:

set(MY_VAR "whatever"other")

And this corresponds directly to the error message: there's no space after what appears to be a closing quote.


--
Gruesse,
Jakub



-----Original Message-----
From: CMake [mailto:cmake-bounces at cmake.org] On Behalf Of Dan Kegel
Sent: Montag, 1. September 2014 22:22
To: cmake
Subject: [CMake] cmake gives poor warning on missing double-quote?

If you leave off a doublequote somewhere, you will get confusing messages like

"CMake Warning (dev) in CMakeLists.txt:
  Syntax Warning in cmake code at

    /home/joe/foo/CMakeLists.txt:66:79

  Argument not separated from preceding token by whitespace.
This warning is for project developers.  Use -Wno-dev to suppress it."

on every following line that uses a double quote.  Seems like this situation could be improved.

(Checked with both 2.8.11 and 3.0.1.)
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake


More information about the CMake mailing list