Skip to content

Warning about usage #19

@BenBE

Description

@BenBE

With recent versions of cmake, the following two lines produce a warning at configuration time:

enable_language(ASM)
set(CMAKE_EXECUTABLE_SUFFIX ".elf")

The message is as follows:

CMake Warning (dev) at cubemx.cmake/cubemx.cmake:16 (enable_language):
  project() should be called prior to this enable_language() call.
Call Stack (most recent call first):
  CMakeLists.txt:9 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

To fix, commenting out the mentioned two lines suffices. A downstream project using this code should ensure the following two changes:

  1. The call to project contains C CXX ASM for the languages argument
  2. The downstream project sets the executable suffix to .elf
cmake_minimum_required (VERSION 3.16)

# Possible values: openocd, pyocd, stlink, blackmagic. stlink is default
# set(CMX_DEBUGGER "openocd")
# set(OPENOCD_CFG "${CMAKE_CURRENT_SOURCE_DIR}/openocd.cfg")

set(ARMGCC_TOOLCHAIN_PATH "/opt/gcc-arm-none-eabi-path-as-necessary/bin/")
include(cubemx.cmake/arm-gcc.cmake)
include(cubemx.cmake/cubemx.cmake)

# Other stuff
project(projectname LANGUAGES C CXX ASM)
set(CMAKE_EXECUTABLE_SUFFIX ".elf")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions