COMP: Check for -Wno-long-double before using

Older GCC on the Mac warns for use of long double, so we use
-Wno-long-double.  Newer GCC on the Mac does not have this flag and
gives an error.  We now check for the flag before using it.
See bug #7357.
This commit is contained in:
Brad King 2008-07-17 15:19:25 -04:00
parent eb85676928
commit 129f3bef2d
1 changed files with 13 additions and 9 deletions

View File

@ -675,15 +675,19 @@ ELSE(RETSIGTYPE_TEST)
ENDIF(RETSIGTYPE_TEST) ENDIF(RETSIGTYPE_TEST)
IF(CMAKE_COMPILER_IS_GNUCC AND APPLE) IF(CMAKE_COMPILER_IS_GNUCC AND APPLE)
# The Mac version of GCC warns about use of long double. Disable it. INCLUDE(CheckCCompilerFlag)
GET_SOURCE_FILE_PROPERTY(MPRINTF_COMPILE_FLAGS mprintf.c COMPILE_FLAGS) CHECK_C_COMPILER_FLAG(-Wno-long-double HAVE_C_FLAG_Wno_long_double)
IF(MPRINTF_COMPILE_FLAGS) IF(HAVE_C_FLAG_Wno_long_double)
SET(MPRINTF_COMPILE_FLAGS "${MPRINTF_COMPILE_FLAGS} -Wno-long-double") # The Mac version of GCC warns about use of long double. Disable it.
ELSE(MPRINTF_COMPILE_FLAGS) GET_SOURCE_FILE_PROPERTY(MPRINTF_COMPILE_FLAGS mprintf.c COMPILE_FLAGS)
SET(MPRINTF_COMPILE_FLAGS "-Wno-long-double") IF(MPRINTF_COMPILE_FLAGS)
ENDIF(MPRINTF_COMPILE_FLAGS) SET(MPRINTF_COMPILE_FLAGS "${MPRINTF_COMPILE_FLAGS} -Wno-long-double")
SET_SOURCE_FILES_PROPERTIES(mprintf.c PROPERTIES ELSE(MPRINTF_COMPILE_FLAGS)
COMPILE_FLAGS ${MPRINTF_COMPILE_FLAGS}) SET(MPRINTF_COMPILE_FLAGS "-Wno-long-double")
ENDIF(MPRINTF_COMPILE_FLAGS)
SET_SOURCE_FILES_PROPERTIES(mprintf.c PROPERTIES
COMPILE_FLAGS ${MPRINTF_COMPILE_FLAGS})
ENDIF(HAVE_C_FLAG_Wno_long_double)
ENDIF(CMAKE_COMPILER_IS_GNUCC AND APPLE) ENDIF(CMAKE_COMPILER_IS_GNUCC AND APPLE)
INCLUDE(CMake/OtherTests.cmake) INCLUDE(CMake/OtherTests.cmake)