Skip to content

Commit ca08327

Browse files
authored
Update CMakeLists.txt
1 parent 37b03c8 commit ca08327

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

CMakeLists.txt

+4-3
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,17 @@ if(NOT TERMUX)
1919
endif ()
2020
##stop-editing
2121

22+
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
2223
# Termux specific, irrelevant to others. Fixes the `ld cannot find -lpthread` error when building static binary
2324
set(THREADS_PREFER_PTHREAD_FLAG ON)
2425
# Common, static building of external libpcap
2526
option(USE_SYSTEM_PCAP "Disable System PCAP for static build" OFF)
2627
if(ANDROID_PLATFORM STREQUAL "19" OR ANDROID_PLATFORM STREQUAL "20")
2728
# Needs a fix for duplicate symbol error on sdk19 static building, leaving to shared for now
28-
set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++" CACHE STRING "" FORCE)
29-
#set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++ -static -z muldefs" CACHE STRING "" FORCE)
29+
set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++ -fPIC -fPIE" CACHE STRING "" FORCE)
30+
# NW set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++ -static -z muldefs" CACHE STRING "" FORCE)
3031
else ()
31-
set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++ -static" CACHE STRING "" FORCE)
32+
set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++ -static -fPIC -fPIE" CACHE STRING "" FORCE)
3233
endif ()
3334

3435
cmake_minimum_required(VERSION 3.12)

0 commit comments

Comments
 (0)