1 # Copyright (c) 2017 Facebook, Inc.
2 # Licensed under the Apache License, Version 2.0 (the "License")
6 if (CMAKE_C_COMPILER_ID MATCHES "Clang")
7 set(COMPILER_NOPIE_FLAG "-nopie")
9 set(_backup_c_flags "${CMAKE_REQUIRED_FLAGS}")
10 set(CMAKE_REQUIRED_FLAGS "-no-pie")
11 CHECK_CXX_SOURCE_COMPILES("int main() {return 0;}"
14 set(COMPILER_NOPIE_FLAG "-no-pie")
16 set(COMPILER_NOPIE_FLAG "")
18 set(CMAKE_REQUIRED_FLAGS "${_backup_c_flags}")
23 # check whether reallocarray availability
24 # this is used to satisfy reallocarray usage under src/cc/libbpf/
25 CHECK_CXX_SOURCE_COMPILES(
32 return !!reallocarray(NULL, 1, 1);
34 " HAVE_REALLOCARRAY_SUPPORT)