Sha256: 4be37a9752e3859c9ab8525f365fcb4392d1e5135ea222795c304b42dcf11b13

Contents?: true

Size: 1004 Bytes

Versions: 12

Compression:

Stored size: 1004 Bytes

Contents

# - Append compiler flag to CMAKE_C_FLAGS if compiler supports it
# ADD_C_FLAG_IF_SUPPORTED(<flag>)
#  <flag> - the compiler flag to test
# This internally calls the CHECK_C_COMPILER_FLAG macro.

include(CheckCCompilerFlag)

macro(ADD_C_FLAG _FLAG)
	string(TOUPPER ${_FLAG} UPCASE)
	string(REGEX REPLACE "[-=]" "_" UPCASE_PRETTY ${UPCASE})
	string(REGEX REPLACE "^_+" "" UPCASE_PRETTY ${UPCASE_PRETTY})
	check_c_compiler_flag(${_FLAG} IS_${UPCASE_PRETTY}_SUPPORTED)

	if(IS_${UPCASE_PRETTY}_SUPPORTED)
		set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${_FLAG}")
	else()
		message(FATAL_ERROR "Required flag ${_FLAG} is not supported")
	endif()
endmacro()

macro(ADD_C_FLAG_IF_SUPPORTED _FLAG)
	string(TOUPPER ${_FLAG} UPCASE)
	string(REGEX REPLACE "[-=]" "_" UPCASE_PRETTY ${UPCASE})
	string(REGEX REPLACE "^_+" "" UPCASE_PRETTY ${UPCASE_PRETTY})
	check_c_compiler_flag(${_FLAG} IS_${UPCASE_PRETTY}_SUPPORTED)

	if(IS_${UPCASE_PRETTY}_SUPPORTED)
		set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${_FLAG}")
	endif()
endmacro()

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
rugged-1.7.2 vendor/libgit2/cmake/AddCFlagIfSupported.cmake
rugged-1.6.5 vendor/libgit2/cmake/AddCFlagIfSupported.cmake
rugged-1.7.1 vendor/libgit2/cmake/AddCFlagIfSupported.cmake
rugged-1.6.3 vendor/libgit2/cmake/AddCFlagIfSupported.cmake
rugged-1.6.2 vendor/libgit2/cmake/AddCFlagIfSupported.cmake
rugged-1.5.1 vendor/libgit2/cmake/AddCFlagIfSupported.cmake
rugged-1.4.5 vendor/libgit2/cmake/AddCFlagIfSupported.cmake
rugged-1.5.0.1 vendor/libgit2/cmake/AddCFlagIfSupported.cmake
rugged-1.5.0 vendor/libgit2/cmake/AddCFlagIfSupported.cmake
rugged-1.4.4 vendor/libgit2/cmake/AddCFlagIfSupported.cmake
rugged-1.4.3 vendor/libgit2/cmake/AddCFlagIfSupported.cmake
rugged-1.4.2 vendor/libgit2/cmake/AddCFlagIfSupported.cmake