Bug 377573

Summary: cmake script regex problem
Product: [Frameworks and Libraries] frameworks-kdoctools Reporter: Robert Riemann <robert>
Component: generalAssignee: Documentation Editorial Team <kde-doc-english>
Status: RESOLVED FIXED    
Severity: minor CC: kdelibs-bugs, luigi.toscano, nalvarez
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Robert Riemann 2017-03-13 18:50:59 UTC
I downloaded the sources today from github/KDE/kile and got this problem when running cmake:

-- Found msgfmt: /usr/bin/msgfmt
-- Not building translations
RegularExpression::compile(): Nested *?+.
RegularExpression::compile(): Error in compile.
CMake Error at /usr/lib64/cmake/KF5DocTools/KF5DocToolsMacros.cmake:94 (string):
  string sub-command REGEX, mode REPLACE failed to compile regex
  "^/home/rriemann/Documents/Development/C++/kile/build/?".
Call Stack (most recent call first):
  /usr/lib64/cmake/KF5DocTools/KF5DocToolsMacros.cmake:155 (_kdoctools_create_target_name)
  doc/CMakeLists.txt:3 (kdoctools_create_handbook)


Apparently, my building path that contains "++" is not supported. I moved the repo out of the folder "C++" and it seems to work.
Comment 1 Luigi Toscano 2017-09-02 22:13:38 UTC
Uhm, this was introduced here to remove a piece of the path:
https://commits.kde.org/kdoctools/a624463c621c72c6f410d1c691914e3778db6af0

Nicolas, do you have a quick idea on how to fix this so that + is not considered as special character - maybe a non-regexp replacement is enough?
Comment 2 Nicolás Alvarez 2017-09-02 22:55:46 UTC
Git commit 68b787bd79120bb7229380165f8f94a64614ae4b by Nicolás Alvarez.
Committed on 02/09/2017 at 22:55.
Pushed by nalvarez into branch 'master'.

CMake: Fix target name shortening when build dir has special characters

The DocTools CMake macros generate a target name based on the path of the
file to generate. Since the target name was too long sometimes, especially
on Windows (which has path length limits), in a624463c62 I added a regex
replacement to strip the build directory from the path before transforming
it to a target name.

However, this was causing an error if the build directory had any regex
special characters, such as '+'.

I'm now using file(RELATIVE_PATH) instead of a regular expression to strip
off the build dir root, which should be more reliable and work for any
characters.

M  +1    -1    KF5DocToolsMacros.cmake

https://commits.kde.org/kdoctools/68b787bd79120bb7229380165f8f94a64614ae4b