File: PlmCheckString.cmake

package info (click to toggle)
plastimatch 1.10.0%2Bdfsg.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 48,324 kB
  • sloc: cpp: 126,131; sh: 5,845; ansic: 2,867; lisp: 907; makefile: 63; pascal: 62; cs: 19; fortran: 15
file content (23 lines) | stat: -rwxr-xr-x 774 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
## This script finds a regex in a file and compares the first match 
##   with an input string

message (STATUS "INFILE is ${INFILE}")
message (STATUS "REGEX is ${REGEX}")
message (STATUS "MATCH_STRING is ${MATCH_STRING}")

file (STRINGS ${INFILE} test_output REGEX "${REGEX}")
message (STATUS "PARSED VALUE=|${test_output}|")

string (REGEX MATCH "${REGEX}" test_output ${test_output})
set (test_output ${CMAKE_MATCH_1})
message (STATUS "PARSED_VALUE=|${test_output}|")

string (LENGTH "${test_output}" match_length)
message (STATUS "LENGTH=${match_length}")
message (STATUS "|${test_output}|${MATCH_STRING}|")
if ("${match_length}" GREATER 0
    AND "${test_output}" STREQUAL "${MATCH_STRING}")
  message("Not an error")
else ()
  message (SEND_ERROR "An error")
endif ()