From a2afe8d39d62daf5a404887c1514d8454c031d5e Mon Sep 17 00:00:00 2001 From: Brenden Blanco Date: Fri, 11 Aug 2017 08:00:14 -0700 Subject: [PATCH] Add clang check for -nopie option The -no-pie option is not available in clang until 6.0. Per the documentation, -nopie serves the same purpose as -no-pie (but not -fno-pie). Hence, use the -nopie option when clang is in use as the CC. Fixes: #1237 Signed-off-by: Brenden Blanco --- src/lua/CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/lua/CMakeLists.txt b/src/lua/CMakeLists.txt index 6ad0e874f4cf..48378eaa7600 100644 --- a/src/lua/CMakeLists.txt +++ b/src/lua/CMakeLists.txt @@ -24,7 +24,11 @@ if (LUAJIT_LIBRARIES AND LUAJIT) set_target_properties(bcc-lua PROPERTIES LINKER_LANGUAGE C) target_link_libraries(bcc-lua ${LUAJIT_LIBRARIES}) target_link_libraries(bcc-lua -Wl,--whole-archive bcc-static -Wl,--no-whole-archive) - target_link_libraries(bcc-lua -no-pie) + if (CMAKE_C_COMPILER_ID MATCHES "Clang") + target_link_libraries(bcc-lua -nopie) + else() + target_link_libraries(bcc-lua -no-pie) + endif() install(TARGETS bcc-lua RUNTIME DESTINATION bin) endif()