From d3524123a9c24610176f238002887e2034a61685 Mon Sep 17 00:00:00 2001 From: Sergey Ponomarev Date: Sat, 7 Sep 2024 10:23:31 +0300 Subject: cmake: enquote variable in string(REPLACE) macros If a var is empty then the cmake reports an error: string sub-command REPLACE requires at least four arguments --- protocols/Telegram/tdlib/td/CMake/AddCXXCompilerFlag.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'protocols') diff --git a/protocols/Telegram/tdlib/td/CMake/AddCXXCompilerFlag.cmake b/protocols/Telegram/tdlib/td/CMake/AddCXXCompilerFlag.cmake index 6fb615a1f7..2162dadb26 100644 --- a/protocols/Telegram/tdlib/td/CMake/AddCXXCompilerFlag.cmake +++ b/protocols/Telegram/tdlib/td/CMake/AddCXXCompilerFlag.cmake @@ -21,14 +21,14 @@ include(CheckCXXCompilerFlag) function(mangle_compiler_flag FLAG OUTPUT) string(TOUPPER "HAVE_CXX_FLAG_${FLAG}" SANITIZED_FLAG) - string(REPLACE "+" "X" SANITIZED_FLAG ${SANITIZED_FLAG}) + string(REPLACE "+" "X" SANITIZED_FLAG "${SANITIZED_FLAG}") string(REGEX REPLACE "[^A-Za-z_0-9]" "_" SANITIZED_FLAG ${SANITIZED_FLAG}) string(REGEX REPLACE "_+" "_" SANITIZED_FLAG ${SANITIZED_FLAG}) set(${OUTPUT} "${SANITIZED_FLAG}" PARENT_SCOPE) endfunction(mangle_compiler_flag) function(add_cxx_compiler_flag FLAG) - string(REPLACE "-Wno-" "-W" MAIN_FLAG ${FLAG}) + string(REPLACE "-Wno-" "-W" MAIN_FLAG "${FLAG}") mangle_compiler_flag("${MAIN_FLAG}" MANGLED_FLAG_NAME) if (DEFINED CMAKE_REQUIRED_FLAGS) set(OLD_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}") -- cgit v1.2.3