Sublime Forum

'file_regex' for CMake build system

#1

I’ve made a build system for using CMake (with Clang) by copying across the one for Makefiles, but the ‘file_regex’ is tripping up sometimes with what appear to be multi-line matches.

For example, with the following build output:

 16%] Building CXX object CMakeFiles/ray.dir/src/main.cpp.o
/home/rezzie/ray/src/main.cpp:27:4: error: use of undeclared identifier 'Camera'
   Camera cam;
   ^
/home/rezzie/ray/src/main.cpp:105:4: error: expected unqualified-id
   return EXIT_SUCCESS;

The first error doesn’t work, as the regex highlights the " 16%] Building …" line and then the file path, up to the ‘27:4’. The second error is picked up correctly; I’m guessing because it’s not preceded by a “Building” line.

Can someone help me modify the regex so it’ll work with Clang/CMake output? It’s currently:

^(..^:]*):([0-9]+):?([0-9]+)?:? (.*)$

Thanks!

0 Likes

#2

Does changing the ^:] to ^:\n] help? (i.e., changing from matching any character but ‘:’ to any character but ‘:’ and ‘\n’)

0 Likes

#3

That works perfectly. Thank you :smile:

0 Likes