forked from HIT-SCIR/ltp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ConfigureChecks.cmake
108 lines (96 loc) · 4.22 KB
/
ConfigureChecks.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#-----------------------------------------------------------------------------
# Include all the necessary files for macros
#-----------------------------------------------------------------------------
INCLUDE (${CMAKE_ROOT}/Modules/CheckFunctionExists.cmake)
INCLUDE (${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake)
INCLUDE (${CMAKE_ROOT}/Modules/CheckIncludeFileCXX.cmake)
INCLUDE (${CMAKE_ROOT}/Modules/CheckIncludeFiles.cmake)
INCLUDE (${CMAKE_ROOT}/Modules/CheckLibraryExists.cmake)
INCLUDE (${CMAKE_ROOT}/Modules/CheckSymbolExists.cmake)
INCLUDE (${CMAKE_ROOT}/Modules/CheckTypeSize.cmake)
#-----------------------------------------------------------------------------
# Always SET this for now IF we are on an OS X box
#-----------------------------------------------------------------------------
IF (APPLE)
LIST(LENGTH CMAKE_OSX_ARCHITECTURES ARCH_LENGTH)
IF(ARCH_LENGTH GREATER 1)
set (CMAKE_OSX_ARCHITECTURES "" CACHE STRING "" FORCE)
message(FATAL_ERROR "Building Universal Binaries on OS X is NOT supported by the HDF5 project. This is"
"due to technical reasons. The best approach would be build each architecture in separate directories"
"and use the 'lipo' tool to combine them into a single executable or library. The 'CMAKE_OSX_ARCHITECTURES'"
"variable has been set to a blank value which will build the default architecture for this system.")
ENDIF()
SET (HDF_AC_APPLE_UNIVERSAL_BUILD 0)
ENDIF (APPLE)
#-----------------------------------------------------------------------------
# This MACRO checks IF the symbol exists in the library and IF it
# does, it appends library to the list.
#-----------------------------------------------------------------------------
SET (LINK_LIBS "")
MACRO (CHECK_LIBRARY_EXISTS_CONCAT LIBRARY SYMBOL VARIABLE)
CHECK_LIBRARY_EXISTS ("${LIBRARY};${LINK_LIBS}" ${SYMBOL} "" ${VARIABLE})
IF (${VARIABLE})
SET (LINK_LIBS ${LINK_LIBS} ${LIBRARY})
ENDIF (${VARIABLE})
ENDMACRO (CHECK_LIBRARY_EXISTS_CONCAT)
# ----------------------------------------------------------------------
# WINDOWS Hard code Values
# ----------------------------------------------------------------------
SET (WINDOWS)
IF (WIN32)
IF (NOT UNIX AND NOT CYGWIN AND NOT MINGW)
SET (WINDOWS 1)
ENDIF (NOT UNIX AND NOT CYGWIN AND NOT MINGW)
ENDIF (WIN32)
IF (WINDOWS)
SET (HAVE_LIBM 1)
SET (HAVE_IO_H 1)
SET (HAVE_SETJMP_H 1)
SET (HAVE_STDDEF_H 1)
SET (HAVE_SYS_STAT_H 1)
SET (HAVE_SYS_TIMEB_H 1)
SET (HAVE_SYS_TYPES_H 1)
SET (HAVE_STRDUP 1)
SET (HAVE_SYSTEM 1)
SET (HAVE_DIFFTIME 1)
SET (HAVE_LONGJMP 1)
SET (STDC_HEADERS 1)
SET (HAVE_GETHOSTNAME 1)
SET (HAVE_TIMEZONE 1)
SET (HAVE_FUNCTION 1)
ENDIF (WINDOWS)
# ----------------------------------------------------------------------
# END of WINDOWS Hard code Values
# ----------------------------------------------------------------------
IF (CYGWIN)
SET (HAVE_LSEEK64 0)
ENDIF (CYGWIN)
#-----------------------------------------------------------------------------
# Check for the math library "m"
#-----------------------------------------------------------------------------
IF (NOT WINDOWS)
CHECK_LIBRARY_EXISTS_CONCAT ("m" random HAVE_LIBM)
ENDIF (NOT WINDOWS)
CHECK_LIBRARY_EXISTS_CONCAT ("ws2_32" WSAStartup HAVE_LIBWS2_32)
CHECK_LIBRARY_EXISTS_CONCAT ("wsock32" gethostbyname HAVE_LIBWSOCK32)
#CHECK_LIBRARY_EXISTS_CONCAT ("dl" dlopen HAVE_LIBDL)
CHECK_LIBRARY_EXISTS_CONCAT ("ucb" gethostname HAVE_LIBUCB)
CHECK_LIBRARY_EXISTS_CONCAT ("socket" connect HAVE_LIBSOCKET)
CHECK_LIBRARY_EXISTS ("c" gethostbyname "" NOT_NEED_LIBNSL)
IF (NOT NOT_NEED_LIBNSL)
CHECK_LIBRARY_EXISTS_CONCAT ("nsl" gethostbyname HAVE_LIBNSL)
ENDIF (NOT NOT_NEED_LIBNSL)
SET (USE_INCLUDES "")
IF (WINDOWS)
SET (USE_INCLUDES ${USE_INCLUDES} "windows.h")
ENDIF (WINDOWS)
#-----------------------------------------------------------------------------
# Check IF header file exists and add it to the list.
#-----------------------------------------------------------------------------
MACRO (CHECK_INCLUDE_FILE_CONCAT FILE VARIABLE)
CHECK_INCLUDE_FILES ("${USE_INCLUDES};${FILE}" ${VARIABLE})
IF (${VARIABLE})
SET (USE_INCLUDES ${USE_INCLUDES} ${FILE})
ADD_DEFINITIONS( -D${VARIABLE} )
ENDIF (${VARIABLE})
ENDMACRO (CHECK_INCLUDE_FILE_CONCAT)