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

conan_check fails with "Invalid escape sequence" error when optional VERSION argument is supplied #246

Open
xmkg opened this issue Jun 3, 2020 · 1 comment

Comments

@xmkg
Copy link
Contributor

xmkg commented Jun 3, 2020

Following command fails with CMake version 3.16.3, Conan version 1.25.2.

conan_check(VERSION 1.25.0 REQUIRED)

The produced log output is as follows:

[cmake] -- Configuring incomplete, errors occurred!
[cmake] See also "/workspace/build/CMakeFiles/CMakeOutput.log".
[cmake] See also "/workspace/build/CMakeFiles/CMakeError.log".
[cmake] CMake Error at .hadouken/cmake/modules/helper/Conan.cmake:542 (string):
[cmake]   Syntax error in cmake code at
[cmake] 
[cmake]     /workspace/.hadouken/cmake/modules/helper/Conan.cmake:542
[cmake] 
[cmake]   when parsing string
[cmake] 
[cmake]     .*Conan version ([0-9]+\.[0-9]+\.[0-9]+)
[cmake] 
[cmake]   Invalid escape sequence \.
[cmake] Call Stack (most recent call first):
[cmake]   dependencies.cmake:14 (conan_check)
[cmake]   CMakeLists.txt:40 (include)

It is caused by unescaped backslash found in CONAN_VERSION if block.

 if(DEFINED CONAN_VERSION)
        string(REGEX MATCH ".*Conan version ([0-9]+\.[0-9]+\.[0-9]+)" FOO
            "${CONAN_VERSION_OUTPUT}")
        if(${CMAKE_MATCH_1} VERSION_LESS ${CONAN_VERSION})
            message(FATAL_ERROR "Conan outdated. Installed: ${CMAKE_MATCH_1}, \
                required: ${CONAN_VERSION}. Consider updating via 'pip \
                install conan==${CONAN_VERSION}'.")
        endif()
    endif()

I'll be issuing a pull request fixing this issue.

@czoido
Copy link
Contributor

czoido commented Jun 8, 2020

Hi @mustafakemalgilor,
Thanks a lot for reporting and the PR, we will add the fix for the next release.

@czoido czoido added this to the 0.16 milestone Jun 8, 2020
@czoido czoido removed this from the 0.16 milestone Jul 10, 2020
czoido added a commit that referenced this issue Jul 13, 2020
…ex_escape_issue

fixed conan_check VERSION cmake regex backslash escape issue, #246
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants