BUG: fix for bug 80, check include cxx now has an optional argument that can is added to the cxx flags

This commit is contained in:
Bill Hoffman 2004-04-28 09:52:12 -04:00
parent d76c9f8195
commit 79269fc5a9
1 changed files with 11 additions and 0 deletions

View File

@ -4,6 +4,7 @@
# CHECK_INCLUDE_FILE - macro which checks the include file exists.
# INCLUDE - name of include file
# VARIABLE - variable to return result
# OPTIONAL - a third argument can be extra flags which are passed to the compiler
#
MACRO(CHECK_INCLUDE_FILE_CXX INCLUDE VARIABLE)
@ -12,10 +13,20 @@ MACRO(CHECK_INCLUDE_FILE_CXX INCLUDE VARIABLE)
SET(CHECK_INCLUDE_FILE_VAR ${INCLUDE})
CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CheckIncludeFile.cxx.in
${CMAKE_BINARY_DIR}/CMakeTmp/CheckIncludeFile.cxx IMMEDIATE)
IF(${ARGC} EQUAL 2)
SET(CMAKE_CXX_FLAGS_SAVE ${CMAKE_CXX_FLAGS})
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ARGV2}")
ENDIF(${ARGC} EQUAL 2)
TRY_COMPILE(${VARIABLE}
${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}/CMakeTmp/CheckIncludeFile.cxx
OUTPUT_VARIABLE OUTPUT)
IF(${ARGC} EQUAL 2)
SET(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS_SAVE})
ENDIF(${ARGC} EQUAL 2)
IF(${VARIABLE})
MESSAGE(STATUS "Checking for CXX include file ${INCLUDE} -- found")
SET(${VARIABLE} 1 CACHE INTERNAL "Have include ${INCLUDE}")