Fix lintian warning hardening-no-fortify-functions

This commit is contained in:
Carles Fernandez 2022-12-16 11:38:43 +01:00
parent e2e1949804
commit fa9d25a5b2
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
4 changed files with 26 additions and 2 deletions

View File

@ -1158,6 +1158,11 @@ if(NOT VOLKGNSSSDR_FOUND)
${USE_THIS_PYTHON}
)
if(ENABLE_PACKAGING)
set(VOLK_GNSSSDR_CMAKE_ARGS ${VOLK_GNSSSDR_CMAKE_ARGS}
-DENABLE_PACKAGING=ON
)
endif()
if(DEFINED ENV{OECORE_TARGET_SYSROOT})
set(VOLK_GNSSSDR_CMAKE_ARGS ${VOLK_GNSSSDR_CMAKE_ARGS}
-DCROSSCOMPILE_MULTILIB=TRUE

View File

@ -556,6 +556,13 @@ else()
message(STATUS "System profiling is disabled.")
endif()
message(STATUS " Modify using: -DENABLE_PROFILING=ON/OFF")
########################################################################
# Option to pass _FORTIFY_SOURCES=2 to the compiler regardless of
# the building type
########################################################################
option(ENABLE_PACKAGING "Always pass _FORTIFY_SOURCES=2 to the compiler" OFF)
########################################################################
########################################################################

View File

@ -71,6 +71,12 @@ else()
target_link_libraries(volk_gnsssdr_profile PRIVATE volk_gnsssdr ${orc_lib})
endif()
if(UNIX)
target_compile_definitions(volk_gnsssdr_profile
PUBLIC $<$<CONFIG:Release>:_FORTIFY_SOURCE=2>$<$<CONFIG:RelWithDebInfo>:_FORTIFY_SOURCE=2>$<$<ENABLE_PACKAGING>:_FORTIFY_SOURCE=2>
)
endif()
if(ENABLE_STRIP)
if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND NOT WIN32)
set_target_properties(volk_gnsssdr_profile
@ -94,6 +100,12 @@ else()
target_link_libraries(volk_gnsssdr-config-info volk_gnsssdr ${orc_lib})
endif()
if(UNIX)
target_compile_definitions(volk_gnsssdr-config-info
PUBLIC $<$<CONFIG:Release>:_FORTIFY_SOURCE=2>$<$<CONFIG:RelWithDebInfo>:_FORTIFY_SOURCE=2>$<$<ENABLE_PACKAGING>:_FORTIFY_SOURCE=2>
)
endif()
if(ENABLE_STRIP)
if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND NOT WIN32)
set_target_properties(volk_gnsssdr-config-info

View File

@ -592,7 +592,7 @@ if(NOT (ENABLE_STATIC_LIBS AND (CMAKE_GENERATOR STREQUAL Xcode)))
)
if(UNIX)
target_compile_definitions(volk_gnsssdr
PUBLIC $<$<CONFIG:Release>:_FORTIFY_SOURCE=2>$<$<CONFIG:RelWithDebInfo>:_FORTIFY_SOURCE=2>
PUBLIC $<$<CONFIG:Release>:_FORTIFY_SOURCE=2>$<$<CONFIG:RelWithDebInfo>:_FORTIFY_SOURCE=2>$<$<ENABLE_PACKAGING>:_FORTIFY_SOURCE=2>
)
endif()
if(USE_CPU_FEATURES)
@ -667,7 +667,7 @@ if(ENABLE_STATIC_LIBS)
)
if(UNIX)
target_compile_definitions(volk_gnsssdr_static
PUBLIC $<$<CONFIG:Release>:_FORTIFY_SOURCE=2>$<$<CONFIG:RelWithDebInfo>:_FORTIFY_SOURCE=2>
PUBLIC $<$<CONFIG:Release>:_FORTIFY_SOURCE=2>$<$<CONFIG:RelWithDebInfo>:_FORTIFY_SOURCE=2>$<$<ENABLE_PACKAGING>:_FORTIFY_SOURCE=2>
)
endif()
set_target_properties(volk_gnsssdr_static PROPERTIES OUTPUT_NAME volk_gnsssdr)