File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ project(openlibm
99 LANGUAGES C ASM )
1010
1111option (BUILD_SHARED_LIBS "Build using shared libraries" ON )
12+ option (openlibm_PIC "Build openlibm with position independent code" ON )
1213
1314add_library ("${PROJECT_NAME } " )
1415
@@ -35,7 +36,7 @@ endif()
3536
3637# Compile flags
3738list (APPEND C_ASM_COMPILE_FLAGS "-ffp-contract=off" "-fno-fast-math" "-fno-rounding-math" "-fno-math-errno" )
38- list (APPEND C_ASM_COMPILE_FLAGS "-fPIC" "- fno-builtin" )
39+ list (APPEND C_ASM_COMPILE_FLAGS "-fno-builtin" )
3940list (APPEND C_ASM_COMPILE_FLAGS "-Wall" "-Wno-implicit-function-declaration" )
4041list (APPEND C_ASM_COMPILE_FLAGS "-DASSEMBLER" "-D__BSD_VISIBLE" "-O3" )
4142
@@ -539,10 +540,16 @@ target_sources("${PROJECT_NAME}" PRIVATE ${OPENLIBM_C_SOURCE}
539540 ${OPENLIBM_ASM_SOURCE}
540541)
541542
543+ if (openlibm_PIC)
544+ include (CheckPIESupported )
545+ check_pie_supported ()
546+ endif ()
547+
542548set_target_properties ("${PROJECT_NAME } " PROPERTIES
543549 C_STANDARD 99
544550 C_STANDARD_REQUIRED ON
545551 C_EXTENSIONS OFF
552+ POSITION_INDEPENDENT_CODE ${openlibm_PIC}
546553)
547554
548555
You can’t perform that action at this time.
0 commit comments