mirror of
https://gitee.com/openharmony/third_party_benchmark
synced 2024-11-23 07:20:12 +00:00
Fixed the CMake add_cxx_compiler_flag function
This commit is contained in:
parent
0fd0be9789
commit
9593e64076
@ -25,13 +25,12 @@ function(add_cxx_compiler_flag FLAG)
|
||||
string(TOLOWER ${VARIANT} VARIANT)
|
||||
set(VARIANT " ${VARIANT}")
|
||||
endif()
|
||||
message("-- Check compiler${VARIANT} flag ${FLAG}")
|
||||
string(TOUPPER ${FLAG} SANITIZED_FLAG)
|
||||
string(REGEX REPLACE "[^A-Za-z_0-9]" "_" ${SANITIZED_FLAG} SANITIZED_FLAG)
|
||||
string(TOUPPER "HAVE_${FLAG}" SANITIZED_FLAG)
|
||||
string(REGEX REPLACE "[^A-Za-z_0-9]" "_" SANITIZED_FLAG ${SANITIZED_FLAG})
|
||||
string(REGEX REPLACE "_+" "_" SANITIZED_FLAG ${SANITIZED_FLAG})
|
||||
check_cxx_compiler_flag(${FLAG} ${SANITIZED_FLAG})
|
||||
if(${SANITIZED_FLAG})
|
||||
message("-- Check compiler${VARIANT} flag ${FLAG} -- works")
|
||||
string(REGEX REPLACE "[^A-Za-z_0-9]" "_" "${VARIANT}" VARIANT)
|
||||
string(REGEX REPLACE "[^A-Za-z_0-9]" "_" VARIANT "${VARIANT}")
|
||||
string(TOUPPER "${VARIANT}" VARIANT)
|
||||
set(CMAKE_CXX_FLAGS${VARIANT} "${CMAKE_CXX_FLAGS}${VARIANT} ${FLAG}" PARENT_SCOPE)
|
||||
endif()
|
||||
|
@ -4,19 +4,18 @@
|
||||
# and adds the corresponding `HAVE_[FILENAME]` flag to the CMake
|
||||
# environment
|
||||
#
|
||||
# add_cxx_compiler_FLAG(<FLAG> [<VARIANT>])
|
||||
# cxx_feature_check(<FLAG> [<VARIANT>])
|
||||
#
|
||||
# - Example
|
||||
#
|
||||
# include(AddCXXCompilerFlag)
|
||||
# add_cxx_compiler_FLAG(-Wall)
|
||||
# add_cxx_compiler_FLAG(-no-strict-aliasing RELEASE)
|
||||
# include(CXXFeatureCheck)
|
||||
# cxx_feature_check(STD_REGEX)
|
||||
# Requires CMake 2.6+
|
||||
|
||||
if(__cxx_feature_check_FLAG)
|
||||
if(__cxx_feature_check)
|
||||
return()
|
||||
endif()
|
||||
set(__cxx_feature_check_FLAG INCLUDED)
|
||||
set(__cxx_feature_check INCLUDED)
|
||||
|
||||
function(cxx_feature_check FILE)
|
||||
string(TOLOWER ${FILE} FILE)
|
||||
|
Loading…
Reference in New Issue
Block a user