[CMake] Problem with ASM and COMPILE_DEFINITIONS

Marcel Loose loose at astron.nl
Tue May 26 03:53:41 EDT 2009


Hi Tyler,

Actually, I was hoping that CMake would not pass on any preprocessor
definitions to the assembler, because -D is in general not understood by
an assembler as a preprocessor directive. Do I need to change any of the
CMakeASM*Information, CMakeDetermineASM*Compiler or
CMakeTestASM*Compiler macros? Or is it a bug in CMake?

Using remove_definition requires that I know exactly which definitions
to remove. However, depending on the type of build (debug, release,
etc), these definitions will be different, so that's kind of difficult
to figure out (but not impossible, as long as the user does not add
definitions on the command line). I use add_definition() instead of
set_target_properties() to make sure that *every* source is compiled
with the same definitions.

Best regards,
Marcel Loose.

-----Original Message-----
From: Tyler Roscoe <tyler at cryptio.net>
To: Marcel Loose <loose at astron.nl>
Cc: cmake at cmake.org
Subject: Re: [CMake] Problem with ASM and COMPILE_DEFINITIONS
Date: Mon, 25 May 2009 09:22:36 -0700

On Mon, May 25, 2009 at 12:13:13PM +0200, Marcel Loose wrote:
> I get compilation errors, because CMake passes -D<def> definitions to
> the assembler, but the assembler doesn't accept preprocessor
> definitions. These definitions were set a number of directory levels
> higher, using add_definitions(). How can I avoid that these definitions
> are put on the command line to the assembler?

How about:

http://www.cmake.org/cmake/help/cmake2.6docs.html#command:remove_definitions

Another route is to switch from using add_definitions() to using
set_target_properties(... COMPILE_DEFINITIONS ...) with variables
declared in your higher-level CMakeLists and mangled, perhaps with
regular expressions, in the CMakeLists for your assembler project.

tyler



More information about the CMake mailing list