6

In build system generated (Visual Studio 2017 Generator) with the following cmake, the 'test.asm' source file isn't compiled with the preprocessor definition MY_MASM_DEFINITION:

cmake_minimum_required(VERSION 3.14)
project("test")

enable_language(CXX)
enable_language(ASM_MASM)

add_library(Problem STATIC "test.asm")

target_compile_definitions(Problem PUBLIC "MY_MASM_DEFINITION")

The same is true if I set CMAKE_ASM_MASM_FLAGS, or use set_target_properties.

It does work if I use set_source_files_properties, but setting this on each source file will not work well in our build system.

Am I doing something wrong?

Is there a workaround other than using set_source_files_properties?

Thanks in advance.

Kevin
  • 16,549
  • 8
  • 60
  • 74
AlastairHolmes
  • 427
  • 2
  • 10
  • Have you tried to use the CMake "add_definitions" method? – N0un Nov 21 '19 at 13:27
  • Submitted a CMAKE bug request. Looks like they'll have this fixed in the next release. https://gitlab.kitware.com/cmake/cmake/-/issues/24289 – vengy Jan 13 '23 at 02:18

0 Answers0