dbus-glib-receiving: new options: --raw and --output
[platform/upstream/bcc.git] / cmake / FindCompilerFlag.cmake
1 # Copyright (c) 2017 Facebook, Inc.
2 # Licensed under the Apache License, Version 2.0 (the "License")
3
4 if (ENABLE_NO_PIE)
5
6 if (CMAKE_C_COMPILER_ID MATCHES "Clang")
7         set(COMPILER_NOPIE_FLAG "-nopie")
8 else()
9         set(_backup_c_flags "${CMAKE_REQUIRED_FLAGS}")
10         set(CMAKE_REQUIRED_FLAGS "-no-pie")
11         CHECK_CXX_SOURCE_COMPILES("int main() {return 0;}"
12                                   HAVE_NO_PIE_FLAG)
13         if (HAVE_NO_PIE_FLAG)
14                 set(COMPILER_NOPIE_FLAG "-no-pie")
15         else()
16                 set(COMPILER_NOPIE_FLAG "")
17         endif()
18         set(CMAKE_REQUIRED_FLAGS "${_backup_c_flags}")
19 endif()
20
21 endif(ENABLE_NO_PIE)
22
23 # check whether reallocarray availability
24 # this is used to satisfy reallocarray usage under src/cc/libbpf/
25 CHECK_CXX_SOURCE_COMPILES(
26 "
27 #define _GNU_SOURCE
28 #include <stdlib.h>
29
30 int main(void)
31 {
32         return !!reallocarray(NULL, 1, 1);
33 }
34 " HAVE_REALLOCARRAY_SUPPORT)