Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake: Configuration failure with ++ in abs path #1071

Closed
ptheywood opened this issue Jun 23, 2023 · 2 comments · Fixed by #1085
Closed

CMake: Configuration failure with ++ in abs path #1071

ptheywood opened this issue Jun 23, 2023 · 2 comments · Fixed by #1085
Labels

Comments

@ptheywood
Copy link
Member

When cpplint is found and enabled, configuring cmake within a directory containing ++ character in the path results in a regular expression compilation failure at:

list(FILTER SRC EXCLUDE REGEX "^${FLAMEGPU_ROOT}/externals/.*")

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)

@Robadob Robadob added the bug label Jul 3, 2023
@Robadob
Copy link
Member

Robadob commented Jul 7, 2023

https://gitlab.kitware.com/cmake/cmake/-/issues/18580#note_483128

Recommendation from CMake's Brad

string(REGEX REPLACE "([][+.*()^])" "\\\\\\1" regex "${string}")

@Robadob
Copy link
Member

Robadob commented Jul 7, 2023

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).

Robadob added a commit that referenced this issue Jul 7, 2023
@ptheywood ptheywood changed the title CMake: Configuration failure with + in abs path CMake: Configuration failure with ++ in abs path Jul 10, 2023
ptheywood pushed a commit that referenced this issue Jul 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants