summaryrefslogtreecommitdiff
path: root/cmake/CMakeLists.txt
blob: 0182d2a1ea54c870e3188dbae938bff1a6ae6409 (plain)
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
#######
# @licence make begin@
# SPDX license identifier: MPL-2.0
#
# Copyright (C) 2011-2015, BMW AG
#
# This file is part of GENIVI Project DLT - Diagnostic Log and Trace.
#
# This Source Code Form is subject to the terms of the
# Mozilla Public License (MPL), v. 2.0.
# If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
#
# For further information see http://www.genivi.org/.
# @licence end@
#######

# Run CheckIncludeFiles and CheckFunctionExists
include(TestBigEndian)
TEST_BIG_ENDIAN( DLT_BIGENDIAN )
if( DLT_BIGENDIAN )
	add_definitions( -DBYTE_ORDER=BIG_ENDIAN )
else ( DLT_BIGENDIAN )
	add_definitions( -DBYTE_ORDER=LITTLE_ENDIAN )
endif ( DLT_BIGENDIAN )

INCLUDE(CheckIncludeFiles)

CHECK_INCLUDE_FILES( arpa/inet.h HAVE_ARPAINET_H)
CHECK_INCLUDE_FILES( fcntl.h HAVE_FCNTL_H)
CHECK_INCLUDE_FILES( float.h HAVE_FLOAT_H)
CHECK_INCLUDE_FILES( limits.h HAVE_LIMITS_H)
CHECK_INCLUDE_FILES( netdb.h HAVE_NETDB_H)
CHECK_INCLUDE_FILES( netinet/in.h HAVE_NETINETIN_H)
CHECK_INCLUDE_FILES( stddef.h HAVE_STDDEF_H)
CHECK_INCLUDE_FILES( stdint.h HAVE_STDINT_H)
CHECK_INCLUDE_FILES( stdlib.h HAVE_STDLIB_H)
CHECK_INCLUDE_FILES( string.h HAVE_STRING_H)
CHECK_INCLUDE_FILES( strings.h HAVE_STRINGS_H)
CHECK_INCLUDE_FILES( sys/ioctl.h HAVE_SYSIOCTL_H)
CHECK_INCLUDE_FILES( sys/socket.h HAVE_SYSSOCKET_H)
CHECK_INCLUDE_FILES( sys/time.h HAVE_SYSTIME_H)
if( WITH_SYSTEMD_WATCHDOG OR WITH_SYSTEMD )
    set(CMAKE_REQUIRED_INCLUDES "${CMAKE_SOURCE_DIR}/systemd/3rdparty/")
    CHECK_INCLUDE_FILES( sd-daemon.h HAVE_SYSTEMD_H)
endif ( WITH_SYSTEMD_WATCHDOG OR WITH_SYSTEMD )
CHECK_INCLUDE_FILES( unistd.h HAVE_UNISTD_H)
CHECK_INCLUDE_FILES( sys/ipc.h HAVE_SYSIPC_H)
CHECK_INCLUDE_FILES( netdb.h HAVE_NETDB_H)
CHECK_INCLUDE_FILES( ctype.h HAVE_CTYPE_H)
CHECK_INCLUDE_FILES( signal.h HAVE_SIGNAL_H)
CHECK_INCLUDE_FILES( syslog.h HAVE_SYSLOG_H)
CHECK_INCLUDE_FILES( sys/stat.h HAVE_SYSSTAT_H)
CHECK_INCLUDE_FILES( linux/stat.h HAVE_LINUXSTAT_H)
CHECK_INCLUDE_FILES( sys/uio.h HAVE_SYSUIO_H)
CHECK_INCLUDE_FILES( termios.h HAVE_TERMIOS_H)
CHECK_INCLUDE_FILES( unistd.h HAVE_UNISTD_H)

INCLUDE(CheckFunctionExists)

CHECK_FUNCTION_EXISTS( bzero HAVE_FUNC_BZERO)
CHECK_FUNCTION_EXISTS( clock_gettime HAVE_FUNC_CLOCKGETTIME)
CHECK_FUNCTION_EXISTS( floor HAVE_FUNC_FLOOR)
CHECK_FUNCTION_EXISTS( fork HAVE_FUNC_FORK)
CHECK_FUNCTION_EXISTS( gethostbyname HAVE_FUNC_GETHOSTBYNAME)
CHECK_FUNCTION_EXISTS( gettimeofday HAVE_FUNC_GETTIMEBYDAY)
CHECK_FUNCTION_EXISTS( inet_ntoa HAVE_FUNC_INETNTOA)
CHECK_FUNCTION_EXISTS( malloc HAVE_FUNC_MALLOC)
CHECK_FUNCTION_EXISTS( memmove HAVE_FUNC_MEMMOVE)
CHECK_FUNCTION_EXISTS( memset HAVE_FUNC_MEMSET)
CHECK_FUNCTION_EXISTS( mkfifo HAVE_FUNC_MKFIFO)
CHECK_FUNCTION_EXISTS( select HAVE_FUNC_SELECT)
CHECK_FUNCTION_EXISTS( socket HAVE_FUNC_SOCKET)
CHECK_FUNCTION_EXISTS( strchr HAVE_FUNC_STRCHR)
CHECK_FUNCTION_EXISTS( strerror HAVE_FUNC_STRERROR)
CHECK_FUNCTION_EXISTS( strstr HAVE_FUNC_STRSTR)
CHECK_FUNCTION_EXISTS( strtol HAVE_FUNC_STRTOL)

if(WITH_CHECK_CONFIG_FILE)
  configure_file(${CMAKE_SOURCE_DIR}/cmake/config.h.cmake ${PROJECT_BINARY_DIR}/include/dlt/config.h)
endif(WITH_CHECK_CONFIG_FILE)

CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/cmake/dlt_version.h.cmake ${CMAKE_SOURCE_DIR}/include/dlt/dlt_version.h @ONLY)