File: RewriteLineMarkers.cmake

package info (click to toggle)
lib2geom 1.4-5
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 6,124 kB
  • sloc: cpp: 64,251; python: 2,889; ansic: 1,963; makefile: 37
file content (13 lines) | stat: -rw-r--r-- 399 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
# Apply a regex to the input file SOURCE, and write the result to TARGET.
#
# The regex searches for lines that look like
#
#     #line <number> "path"
#
# and replaces them with absolute paths
#
#     #line <number> "SOURCE_DIR/path"

file(READ "${SOURCE}" TEXT)
string(REGEX REPLACE "#line ([0-9]*) \"([^\"]*)\"" "#line \\1 \"${SOURCE_DIR}/\\2\"" TEXT "${TEXT}")
file(WRITE "${TARGET}" "${TEXT}")