Fix generating draco project files from a directory containing special characters#1140
Open
whiteh0le wants to merge 1 commit intogoogle:mainfrom
Open
Fix generating draco project files from a directory containing special characters#1140whiteh0le wants to merge 1 commit intogoogle:mainfrom
whiteh0le wants to merge 1 commit intogoogle:mainfrom
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
If you try to generate draco project files from a directory containing any regex special characters cmake will fail.
In my case, draco is inside a directory called "c++" and, because "+" is a regex special character, cmake fails to generate the project files with the following error:
As you can see, the error occurs at line 42 of cmake/draco_install.cmake:
draco/cmake/draco_install.cmake
Line 42 in 931498a
As per the cmake documentation, the REPLACE action of the TRANSFORM subcommand expects a regular expression as its first argument, in our case, this is the
${draco_src_root}variable containing the project's path.The problem is that the code assumes that the directory path is a regex therefore it must not contain any special characters.
The solution is simple, replace the faulty list transform command by a directory-aware alternative. I choose the file RELATIVE_PATH command:
draco/cmake/draco_install.cmake
Lines 36 to 37 in 7577ec0
This command will compute the relative path to the files correctly, even if the directory contains special characters.
With these changes cmake will now correctly generate the project files: