Home | History | Annotate | Download | only in cmake
      1 # Copyright (c) 2017 Facebook, Inc.
      2 # Licensed under the Apache License, Version 2.0 (the "License")
      3 
      4 if (CMAKE_C_COMPILER_ID MATCHES "Clang")
      5 	set(COMPILER_NOPIE_FLAG "-nopie")
      6 else()
      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}")
     17 endif()
     18