[CMake] Platform information override file is ignored for ASM language

Никонов Михаил Николаевич michael.nikonov at mail.ru
Mon Aug 25 06:36:21 EDT 2014


Hello,

In a bare-metal embedded project, I need to initialize compiler flags
to custom values while toolchains are initialized; for that, I'm using
override files to set _INIT variables. From what I've encountered, it
appears that CMAKE_USER_MAKE_RULES_OVERRIDE file (and
language-specific *_ASM one) are not loaded during initialization of
assembly compiler. Here's a test to reproduce it, made of two files:

CMakeLists.txt:
  set(CMAKE_USER_MAKE_RULES_OVERRIDE override.cmake)
  project(Test C CXX ASM)

override.cmake:
  set(CMAKE_C_FLAGS_INIT "-Wall")
  set(CMAKE_CXX_FLAGS_INIT "-Wall")
  set(CMAKE_ASM_FLAGS_INIT "-Wall")

After running cmake, CMAKE_C_FLAGS and CMAKE_CXX_FLAGS in
CMakeCache.txt contain flag -Wall, while CMAKE_ASM_FLAGS doesn't
(tested with CMake 2.8.12.2 and 3.0.1 and gcc 4.8.2 on latest Ubuntu).

Is there any mistake I made? And if not, is there any elegant
workaround for that? I'm aware that I can just force flags' values
into cache in toolchain file itself, before project() call, but from
what I understood, it's a discouraged practice.

Regards,
Mikhail.


More information about the CMake mailing list