FreeRDP/cmake/CFlagsToVar.cmake
akallabeth a27d9508e2
[cmake] unify CFLAGS to string
* move to common CMake function
* escape CFLAGS
2024-10-25 11:40:43 +02:00

12 lines
369 B
CMake

function(CFlagsToVar NAME)
set(C_FLAGS ${CMAKE_C_FLAGS})
if (CMAKE_BUILD_TYPE)
string(TOUPPER "${CMAKE_BUILD_TYPE}" CAPS_BUILD_TYPE)
string(APPEND C_FLAGS " ${CMAKE_C_FLAGS_${CAPS_BUILD_TYPE}}")
endif()
string(REPLACE "\$" "\\\$" C_FLAGS "${C_FLAGS}")
string(REPLACE "\"" "\\\"" C_FLAGS "${C_FLAGS}")
set(${NAME} ${C_FLAGS} PARENT_SCOPE)
endfunction()