Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 1 | # |
| 2 | # Licensed to the Apache Software Foundation (ASF) under one |
| 3 | # or more contributor license agreements. See the NOTICE file |
| 4 | # distributed with this work for additional information |
| 5 | # regarding copyright ownership. The ASF licenses this file |
| 6 | # to you under the Apache License, Version 2.0 (the |
| 7 | # "License"); you may not use this file except in compliance |
| 8 | # with the License. You may obtain a copy of the License at |
| 9 | # |
| 10 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | # |
| 12 | # Unless required by applicable law or agreed to in writing, |
| 13 | # software distributed under the License is distributed on an |
| 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 | # KIND, either express or implied. See the License for the |
| 16 | # specific language governing permissions and limitations |
| 17 | # under the License. |
| 18 | # |
| 19 | |
James E. King, III | 7edc8fa | 2017-01-20 10:11:41 -0500 | [diff] [blame] | 20 | include(CheckFunctionExists) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 21 | include(CheckIncludeFile) |
| 22 | include(CheckIncludeFiles) |
James E. King, III | 7edc8fa | 2017-01-20 10:11:41 -0500 | [diff] [blame] | 23 | include(CheckSymbolExists) |
Mario Emmenlauer | 5a64c71 | 2020-09-09 13:38:51 +0200 | [diff] [blame] | 24 | include(CheckStructHasMember) |
| 25 | include(CheckCSourceCompiles) |
| 26 | include(CheckCXXSourceCompiles) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 27 | |
James E. King, III | 7edc8fa | 2017-01-20 10:11:41 -0500 | [diff] [blame] | 28 | if (Inttypes_FOUND) |
| 29 | # This allows the inttypes.h and stdint.h checks to succeed on platforms that |
| 30 | # do not natively provide there. |
| 31 | set (CMAKE_REQUIRED_INCLUDES ${INTTYPES_INCLUDE_DIRS}) |
| 32 | endif () |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 33 | |
| 34 | check_include_file(arpa/inet.h HAVE_ARPA_INET_H) |
| 35 | check_include_file(fcntl.h HAVE_FCNTL_H) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 36 | check_include_file(getopt.h HAVE_GETOPT_H) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 37 | check_include_file(inttypes.h HAVE_INTTYPES_H) |
| 38 | check_include_file(netdb.h HAVE_NETDB_H) |
| 39 | check_include_file(netinet/in.h HAVE_NETINET_IN_H) |
James E. King III | 9bea32f | 2018-03-16 16:07:42 -0400 | [diff] [blame] | 40 | check_include_file(signal.h HAVE_SIGNAL_H) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 41 | check_include_file(stdint.h HAVE_STDINT_H) |
| 42 | check_include_file(unistd.h HAVE_UNISTD_H) |
| 43 | check_include_file(pthread.h HAVE_PTHREAD_H) |
Bugra Gedik | 8bcb7ac | 2018-01-21 09:43:49 -0800 | [diff] [blame] | 44 | check_include_file(sys/ioctl.h HAVE_SYS_IOCTL_H) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 45 | check_include_file(sys/param.h HAVE_SYS_PARAM_H) |
| 46 | check_include_file(sys/resource.h HAVE_SYS_RESOURCE_H) |
| 47 | check_include_file(sys/socket.h HAVE_SYS_SOCKET_H) |
| 48 | check_include_file(sys/stat.h HAVE_SYS_STAT_H) |
Bugra Gedik | 8bcb7ac | 2018-01-21 09:43:49 -0800 | [diff] [blame] | 49 | check_include_file(sys/time.h HAVE_SYS_TIME_H) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 50 | check_include_file(sys/un.h HAVE_SYS_UN_H) |
st0ke | 961fa70 | 2018-10-12 18:37:40 +0700 | [diff] [blame] | 51 | check_include_file(poll.h HAVE_POLL_H) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 52 | check_include_file(sys/poll.h HAVE_SYS_POLL_H) |
| 53 | check_include_file(sys/select.h HAVE_SYS_SELECT_H) |
| 54 | check_include_file(sched.h HAVE_SCHED_H) |
James E. King, III | 00d4252 | 2017-04-04 09:32:45 -0400 | [diff] [blame] | 55 | check_include_file(string.h HAVE_STRING_H) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 56 | check_include_file(strings.h HAVE_STRINGS_H) |
| 57 | |
Mario Emmenlauer | 5a64c71 | 2020-09-09 13:38:51 +0200 | [diff] [blame] | 58 | # Check for afunix.h on Windows (since Windows 10 Insider Build 17063): |
| 59 | check_cxx_source_compiles( |
| 60 | " |
| 61 | #define WIN32_LEAN_AND_MEAN |
| 62 | #include <winsock2.h> |
| 63 | #include <windows.h> |
| 64 | #include <afunix.h> |
| 65 | int main(){(void)sizeof(((struct sockaddr_un *)0)->sun_path); return 0;} |
| 66 | " |
| 67 | HAVE_AF_UNIX_H) |
| 68 | |
| 69 | |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 70 | check_function_exists(gethostbyname HAVE_GETHOSTBYNAME) |
| 71 | check_function_exists(gethostbyname_r HAVE_GETHOSTBYNAME_R) |
| 72 | check_function_exists(strerror_r HAVE_STRERROR_R) |
| 73 | check_function_exists(sched_get_priority_max HAVE_SCHED_GET_PRIORITY_MAX) |
| 74 | check_function_exists(sched_get_priority_min HAVE_SCHED_GET_PRIORITY_MIN) |
| 75 | |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 76 | |
| 77 | check_cxx_source_compiles( |
| 78 | " |
| 79 | #include <string.h> |
Anton Filippov | 68f2194 | 2020-03-31 18:51:16 +0700 | [diff] [blame] | 80 | int main(){char b;char *a = strerror_r(0, &b, 0); static_cast<void>(a); return(0);} |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 81 | " |
| 82 | STRERROR_R_CHAR_P) |
| 83 | |
| 84 | |
| 85 | set(PACKAGE ${PACKAGE_NAME}) |
| 86 | set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") |
| 87 | set(VERSION ${thrift_VERSION}) |
| 88 | |
| 89 | # generate a config.h file |
Roger Meier | 2e05316 | 2015-02-19 17:27:53 +0100 | [diff] [blame] | 90 | configure_file("${CMAKE_CURRENT_SOURCE_DIR}/build/cmake/config.h.in" "${CMAKE_CURRENT_BINARY_DIR}/thrift/config.h") |
James E. King, III | 7edc8fa | 2017-01-20 10:11:41 -0500 | [diff] [blame] | 91 | |
| 92 | include_directories("${CMAKE_CURRENT_BINARY_DIR}") |