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 fails when CMAKE_BINARY_DIR contains '+'. #1590

Closed
ibbles opened this issue Jun 8, 2015 · 7 comments · Fixed by #1769
Closed

CMake fails when CMAKE_BINARY_DIR contains '+'. #1590

ibbles opened this issue Jun 8, 2015 · 7 comments · Fixed by #1769

Comments

@ibbles
Copy link

ibbles commented Jun 8, 2015

Getting the following error message:

RegularExpression::compile(): Nested *?+.
RegularExpression::compile(): Error in compile.
RegularExpression::compile(): Nested *?+.
RegularExpression::compile(): Error in compile.
CMake Error at cmake/HPX_GeneratePackage.cmake:56 (if):
  if given arguments:

    "(" "NOT" "dir" "MATCHES" "^/home/ibbles/mirrored/programmering/others/c++/hpx/hpx_0.9.10_build.*" ")" "AND" "(" "NOT" "dir" "MATCHES" "^/home/ibbles/mirrored/programmering/others/c++/hpx/hpx_0.9.10_repo.*" ")"

  Regular expression
  "^/home/ibbles/mirrored/programmering/others/c++/hpx/hpx_0.9.10_repo.*"
  cannot compile
Call Stack (most recent call first):
  CMakeLists.txt:1350 (include)


-- Configuring incomplete, errors occurred!

Renaming the folder 'c++' to 'cpp' will let CMake run successfully.

@hkaiser
Copy link
Member

hkaiser commented Jun 8, 2015

That's a bummer. I wouldn't even know how to fix this at this point. But I'm no cmake guru to begin with...

@sithhell
Copy link
Member

sithhell commented Jun 8, 2015 via email

@biddisco
Copy link
Contributor

biddisco commented Jun 9, 2015

The problem is that the CMAKE_BINARY_DIR is used as the match in a regex and as it contains a "++" cmake (correctly) thinks that this is part of the regex control sequence. Applying a string replace of "++" with "\\+\\+" before the regex test fixes it. I am applying a patch direct to the master branch as the fix is small addition to the cmake script.
If the develpoer is working on the 0.9.10 branch (as his/her path indicates), then the commit 4b4a1e2 can be cherry picked to solve the immediate problem

@hkaiser
Copy link
Member

hkaiser commented Jun 9, 2015

The problem is that the CMAKE_BINARY_DIR is used as the match in a regex and as it contains a "++" cmake (correctly) thinks that this is part of the regex control sequence. Applying a string replace of "++" with "\+\+" before the regex test fixes it. I am applying a patch direct to the master branch as the fix is small addition to the cmake script.

Wouldn't other special regex characters cause the same issues?

@biddisco
Copy link
Contributor

biddisco commented Jun 9, 2015

Wouldn't other special regex characters cause the same issues?

Yes, the '.' and '$' are most likely to be encountered in path names. The '.' will match itself and if a problem is reported with another char, we can look again at a more general fix.

excerpt from cmake docs
^ Matches at beginning of input
$ Matches at end of input
. Matches any single character
[ ] Matches any character(s) inside the brackets
[^ ] Matches any character(s) not inside the brackets
- Inside brackets, specifies an inclusive range ...
* Matches preceding pattern zero or more times
+ Matches preceding pattern one or more times
? Matches preceding pattern zero or once only
| Matches a pattern on either side of the |
() Saves a matched subexpression ...

@hkaiser
Copy link
Member

hkaiser commented Jun 9, 2015

We should probably create a ticket for this. While you nicely 'unbroke' the user's code, your patch has not really 'fixed' the issue.

@biddisco biddisco reopened this Jun 9, 2015
@biddisco
Copy link
Contributor

biddisco commented Jun 9, 2015

I'll fix it properly when I have a spare moment.

hkaiser added a commit that referenced this issue Sep 27, 2015
- This fixes #1590: CMake fails when CMAKE_BINARY_DIR contains '+'
@hkaiser hkaiser added this to the 0.9.11 milestone Sep 27, 2015
hkaiser added a commit that referenced this issue Sep 28, 2015
- This fixes #1590: CMake fails when CMAKE_BINARY_DIR contains '+'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants