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 error relating to REGEX and CORRADE_CXX_FLAGS #457
Comments
Hi! I looked into In any case, I think the following patch should make it work without an additional check -- can you confirm? diff --git a/modules/UseCorrade.cmake b/modules/UseCorrade.cmake
index 8276c71a..34188016 100644
--- a/modules/UseCorrade.cmake
+++ b/modules/UseCorrade.cmake
@@ -299,7 +299,7 @@ if(CORRADE_BUILD_DEPRECATED)
string(REPLACE ";" " " CORRADE_CXX_FLAGS "${CORRADE_CXX_FLAGS}${CORRADE_PEDANTIC_COMPILER_OPTIONS}")
# Remove generator expressions that distinct between C and C++
- string(REGEX REPLACE "\\$<\\$<STREQUAL:\\$<TARGET_PROPERTY:LINKER_LANGUAGE>,CXX>:([^>]+)>" "\\1" CORRADE_CXX_FLAGS ${CORRADE_CXX_FLAGS})
+ string(REGEX REPLACE "\\$<\\$<STREQUAL:\\$<TARGET_PROPERTY:LINKER_LANGUAGE>,CXX>:([^>]+)>" "\\1" CORRADE_CXX_FLAGS "${CORRADE_CXX_FLAGS}")
endif()
# Provide a way to distinguish between debug and release builds via |
Hi Mosra. I can confirm your patch works fine. As for why
|
Oh, the cmake_minimum_required(VERSION 3.4) # minimum required by Magnum
# no cmake_policy(SET CMP0054 OLD) instead? That way it should work even without the above patch. |
Okay. First I tried the configure step without setting the CMP0054 policy but that made no difference except for also producing a lot of CMP0054-related warnings. Sorry for the false alarm and thanks for your help. |
The problem was caused by calling |
No problem -- I think this error could still happen with unrecognized compilers (such as ICC), so I commited the patch as mosra/corrade@5aa75d4. Thanks for testing it! |
After installing Magnum using vcpkg (x64-windows), I got this error when trying to configure my cmake project:
CMake Error at C:/Users/timyo/dev/libs/vcpkg/installed/x64-windows/share/cmake/Corrade/UseCorrade.cmake:302 (string): string sub-command REGEX, mode REPLACE needs at least 6 arguments total to command. Call Stack (most recent call first): C:/Users/timyo/dev/libs/vcpkg/installed/x64-windows/share/cmake/Corrade/FindCorrade.cmake:592 (include) C:/Users/timyo/dev/libs/vcpkg/installed/x64-windows/share/cmake/Corrade/CorradeConfig.cmake:26 (include) C:/Users/timyo/dev/libs/vcpkg/scripts/buildsystems/vcpkg.cmake:439 (_find_package) C:/Users/timyo/dev/libs/vcpkg/installed/x64-windows/share/cmake/Magnum/FindMagnum.cmake:233 (find_package) C:/Users/timyo/dev/libs/vcpkg/installed/x64-windows/share/cmake/Magnum/MagnumConfig.cmake:26 (include) C:/Users/timyo/dev/libs/vcpkg/scripts/buildsystems/vcpkg.cmake:439 (_find_package) CMakeLists.txt:6 (find_package)
I guessed that it was because
CORRADE_CXX_FLAGS
wasn't set, and worked around it by adding a check for this before the REGEX command.The text was updated successfully, but these errors were encountered: