stm32-cmake icon indicating copy to clipboard operation
stm32-cmake copied to clipboard

Check all default paths existence before setting them

Open robamu opened this issue 4 years ago • 0 comments

If no configuration is provided via environment/argument/upper CMakeList.txt, default paths will be set. However, it is not checked whether these paths/directories actually exist. It would be a good idea to do this everywhere this is done.

Example which might be merged in FindFreeRTOS.cmake soon (https://github.com/ObKo/stm32-cmake/pull/227) :

if(NOT FREERTOS_PATH)
    set(FREERTOS_PATH $ENV{FREERTOS_PATH} CACHE PATH "Path to FreeRTOS")
endif()

if(NOT FREERTOS_PATH)
    set(DEFAULT_FREERTOS_PATH "/opt/FreeRTOS")
    if(EXISTS ${DEFAULT_FREERTOS_PATH})
        set(FREERTOS_PATH ${DEFAULT_FREERTOS_PATH} CACHE PATH "Path to FreeRTOS")
        message(STATUS "No FREERTOS_PATH specified using default: ${DEFAULT_FREERTOS_PATH}")
    else()
        message(STATUS
            "No FreeRTOS folder found at default location ${DEFAULT_FREERTOS_PATH}. "
            "Leaving empty
        )
    endif()
endif()

robamu avatar Jul 15 '21 11:07 robamu