Skip to content

Commit

Permalink
Prevent the literal string DEBUG from being appended to some messages…
Browse files Browse the repository at this point in the history
… in CMake < 3.15

Fixes issue raspberrypi#422
  • Loading branch information
jonathangjertsen committed May 22, 2021
1 parent ecc86bb commit 815f4c4
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion cmake/preload/toolchains/pico_arm_gcc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ if (NOT PICO_GCC_TRIPLE)
message("PICO_GCC_TRIPLE set from environment: $ENV{PICO_GCC_TRIPLE}")
else()
set(PICO_GCC_TRIPLE arm-none-eabi)
message(DEBUG "PICO_GCC_TRIPLE defaulted to arm-none-eabi")
message_debug("PICO_GCC_TRIPLE defaulted to arm-none-eabi")
endif()
endif()

Expand Down
13 changes: 11 additions & 2 deletions pico_sdk_init.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@ if (NOT TARGET _pico_sdk_pre_init_marker)
endif()
endfunction()

function(message_debug MESSAGE)
# The log-level system was added in CMake 3.15.
if(${CMAKE_VERSION} VERSION_LESS "3.15.0")
message(${MESSAGE})
else()
message(DEBUG ${MESSAGE})
endif()
endfunction()

if (NOT PICO_SDK_PATH)
set(PICO_SDK_PATH ${CMAKE_CURRENT_LIST_DIR})
endif ()
Expand Down Expand Up @@ -49,14 +58,14 @@ if (NOT TARGET _pico_sdk_pre_init_marker)
macro(add_sub_list_dirs var)
foreach(LIST_DIR IN LISTS ${var})
get_filename_component(SHORT_NAME "${LIST_DIR}" NAME)
message(DEBUG "Including custom CMakeLists.txt ${SHORT_NAME}")
message_debug("Including custom CMakeLists.txt ${SHORT_NAME}")
add_subdirectory(${LIST_DIR} ${SHORT_NAME})
endforeach()
endmacro()

macro(add_sub_list_files var)
foreach(LIST_FILE IN LISTS ${var})
message(DEBUG "Including custom CMake file ${LIST_FILE}")
message_debug("Including custom CMake file ${LIST_FILE}")
include(${LIST_FILE})
endforeach()
endmacro()
Expand Down
2 changes: 1 addition & 1 deletion tools/FindELF2UF2.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ if (NOT ELF2UF2_FOUND)
set(ELF2UF2_TARGET ELF2UF2)

if (NOT TARGET ${ELF2UF2_BUILD_TARGET})
message(DEBUG "ELF2UF2 will need to be built")
message_debug("ELF2UF2 will need to be built")
ExternalProject_Add(${ELF2UF2_BUILD_TARGET}
PREFIX elf2uf2 SOURCE_DIR ${ELF2UF2_SOURCE_DIR}
BINARY_DIR ${ELF2UF2_BINARY_DIR}
Expand Down
2 changes: 1 addition & 1 deletion tools/FindPioasm.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ if (NOT Pioasm_FOUND)
set(Pioasm_TARGET Pioasm)

if (NOT TARGET ${PioasmBuild_TARGET})
message(DEBUG "PIOASM will need to be built")
message_debug("PIOASM will need to be built")
# message("Adding external project ${PioasmBuild_Target} in ${CMAKE_CURRENT_LIST_DIR}}")
ExternalProject_Add(${PioasmBuild_TARGET}
PREFIX pioasm SOURCE_DIR ${PIOASM_SOURCE_DIR}
Expand Down

0 comments on commit 815f4c4

Please sign in to comment.