2024-06-05 01:59:28 +01:00
# PICO_CMAKE_CONFIG: PICO_TOOLCHAIN_PATH, Path to search for compiler, type=string, default=none (i.e. search system paths), group=build
2021-03-18 20:02:21 +00:00
set ( PICO_TOOLCHAIN_PATH "${PICO_TOOLCHAIN_PATH}" CACHE INTERNAL "" )
2021-01-20 10:44:27 -06:00
# Set a default build type if none was specified
set ( default_build_type "Release" )
if ( NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES )
message ( STATUS "Defaulting build type to '${default_build_type}' since not specified." )
set ( CMAKE_BUILD_TYPE "${default_build_type}" CACHE STRING "Choose the type of build, options are: 'Debug', 'Release', 'MinSizeRel', 'RelWithDebInfo'." FORCE )
# Set the possible values of build type for cmake-gui
set_property ( CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
" D e b u g " " R e l e a s e " " M i n S i z e R e l " " R e l W i t h D e b I n f o " )
endif ( )
if ( CMAKE_BUILD_TYPE STREQUAL "Default" )
error ( "Default build type is NOT supported" )
endif ( )
2024-06-05 01:59:28 +01:00
# PICO_CMAKE_CONFIG: PICO_COMPILER, Optionally specifies a different compiler (other than pico_arm_gcc.cmake) - this is not yet fully supported, type=string, group=build
2021-01-20 10:44:27 -06:00
# If PICO_COMPILER is specified, set toolchain file to ${PICO_COMPILER}.cmake.
if ( DEFINED PICO_COMPILER )
if ( DEFINED CMAKE_TOOLCHAIN_FILE )
get_filename_component ( toolchain "${CMAKE_TOOLCHAIN_FILE}" NAME_WE )
if ( NOT "${PICO_COMPILER}" STREQUAL "${toolchain}" )
message ( WARNING " CMAKE_TOOLCHAIN_FILE is already defined to ${ toolchain } .cmake, you\
n e e d t o d e l e t e c a c h e a n d r e c o n f i g u r e i f y o u w a n t t o s w i t c h c o m p i l e r . " )
endif ( )
else ( )
set ( toolchain_dir "${CMAKE_CURRENT_LIST_DIR}/preload/toolchains" )
set ( toolchain_file "${toolchain_dir}/${PICO_COMPILER}.cmake" )
if ( EXISTS "${toolchain_file}" )
set ( CMAKE_TOOLCHAIN_FILE "${toolchain_file}" CACHE INTERNAL "" )
else ( )
# todo improve message
message ( FATAL_ERROR "Toolchain file \" ${ PICO_COMPILER } .cmake\ " does not exist, please\
s e l e c t o n e f r o m \ " c m a k e / t o o l c h a i n s \ " f o l d e r . " )
endif ( )
endif ( )
2021-05-04 08:01:11 -05:00
message ( "PICO compiler is ${PICO_COMPILER}" )
2021-01-20 10:44:27 -06:00
endif ( )
unset ( PICO_COMPILER CACHE )