Commit e4b88235 authored by Sergei Golubchik's avatar Sergei Golubchik

cmake: rename symbols used internally by check_compiler_flag.cmake

(that is MY_CHECK_C_COMPILER_FLAG, MY_CHECK_CXX_COMPILER_FLAG,
MY_CHECK_AND_SET_COMPILER_FLAG)

This is to have a clear "internal" name prefix and to avoid
mixing them with hand-named symbols
parent 679aa122
...@@ -15,7 +15,7 @@ SET(fail_patterns ...@@ -15,7 +15,7 @@ SET(fail_patterns
) )
MACRO (MY_CHECK_C_COMPILER_FLAG flag) MACRO (MY_CHECK_C_COMPILER_FLAG flag)
STRING(REGEX REPLACE "[-,= ]" "_" result "HAVE_C_${flag}") STRING(REGEX REPLACE "[-,= ]" "_" result "have_C_${flag}")
SET(SAVE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}") SET(SAVE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${flag}") SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${flag}")
CHECK_C_SOURCE_COMPILES("int main(void) { return 0; }" ${result} CHECK_C_SOURCE_COMPILES("int main(void) { return 0; }" ${result}
...@@ -24,7 +24,7 @@ MACRO (MY_CHECK_C_COMPILER_FLAG flag) ...@@ -24,7 +24,7 @@ MACRO (MY_CHECK_C_COMPILER_FLAG flag)
ENDMACRO() ENDMACRO()
MACRO (MY_CHECK_CXX_COMPILER_FLAG flag) MACRO (MY_CHECK_CXX_COMPILER_FLAG flag)
STRING(REGEX REPLACE "[-,= ]" "_" result "HAVE_CXX_${flag}") STRING(REGEX REPLACE "[-,= ]" "_" result "have_CXX_${flag}")
SET(SAVE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}") SET(SAVE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${flag}") SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${flag}")
CHECK_CXX_SOURCE_COMPILES("int main(void) { return 0; }" ${result} CHECK_CXX_SOURCE_COMPILES("int main(void) { return 0; }" ${result}
...@@ -42,7 +42,7 @@ FUNCTION(MY_CHECK_AND_SET_COMPILER_FLAG flag) ...@@ -42,7 +42,7 @@ FUNCTION(MY_CHECK_AND_SET_COMPILER_FLAG flag)
MY_CHECK_CXX_COMPILER_FLAG(${flag}) MY_CHECK_CXX_COMPILER_FLAG(${flag})
STRING(REGEX REPLACE "[-,= ]" "_" result "${flag}") STRING(REGEX REPLACE "[-,= ]" "_" result "${flag}")
FOREACH(lang C CXX) FOREACH(lang C CXX)
IF (HAVE_${lang}_${result}) IF (have_${lang}_${result})
IF(ARGN) IF(ARGN)
FOREACH(type ${ARGN}) FOREACH(type ${ARGN})
SET(CMAKE_${lang}_FLAGS_${type} "${CMAKE_${lang}_FLAGS_${type}} ${flag}" PARENT_SCOPE) SET(CMAKE_${lang}_FLAGS_${type} "${CMAKE_${lang}_FLAGS_${type}} ${flag}" PARENT_SCOPE)
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
# Common warning flags for GCC, G++, Clang and Clang++ # Common warning flags for GCC, G++, Clang and Clang++
SET(MY_WARNING_FLAGS "-Wall -Wextra -Wformat-security -Wno-init-self") SET(MY_WARNING_FLAGS "-Wall -Wextra -Wformat-security -Wno-init-self")
MY_CHECK_C_COMPILER_FLAG("-Wvla") # Requires GCC 4.3+ or Clang MY_CHECK_C_COMPILER_FLAG("-Wvla") # Requires GCC 4.3+ or Clang
IF(HAVE_C__Wvla) IF(have_C__Wvla)
SET(MY_WARNING_FLAGS "${MY_WARNING_FLAGS} -Wvla") SET(MY_WARNING_FLAGS "${MY_WARNING_FLAGS} -Wvla")
ENDIF() ENDIF()
......
...@@ -276,7 +276,7 @@ FIND_PACKAGE (Threads) ...@@ -276,7 +276,7 @@ FIND_PACKAGE (Threads)
FUNCTION(MY_CHECK_PTHREAD_ONCE_INIT) FUNCTION(MY_CHECK_PTHREAD_ONCE_INIT)
MY_CHECK_C_COMPILER_FLAG("-Werror") MY_CHECK_C_COMPILER_FLAG("-Werror")
IF(NOT HAVE_C__Werror) IF(NOT have_C__Werror)
RETURN() RETURN()
ENDIF() ENDIF()
SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Werror") SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Werror")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment