diff --git a/CMakeLists.txt b/CMakeLists.txt index 906d808..5bd7e24 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -57,8 +57,8 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") - if(LINUX) - # On Linux, make the whole executable position-independent + if(LINUX AND CMAKE_CXX_COMPILER_ID MATCHES "GNU") + # On Linux GCC, make the whole executable position-independent set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pie") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pie") endif()