Pass compiler flags to volk_gnsssdr in a more elegant way

This commit is contained in:
Carles Fernandez 2022-12-17 10:19:09 +01:00
parent fd456d1eec
commit 3747e0396d
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
4 changed files with 3 additions and 36 deletions

View File

@ -1154,15 +1154,10 @@ if(NOT VOLKGNSSSDR_FOUND)
-DENABLE_ORC=${ORC_ENABLED}
${STRIP_VOLK_GNSSSDR_PROFILE}
${USE_THIS_PYTHON}
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS} # Required by packaging systems
-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS} # Required by packaging systems
)
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,13 +556,6 @@ 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,12 +71,6 @@ 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>$<$<AND:$<CONFIG:None>,$<BOOL:${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
@ -100,12 +94,6 @@ 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>$<$<AND:$<CONFIG:None>,$<BOOL:${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

@ -590,11 +590,7 @@ if(NOT (ENABLE_STATIC_LIBS AND (CMAKE_GENERATOR STREQUAL Xcode)))
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
PUBLIC $<INSTALL_INTERFACE:include>
)
if(UNIX)
target_compile_definitions(volk_gnsssdr
PUBLIC $<$<CONFIG:Release>:_FORTIFY_SOURCE=2>$<$<CONFIG:RelWithDebInfo>:_FORTIFY_SOURCE=2>$<$<AND:$<CONFIG:None>,$<BOOL:${ENABLE_PACKAGING}>>:_FORTIFY_SOURCE=2>
)
endif()
if(USE_CPU_FEATURES)
if(CPUFEATURES_FOUND)
target_include_directories(volk_gnsssdr
@ -665,11 +661,6 @@ if(ENABLE_STATIC_LIBS)
PRIVATE ${CMAKE_CURRENT_BINARY_DIR}
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
)
if(UNIX)
target_compile_definitions(volk_gnsssdr_static
PUBLIC $<$<CONFIG:Release>:_FORTIFY_SOURCE=2>$<$<CONFIG:RelWithDebInfo>:_FORTIFY_SOURCE=2>$<$<AND:$<CONFIG:None>,$<BOOL:${ENABLE_PACKAGING}>>:_FORTIFY_SOURCE=2>
)
endif()
set_target_properties(volk_gnsssdr_static PROPERTIES OUTPUT_NAME volk_gnsssdr)
install(TARGETS volk_gnsssdr_static