The file exists, but the find_file can not find.
Code
file ( TO_CMAKE_PATH "${STM32Cube}/Drivers/STM32${STM32_SERIES}xx_HAL_Driver/Src" STM32HAL_SOURCE_DIR )
if ( IS_DIRECTORY "${STM32HAL_SOURCE_DIR}" )
find_file ( STM32HAL_SOURCE_FILES
"stm32${STM32_SERIES_LOWERCASE}xx_hal.c"
PATHS "${STM32HAL_SOURCE_DIR}"
)
if ( EXISTS "${STM32HAL_SOURCE_DIR}/stm32${STM32_SERIES_LOWERCASE}xx_hal.c" )
message ( "Exists!" )
endif ()
if ( NOT ${STM32HAL_SOURCE_FILES} )
message ( "${STM32HAL_SOURCE_DIR}/stm32${STM32_SERIES_LOWERCASE}xx_hal.c")
message ( FATAL_ERROR "The stm32${STM32_SERIES_LOWERCASE}xx_hal.c can not found in ${STM32HAL_SOURCE_DIR}." )
endif ()
endif ()
Output
Exists!
/Users/Invincible/STM32Cube/Repository/STM32Cube_FW_F4_V1.16.0/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.c
CMake Error at Modules/FindSTM32HAL.cmake:21 (message):
The stm32f4xx_hal.c can not found in
/Users/Invincible/STM32Cube/Repository/STM32Cube_FW_F4_V1.16.0/Drivers/STM32F4xx_HAL_Driver/Src.
Call Stack (most recent call first):
CMakeLists.txt:5 (find_package)