Closed ptheywood closed 1 year ago
https://gitlab.kitware.com/cmake/cmake/-/issues/18580#note_483128
Recommendation from CMake's Brad
string(REGEX REPLACE "([][+.*()^])" "\\\\\\1" regex "${string}")
Robert@DCS034201 MINGW64 ~/fgpu2/fgpu++2/cmake (cmake_escape_regex)
$ grep -r "REGEX" .
./common.cmake: list(FILTER T_SRC INCLUDE REGEX "^${CURRENT_SOURCE_DIR_ESCAPE}/src")
./common.cmake: list(FILTER T_SRC INCLUDE REGEX ".*\.(h|hpp|cuh)$")
./common.cmake: list(FILTER T_SRC INCLUDE REGEX "^${CURRENT_SOURCE_DIR_ESCAPE}/src")
./common.cmake: list(FILTER T_SRC EXCLUDE REGEX ".*\.(h|hpp|cuh)$")
./common.cmake: list(FILTER T_SRC EXCLUDE REGEX "^${CURRENT_SOURCE_DIR_ESCAPE}/src")
./common.cmake: list(FILTER T_SRC INCLUDE REGEX ".*\.(h|hpp|cuh)$")
./common.cmake: list(FILTER T_SRC EXCLUDE REGEX "^${CURRENT_SOURCE_DIR_ESCAPE}/src")
./common.cmake: list(FILTER T_SRC EXCLUDE REGEX ".*\.(h|hpp|cuh|rc)$")
./cpplint.cmake: list(FILTER SRC EXCLUDE REGEX "^${FLAMEGPU_ROOT_ESCAPE}/externals/.*")
./cpplint.cmake: list(FILTER SRC EXCLUDE REGEX "${EXCLUDE_FILTER}")
./cpplint.cmake: list(FILTER SRC INCLUDE REGEX ".*\\.(h\\+\\+|hxx|cuh|cu|c|c\\+\\+|cxx|cc|hpp|h|cpp|hh)$")
./CUDAArchitectures.cmake: string(REGEX MATCHALL "'(sm|compute)_[0-9]+'" SUPPORTED_CUDA_ARCHITECTURES_NVCC "${NVCC_HELP_STR}" )
./CUDAArchitectures.cmake: string(REGEX REPLACE "'(sm|compute)_([0-9]+)'" "\\2" SUPPORTED_CUDA_ARCHITECTURES_NVCC "${SUPPORTED_CUDA_ARCHITECTURES_NVCC}" )
./CUDAArchitectures.cmake: string(REGEX MATCHALL "'(sm|compute)_[0-9]+'" SUPPORTED_CUDA_ARCHITECTURES_NVCC "${NVCC_HELP_STR}" )
./CUDAArchitectures.cmake: string(REGEX REPLACE "'(sm|compute)_([0-9]+)'" "\\2" SUPPORTED_CUDA_ARCHITECTURES_NVCC "${SUPPORTED_CUDA_ARCHITECTURES_NVCC}" )
./EscapeRegex.cmake: string(REGEX REPLACE "([][+.*()^])" "\\\\\\1" OUT_STRING "${IN_STRING}")
./modules/FindJitify.cmake: string(REGEX MATCH "Jitify ([0-9]+\.[0-9]+(\.[0-9]+)?)" Jitify_VERSION_DEFINE ${Jitify_header_text})
./modules/FindNVTX.cmake: string(REGEX MATCH "define NVTX_VERSION ([0-9]+)" NVTX_VERSION_DEFINE ${nvtx_header_text})
./modules/FindNVTX.cmake: string(REGEX MATCH "define NVTX_VERSION ([0-9]+)" NVTX_VERSION_DEFINE ${nvtx_header_text})
./version.cmake:string(REGEX MATCH "\\#define FLAMEGPU_VERSION ([0-9]+)([0-9][0-9][0-9])([0-9][0-9][0-9])" _ ${VERSION_FILE_STR})
./version.cmake:string(REGEX MATCH "static constexpr char VERSION_PRERELEASE\\[\\] = \"([a-zA-Z0-9\.]+)\"" _ ${VERSION_FILE_STR})
./version.cmake:# string(REGEX MATCH "static constexpr char VERSION_PRERELEASE\[\] = \"([a-zA-Z0-9\.]+)\";" _ ${VERSION_FILE_STR})
All cases of REGEX
found within CMake dir, only first 5 are user dependent (unless we expect our version strings to contain special chars).
When cpplint is found and enabled, configuring cmake within a directory containing
++
character in the path results in a regular expression compilation failure at:https://github.com/FLAMEGPU/FLAMEGPU2/blob/86197b63efddfa561afd184785a1cc127dd6fb4d/cmake/cpplint.cmake#L52
We will need to somehow escape the offending
++
(and other patterns that woudl need escaping" from${FLAMEGPU_ROOT}
.This would also need applying tyo any other CMake Regex use, which uses a path as the filter, or a user-supplied filter (if any)