[trunk] use the home made macro to ensure the existence of some include file
This commit is contained in:
parent
021e255282
commit
6de2271e2a
|
@ -181,15 +181,28 @@ endif()
|
|||
|
||||
#-----------------------------------------------------------------------------
|
||||
# opj_config.h generation
|
||||
include (${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake)
|
||||
CHECK_INCLUDE_FILE("stdint.h" OPJ_HAVE_STDINT_H)
|
||||
CHECK_INCLUDE_FILE("inttypes.h" OPJ_HAVE_INTTYPES_H)
|
||||
|
||||
# Check if some include files are provided by the system
|
||||
include(EnsureFileInclude)
|
||||
# These files are mandatory
|
||||
ensure_file_include("string.h" HAVE_STRING_H YES)
|
||||
ensure_file_include("memory.h" HAVE_MEMORY_H YES)
|
||||
ensure_file_include("stdlib.h" HAVE_STDLIB_H YES)
|
||||
ensure_file_include("stdio.h" HAVE_STDIO_H YES)
|
||||
ensure_file_include("math.h" HAVE_MATH_H YES)
|
||||
ensure_file_include("float.h" HAVE_FLOAT_H YES)
|
||||
ensure_file_include("time.h" HAVE_TIME_H YES)
|
||||
ensure_file_include("stdarg.h" HAVE_STDARG_H YES)
|
||||
ensure_file_include("ctype.h" HAVE_CTYPE_H YES)
|
||||
ensure_file_include("assert.h" HAVE_ASSERT_H YES)
|
||||
|
||||
# For the following files, we provide an alternative, they are not mandatory
|
||||
ensure_file_include("stdint.h" OPJ_HAVE_STDINT_H NO)
|
||||
ensure_file_include("inttypes.h" OPJ_HAVE_INTTYPES_H NO)
|
||||
|
||||
# why check this one ? for openjpip ?
|
||||
include (${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake)
|
||||
CHECK_INCLUDE_FILE("strings.h" HAVE_STRINGS_H)
|
||||
CHECK_INCLUDE_FILE("memory.h" HAVE_MEMORY_H)
|
||||
CHECK_INCLUDE_FILE("stdlib.h" HAVE_STDLIB_H)
|
||||
CHECK_INCLUDE_FILE("stdio.h" HAVE_STDIO_H)
|
||||
CHECK_INCLUDE_FILE("string.h" HAVE_STRING_H)
|
||||
CHECK_INCLUDE_FILE("sys/stat.h" HAVE_SYS_STAT_H)
|
||||
CHECK_INCLUDE_FILE("sys/types.h" HAVE_SYS_TYPES_H)
|
||||
CHECK_INCLUDE_FILE("unistd.h" HAVE_UNISTD_H)
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
# Ensure that an include file is provided by the system
|
||||
# Add the check about the mandatory status to the check_include_file macro
|
||||
# provided by cmake
|
||||
|
||||
include (${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake)
|
||||
|
||||
macro(ensure_file_include INCLUDE_FILENAME VARIABLE_NAME MANDATORY_STATUS)
|
||||
|
||||
#message(WARNING "INCLUDE_FILENAME=${INCLUDE_FILENAME} \n"
|
||||
# "VARIABLE_NAME=${VARIABLE_NAME} \n"
|
||||
# "MANDATORY_STATUS=${MANDATORY_STATUS}")
|
||||
|
||||
CHECK_INCLUDE_FILE(${INCLUDE_FILENAME} ${VARIABLE_NAME})
|
||||
|
||||
#message(WARNING "INCLUDE_FILENAME=${INCLUDE_FILENAME} \n"
|
||||
# "VARIABLE_NAME=${VARIABLE_NAME} \n"
|
||||
# "VARIABLE_NAME_VALUE=${${VARIABLE_NAME}} \n"
|
||||
# "MANDATORY_STATUS=${MANDATORY_STATUS}")
|
||||
|
||||
if (NOT ${${VARIABLE_NAME}})
|
||||
if (${MANDATORY_STATUS})
|
||||
message(FATAL_ERROR "The file ${INCLUDE_FILENAME} is mandatory but not found on your system")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
endmacro()
|
Loading…
Reference in New Issue