• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2017 Facebook, Inc.
2# Licensed under the Apache License, Version 2.0 (the "License")
3
4if (CMAKE_C_COMPILER_ID MATCHES "Clang")
5	set(COMPILER_NOPIE_FLAG "-nopie")
6else()
7	set(_backup_c_flags "${CMAKE_REQUIRED_FLAGS}")
8	set(CMAKE_REQUIRED_FLAGS "-no-pie")
9	CHECK_CXX_SOURCE_COMPILES("int main() {return 0;}"
10				  HAVE_NO_PIE_FLAG)
11	if (HAVE_NO_PIE_FLAG)
12		set(COMPILER_NOPIE_FLAG "-no-pie")
13	else()
14		set(COMPILER_NOPIE_FLAG "")
15	endif()
16	set(CMAKE_REQUIRED_FLAGS "${_backup_c_flags}")
17endif()
18