mirror of
https://github.com/raspberrypi/pico-sdk.git
synced 2025-12-10 07:14:36 +01:00
Add a -nostdlib specifically for the check to ensure that it builds successfully. The -nostdlib isn't needed normally, because linking against the pico SDK will add in definitions for the previously-missing function
19 lines
755 B
CMake
19 lines
755 B
CMake
|
|
get_property(IS_IN_TRY_COMPILE GLOBAL PROPERTY IN_TRY_COMPILE)
|
|
foreach(LANG IN ITEMS C CXX ASM)
|
|
set(CMAKE_${LANG}_FLAGS_INIT "${ARM_TOOLCHAIN_COMMON_FLAGS}")
|
|
if (PICO_DEOPTIMIZED_DEBUG)
|
|
set(CMAKE_${LANG}_FLAGS_DEBUG_INIT "-O0")
|
|
else()
|
|
set(CMAKE_${LANG}_FLAGS_DEBUG_INIT "-Og")
|
|
endif()
|
|
set(CMAKE_${LANG}_LINK_FLAGS "-Wl,--build-id=none")
|
|
|
|
# try_compile is where the feature testing is done, and at that point,
|
|
# pico_standard_link is not ready to be linked in to provide essential
|
|
# functions like _exit. So pass -nostdlib so it doesn't link in an exit()
|
|
# function at all.
|
|
if(IS_IN_TRY_COMPILE)
|
|
set(CMAKE_${LANG}_LINK_FLAGS "${CMAKE_${LANG}_LINK_FLAGS} -nostdlib")
|
|
endif()
|
|
endforeach()
|