Sha256: 6c2fa4ffebe595428f06d8332330e832c7c7352a006705ac811621b9b4d50f73

Contents?: true

Size: 1004 Bytes

Versions: 19

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

19 entries across 19 versions & 1 rubygems

Version Path
rugged-1.3.2.3 vendor/libgit2/cmake/AddCFlagIfSupported.cmake
rugged-1.3.2.1 vendor/libgit2/cmake/AddCFlagIfSupported.cmake
rugged-1.3.2 vendor/libgit2/cmake/AddCFlagIfSupported.cmake
rugged-1.3.1 vendor/libgit2/cmake/AddCFlagIfSupported.cmake
rugged-1.3.0 vendor/libgit2/cmake/AddCFlagIfSupported.cmake
rugged-1.2.0 vendor/libgit2/cmake/AddCFlagIfSupported.cmake
rugged-1.1.1 vendor/libgit2/cmake/AddCFlagIfSupported.cmake
rugged-1.1.0 vendor/libgit2/cmake/AddCFlagIfSupported.cmake
rugged-1.0.1 vendor/libgit2/cmake/Modules/AddCFlagIfSupported.cmake
rugged-0.28.5 vendor/libgit2/cmake/Modules/AddCFlagIfSupported.cmake
rugged-1.0.0 vendor/libgit2/cmake/Modules/AddCFlagIfSupported.cmake
rugged-0.99.0 vendor/libgit2/cmake/Modules/AddCFlagIfSupported.cmake
rugged-0.28.4.1 vendor/libgit2/cmake/Modules/AddCFlagIfSupported.cmake
rugged-0.28.4 vendor/libgit2/cmake/Modules/AddCFlagIfSupported.cmake
rugged-0.27.10 vendor/libgit2/cmake/Modules/AddCFlagIfSupported.cmake
rugged-0.28.3.1 vendor/libgit2/cmake/Modules/AddCFlagIfSupported.cmake
rugged-0.28.2 vendor/libgit2/cmake/Modules/AddCFlagIfSupported.cmake
rugged-0.28.1 vendor/libgit2/cmake/Modules/AddCFlagIfSupported.cmake
rugged-0.28.0 vendor/libgit2/cmake/Modules/AddCFlagIfSupported.cmake