mirror of
https://github.com/eclipse/upm.git
synced 2025-06-10 07:10:22 +03:00
cmake: Added return/clear variable to function
Made sure output_variable gets cleared for case where target compiler is not supported. Signed-off-by: Noel Eck <noel.eck@intel.com>
This commit is contained in:
parent
e21e05a039
commit
585f2eb331
@ -30,10 +30,13 @@ set (CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_
|
|||||||
# The result of output_variable is set to the sanitized flag name if supported
|
# The result of output_variable is set to the sanitized flag name if supported
|
||||||
# or cleared if the flag is not supported.
|
# or cleared if the flag is not supported.
|
||||||
function (compiler_flag_supported compiler output_variable flag)
|
function (compiler_flag_supported compiler output_variable flag)
|
||||||
# Currently only C and CXX compile flags
|
# Currently only C and CXX compile flags, clear and return if not supported
|
||||||
if (NOT ${compiler} MATCHES "C|CXX")
|
if (NOT ${compiler} MATCHES "C|CXX")
|
||||||
message (WARNING "Unknown compiler: ${compiler}")
|
message (WARNING "Unknown compiler: ${compiler}")
|
||||||
else ()
|
set ("${output_variable}" "" PARENT_SCOPE)
|
||||||
|
return ()
|
||||||
|
endif (NOT ${compiler} MATCHES "C|CXX")
|
||||||
|
|
||||||
string (REPLACE "-" "_" SANITIZED_FLAG_NAME "${flag}")
|
string (REPLACE "-" "_" SANITIZED_FLAG_NAME "${flag}")
|
||||||
string (REPLACE "/" "_" SANITIZED_FLAG_NAME "${SANITIZED_FLAG_NAME}")
|
string (REPLACE "/" "_" SANITIZED_FLAG_NAME "${SANITIZED_FLAG_NAME}")
|
||||||
string (REPLACE "=" "_" SANITIZED_FLAG_NAME "${SANITIZED_FLAG_NAME}")
|
string (REPLACE "=" "_" SANITIZED_FLAG_NAME "${SANITIZED_FLAG_NAME}")
|
||||||
@ -59,7 +62,6 @@ function (compiler_flag_supported compiler output_variable flag)
|
|||||||
else ()
|
else ()
|
||||||
set ("${output_variable}" "" PARENT_SCOPE)
|
set ("${output_variable}" "" PARENT_SCOPE)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
|
||||||
endfunction ()
|
endfunction ()
|
||||||
|
|
||||||
include (CheckCCompilerFlag)
|
include (CheckCCompilerFlag)
|
||||||
@ -85,8 +87,6 @@ function (upm_add_compile_flags compiler)
|
|||||||
set (CMAKE_${compiler}_FLAGS ${_TMP_COMPILER_FLAGS} PARENT_SCOPE)
|
set (CMAKE_${compiler}_FLAGS ${_TMP_COMPILER_FLAGS} PARENT_SCOPE)
|
||||||
endfunction ()
|
endfunction ()
|
||||||
|
|
||||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
|
||||||
|
|
||||||
# Compiler flags common to both C and CXX
|
# Compiler flags common to both C and CXX
|
||||||
set (C_CXX_WARNING_FLAGS -Wall)
|
set (C_CXX_WARNING_FLAGS -Wall)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user