Prevent the literal string DEBUG from being appended to some messages in CMake < 3.15 (#433)

Fixes issue #422
This commit is contained in:
Jonathan Reichelt Gjertsen 2021-05-26 00:10:55 +02:00 committed by GitHub
parent 6994a3858d
commit a531123080
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 6 deletions

View File

@ -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")
pico_message_debug("PICO_GCC_TRIPLE defaulted to arm-none-eabi")
endif()
endif()

View File

@ -18,6 +18,15 @@ if (NOT TARGET _pico_sdk_pre_init_marker)
endif()
endfunction()
function(pico_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 ()
@ -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}")
pico_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}")
pico_message_debug("Including custom CMake file ${LIST_FILE}")
include(${LIST_FILE})
endforeach()
endmacro()

View File

@ -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")
pico_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}
@ -40,4 +40,4 @@ if (NOT ELF2UF2_FOUND)
add_dependencies(${ELF2UF2_TARGET} ${ELF2UF2_BUILD_TARGET})
set(ELF2UF2_FOUND 1)
endif()
endif()

View File

@ -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")
pico_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}