CMake not adding preprocessor definitions for ASM_MASM
Asked Answered
A

0

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.

Apartment answered 17/4, 2019 at 11:26 Comment(2)
Have you tried to use the CMake "add_definitions" method?Volatile
Submitted a CMAKE bug request. Looks like they'll have this fixed in the next release. gitlab.kitware.com/cmake/cmake/-/issues/24289Palikar

© 2022 - 2024 — McMap. All rights reserved.