Prevent the literal string DEBUG from being appended to some messages in CMake < 3.15 (#433)
Fixes issue #422
diff --git a/pico_sdk_init.cmake b/pico_sdk_init.cmake
index c291a50..b3e054c 100644
--- a/pico_sdk_init.cmake
+++ b/pico_sdk_init.cmake
@@ -18,6 +18,15 @@
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 @@
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()