mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-02 03:40:35 +08:00
CMAKE: Move flags to general location, disable sections for linker on Mac OS
This commit is contained in:
@@ -498,6 +498,7 @@ function(px4_add_common_flags)
|
||||
-Werror=reorder
|
||||
-Werror=uninitialized
|
||||
-Werror=init-self
|
||||
-Wno-unused-const-variable
|
||||
#-Wcast-qual - generates spurious noreturn attribute warnings,
|
||||
# try again later
|
||||
#-Wconversion - would be nice, but too many "risky-but-safe"
|
||||
@@ -508,7 +509,6 @@ function(px4_add_common_flags)
|
||||
|
||||
if (NOT ${CMAKE_C_COMPILER_ID} STREQUAL "Clang")
|
||||
list(APPEND warnings
|
||||
-Wno-unused-const-variable
|
||||
-Werror=unused-but-set-variable
|
||||
-Wformat=1
|
||||
#-Wlogical-op # very verbose due to eigen
|
||||
@@ -618,10 +618,16 @@ function(px4_add_common_flags)
|
||||
-DCONFIG_ARCH_BOARD_${board_config}
|
||||
)
|
||||
|
||||
set(added_exe_link_flags
|
||||
-Wl,--warn-common
|
||||
-Wl,--gc-sections
|
||||
)
|
||||
if (NOT ${CMAKE_C_COMPILER_ID} STREQUAL "Clang")
|
||||
set(added_exe_link_flags
|
||||
-Wl,--warn-common
|
||||
-Wl,--gc-sections
|
||||
)
|
||||
else()
|
||||
set(added_exe_link_flags
|
||||
-Wl,--warn-common
|
||||
)
|
||||
endif()
|
||||
|
||||
# output
|
||||
foreach(var ${inout_vars})
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# compiler tools
|
||||
foreach(tool objcopy nm ld)
|
||||
foreach(tool nm ld)
|
||||
string(TOUPPER ${tool} TOOL)
|
||||
find_program(${TOOL} ${tool})
|
||||
if(NOT ${TOOL})
|
||||
|
||||
@@ -13,11 +13,25 @@ add_executable(mainapp
|
||||
apps.h
|
||||
)
|
||||
|
||||
target_link_libraries(mainapp
|
||||
-Wl,--start-group
|
||||
${module_libraries}
|
||||
pthread m rt
|
||||
-Wl,--end-group
|
||||
)
|
||||
if (NOT ${CMAKE_C_COMPILER_ID} STREQUAL "Clang")
|
||||
target_link_libraries(mainapp
|
||||
-Wl,--start-group
|
||||
${module_libraries}
|
||||
pthread m rt
|
||||
-Wl,--end-group
|
||||
)
|
||||
else()
|
||||
if (APPLE)
|
||||
target_link_libraries(mainapp
|
||||
${module_libraries}
|
||||
pthread m
|
||||
)
|
||||
else()
|
||||
target_link_libraries(mainapp
|
||||
${module_libraries}
|
||||
pthread m rt
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# vim: set noet ft=cmake fenc=utf-8 ff=unix :
|
||||
|
||||
Reference in New Issue
Block a user