Skip to content

Commit 1cf4482

Browse files
chore: add -fPIE flag for C compiler in CMakeLists.txt
1 parent b8779d6 commit 1cf4482

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ endif()
3333
set(CMAKE_CXX_FLAGS "$ENV{CXXFLAGS} -std=c++11" )
3434

3535
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,--as-needed -fPIE -fPIC") #-Wl,--as-needed 减少无效的库链接,用不到的库需要清理
36+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIE")
3637

3738
if(DEFINED ENV{PREFIX})
3839
set(CMAKE_INSTALL_PREFIX $ENV{PREFIX})

0 commit comments

Comments
 (0)