CMAKE_SH-NOTFOUND
I try cross-compile simple project for ARM on Windows 10 and Mac OS X in Clion. Cmake(on both systems) works well and can make it from cmd or mingw sh etc.
Clion(Windows) can't find information about header files by name. But it can include it by relative path and name. Clion (mac OS) works well.
Clion(Windows) can't find CMAKE_SH. I has got CMAKE_SH-NOTFOUND in Cmake/Cache.
There is no one Russian symbol or spaces in paths. What I should check to find solution?
My CMAKE_TOOLCHAIN_FILE is
include(CMakeForceCompiler)
set(CMAKE_SYSTEM_NAME Generic)
set(CMAKE_SYSTEM_PROCESSOR cortex-m3)
# Find the cross compiler
find_program(ARM_CC arm-none-eabi-gcc
${TOOLCHAIN_DIR}/bin)
find_program(ARM_CXX arm-none-eabi-g++
${TOOLCHAIN_DIR}/bin)
find_program(ARM_OBJCOPY arm-none-eabi-objcopy
${TOOLCHAIN_DIR}/bin)
find_program(ARM_SIZE_TOOL arm-none-eabi-size
${TOOLCHAIN_DIR}/bin)
find_program(ARM_AS arm-none-eabi-as
${TOOLCHAIN_DIR}/bin)
CMAKE_FORCE_C_COMPILER(${ARM_CC} GNU)
CMAKE_FORCE_CXX_COMPILER(${ARM_CXX} GNU)
set(COMMON_FLAGS
"-fno-common -ffunction-sections -fdata-sections")
set(CMAKE_ASM_FLAGS
${CMAKE_ASM_FLAGS} "-mcpu=cortex-m3 -mthumb")
if (CMAKE_SYSTEM_PROCESSOR STREQUAL cortex-m3)
set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS}
"-mcpu=cortex-m3 -mthumb -mthumb-interwork -msoft-float")
else ()
message(WARNING
Processor not recognised in toolchain file,
compiler flags not configured.)
endif ()
set(LINKER_SCRIPT ${PROJECT_SOURCE_DIR}/STM32F103C8Tx_FLASH.ld)
set(CMAKE_EXE_LINKER_FLAGS "-Wl,-gc-sections -T ${LINKER_SCRIPT}")
# fix long strings (CMake appends semicolons)
string(REGEX REPLACE ";" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}" CACHE STRING "")
set(BUILD_SHARED_LIBS OFF)
My CmakeList.txt is
cmake_minimum_required(VERSION 3.5.0)
project(STM23F103C8T6 C CXX ASM)
set(CMAKE_VERBOSE_MAKEFILE TRUE)
add_definitions(-DSTM32F103x6)
file(GLOB_RECURSE USER_SOURCES Src/*.c *.h)
file(GLOB_RECURSE HAL_SOURCES Drivers/STM32F1xx_HAL_Driver/Src/*.c)
add_library(CMSIS
${PROJECT_SOURCE_DIR}/Drivers/CMSIS/Device/ST/STM32F1xx/Source/Templates/system_stm32f1xx.c
${PROJECT_SOURCE_DIR}/Drivers/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc/startup_stm32f103xb.s)
include_directories(
Drivers/CMSIS/Device/ST/STM32F1xx/Include
Drivers/CMSIS/Include
Drivers/STM32F1xx_HAL_Driver/Inc
Inc)
add_executable(${PROJECT_NAME}.elf ${USER_SOURCES} ${HAL_SOURCES} ${LINKER_SCRIPT})
target_link_libraries(${PROJECT_NAME}.elf CMSIS)
set(HEX_FILE ${PROJECT_SOURCE_DIR}/build/${PROJECT_NAME}.hex)
set(BIN_FILE ${PROJECT_SOURCE_DIR}/build/${PROJECT_NAME}.bin)
add_custom_command(TARGET ${PROJECT_NAME}.elf POST_BUILD
COMMAND ${CMAKE_OBJCOPY} -Oihex $<TARGET_FILE:${PROJECT_NAME}.elf> ${HEX_FILE}
COMMAND ${CMAKE_OBJCOPY} -Obinary $<TARGET_FILE:${PROJECT_NAME}.elf> ${BIN_FILE}
COMMENT Building ${HEX_FILE} \nBuilding ${BIN_FILE})
Would you help me, please?
Please sign in to leave a comment.