View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0008170CMakeCMakepublic2008-11-25 10:442015-04-06 09:07
ReporterThorsten Köster 
Assigned To 
PlatformOSOS Version
Product VersionCMake-2-6 
Target VersionCMake 3.1Fixed in VersionCMake 3.1 
Summary0008170: Visual Studio 9 generator does not output Custom Build Tool command line for assembler sources
DescriptionI basically have the following CMakeLists.txt (reduced for clarity) which I would like to use for building a static library consisting of both C++ and assembler sources:

PROJECT(${lib_name} CXX ASM-ATT)
# I'm paranoid right now, so try to force CMake...

The assembler (MinGW as) seems to be detected correctly, and when I generate an Eclipse project with Unix makefiles, the command line shows up correctly. When I try the same in Visual Studio, the configuration for the ${ASM_SRCS}-files will be set to "Custom Build Tool", but no command line will be issued (verified in .vcproj file).
Tagsasm, masm, msvc, studio, visual, visual studio
Attached Filesdiff file icon vs_asm.diff [^] (15,413 bytes) 2010-02-23 13:04 [Show Content]
zip file icon [^] (965 bytes) 2010-03-14 08:00
diff file icon cmLocalGenerator.diff [^] (1,624 bytes) 2010-04-13 07:35 [Show Content]
patch file icon 0001-generator-expression.patch [^] (3,386 bytes) 2012-08-20 13:09 [Show Content]
patch file icon 0002-visual-studio-assembly-files.patch [^] (8,112 bytes) 2012-08-20 13:09 [Show Content]
patch file icon 0001-asm_file_support_vs2010_vs2012.patch [^] (2,556 bytes) 2012-10-25 17:54 [Show Content]
patch file icon 0001-new_asm_file_support_vs2010_vs2012.patch [^] (2,566 bytes) 2013-06-05 10:04 [Show Content]

has duplicate 0014984closed Assembler config not working (in VS2005, with partial solution,with zlib-1.2.8) 
related to 0009905closed Support for .asm files in the Visual Studio generators 
related to 0011536closedPatrick R. Gansterer Can't use assembler files with Visual Studio 10 generator 
related to 0010848closedKitware Robot Issue with space in paths used for <OBJECT> and <SOURCE> in CMAKE_ASM 

Thorsten Köster (reporter)
2008-11-25 11:02

I even added


but that didn't help, either. When I added


though, each and every file would suddenly have been compiled using the assembler.
Bill Hoffman (manager)
2009-02-12 12:27

Right now the asm stuff is not really supported in the vs generators...
Brian Bassett (reporter)
2010-02-23 13:04
edited on: 2010-02-23 16:11

I've put together a patch that fixes this issue for those Visual Studio generators that use the Visual Studio 7 local generator (we're using CMake for an internal project, and only needed to support VS2008). The patch adds the concept of a "multi-config custom command" (which is basically a map of configurations to custom commands). This is not exposed to the user, and only used internally to the generator.

This patch also happens to have the benefit of being general (i.e. it isn't limited to assembler), but handles any generating objects for any language that the generator doesn't already know about (i.e. C, CXX, IDL, RC, DEF, and Fortran).

db (reporter)
2010-03-14 08:00

Good job! That's what I'm waiting for a long time. Unfortunately it does not work entirely correctly with generated sources. In the attached example test2.asm is initially filled with "Artificial dependency for a custom command." and is not re-generated during Visual Studio build. With nmake generator it's generated as expected.
Maxim Kizub (reporter)
2010-04-13 07:38

We have the same issue, and to compile our project I've make a quick fix in file cmLocalGenerator.cxx
We use "yasm.exe" assembler and ASM language.
Maybe this patch, used as example, will help the fix the bug.
viktor11111 (reporter)
2010-10-18 20:37

Please apply this patch "cmLocalGenerator.diff" in main branche, because that bug is still reproduced.
David Cole (manager)
2011-05-25 16:58

Not for 2.8.5 - postponing until a future release
Amine Khaldi (reporter)
2012-02-09 11:52

Please note that this bug is blocking us (ReactOS) from using the VS generators, and msbuild specifically, so our only option right now is the one core nmake builds where asm files are handled correctly.
Amine Khaldi (reporter)
2012-08-06 21:10

Ping ?
Brian Bassett (reporter)
2012-08-20 13:09

I've updated my patch to move away from my (admittedly funky) multi-config custom command concept to use a new generator expression ($<CONFIG_SPECIFIC:...>) to expand the correct flags. (The patch is now in two chunks, one that implements the new generator expression, and the other that updates the generators.)
Amine Khaldi (reporter)
2012-08-20 15:42


First of all thank you for working on this.

Did you perhaps miss <DEFINES> expansion ? I didn't see it mentioned anywhere, when I (superficially) looked at the patch.
David Cole (manager)
2012-08-20 15:54

We just merged a branch into 'master' that contains new generator expressions. See the commits here (FYI for anybody working on generator expression type stuff):

  Add boolean generator expressions:;a=commitdiff;h=ebf05abda15967f8f50dcf132f7bf84472ca6337 [^]

  Add $<CONFIG:...> boolean query generator expression;a=commitdiff;h=9d9f616792ee07a460af9f0a6dc036d81b852e66 [^]

There are also several other bug tracker issues that are related to configuration-specific behaviors, for add_custom_command and others, ... If I can find them, I'll link them to this as related issues.
Brian Bassett (reporter)
2012-08-20 16:48

@Amine: Yes and no. I didn't expand <DEFINES>, but that was because none of the three supported assemblers (MASM, NASM, or ATT) use <DEFINES> in their CMAKE_ASM*_COMPILE_OBJECT declaration.
Amine Khaldi (reporter)
2012-08-20 17:08

@Brian: Ah I see. We do use them (ReactOS) so I would appreciate adding the expansion here. I'll test the patch as soon as you upload it, and report back. Thank you in advance ;)
David Cole (manager)
2012-10-18 11:17

These bugs were deferred from target version 2.8.10 to 2.8.11 based on the responses to this email thread on the CMake developer's mailing list: [^]
viktor11111 (reporter)
2012-10-25 18:12
edited on: 2012-10-25 18:28

find more simple solution based on this article [^]

please check patch "0001-asm_file_support_vs2010_vs2012.patch" and commit it in main branch



viktor11111 (reporter)
2013-02-12 16:41

Ping ?
Bud (reporter)
2013-05-31 07:50

+1; I'm hoping this patch is in 2.8.12, it's been holding me up for months.
viktor11111 (reporter)
2013-06-05 10:06

update patch for last revision


please check and commit it in main branch
db (reporter)
2013-07-29 02:38

viktor11111, your solution is only partial because it does not support anything different from MASM. There are other assemblers in the world (e.g. yasm, jwasm etc.) So I would prefer Maxim Kizub's way (cmLocalGenerator.diff). Maxim, can you update your patch for the latest CMake/Visual studio 2012?
Amine Khaldi (reporter)
2013-08-06 17:39

Please note, the patch mentioned here and in [^] doesn't solve the preprocessed asm source files case. The work started by Brian Bassett is the closest thing to having proper handling of the most widely used form of asm source files (you rarely add asm source files without preprocessing). It would be great to have that picked up so that we (ReactOS at least) can finally compile with VS. Thanks.
db (reporter)
2013-08-08 01:22

@Amine: indeed, Brian Bassett's patch seems to be the most universal one. Has anyone updated it for CMake 2.8.11?
Brad King (manager)
2014-08-22 10:40

This has now been implemented:

 VS: Add MASM support to VS 8 and 9;a=commitdiff;h=0f8522a6 [^]
Robert Maynard (manager)
2015-04-06 09:07

Closing resolved issues that have not been updated in more than 4 months.

 Issue History
Date Modified Username Field Change
2008-11-25 10:44 Thorsten Köster New Issue
2008-11-25 11:02 Thorsten Köster Note Added: 0014180
2009-02-12 12:27 Bill Hoffman Note Added: 0014915
2009-02-12 12:27 Bill Hoffman Status new => assigned
2009-02-12 12:27 Bill Hoffman Assigned To => Bill Hoffman
2010-02-23 13:04 Brian Bassett Note Added: 0019597
2010-02-23 13:04 Brian Bassett File Added: vs_asm.diff
2010-02-23 16:11 Brian Bassett Note Edited: 0019597
2010-03-14 08:00 db Note Added: 0019873
2010-03-14 08:00 db File Added:
2010-04-13 07:35 Maxim Kizub File Added: cmLocalGenerator.diff
2010-04-13 07:38 Maxim Kizub Note Added: 0020150
2010-10-18 20:37 viktor11111 Note Added: 0022529
2010-10-18 20:52 viktor11111 Tag Attached: msvc
2010-10-18 20:52 viktor11111 Tag Attached: studio
2010-10-18 20:52 viktor11111 Tag Attached: visual
2010-10-18 20:52 viktor11111 Tag Attached: visual studio
2010-10-18 20:52 viktor11111 Tag Attached: asm
2010-10-18 20:52 viktor11111 Tag Attached: masm
2010-12-15 09:04 David Cole Relationship added related to 0009905
2011-03-10 15:05 Alex Neundorf Relationship added related to 0011536
2011-03-10 15:11 Alex Neundorf Relationship added related to 0010848
2011-04-14 14:17 David Cole Target Version => CMake 2.8.5
2011-05-25 16:58 David Cole Note Added: 0026592
2011-05-25 16:58 David Cole Target Version CMake 2.8.5 =>
2012-02-09 11:52 Amine Khaldi Note Added: 0028545
2012-08-06 21:10 Amine Khaldi Note Added: 0030179
2012-08-20 11:48 David Cole Assigned To Bill Hoffman =>
2012-08-20 11:48 David Cole Status assigned => new
2012-08-20 11:48 David Cole Target Version => CMake 2.8.10
2012-08-20 13:09 Brian Bassett Note Added: 0030710
2012-08-20 13:09 Brian Bassett File Added: 0001-generator-expression.patch
2012-08-20 13:09 Brian Bassett File Added: 0002-visual-studio-assembly-files.patch
2012-08-20 15:42 Amine Khaldi Note Added: 0030711
2012-08-20 15:54 David Cole Note Added: 0030712
2012-08-20 16:48 Brian Bassett Note Added: 0030713
2012-08-20 17:08 Amine Khaldi Note Added: 0030714
2012-10-18 11:16 David Cole Target Version CMake 2.8.10 => CMake 2.8.11
2012-10-18 11:17 David Cole Note Added: 0031259
2012-10-25 17:54 viktor11111 File Added: 0001-asm_file_support_vs2010_vs2012.patch
2012-10-25 18:12 viktor11111 Note Added: 0031337
2012-10-25 18:21 viktor11111 Note Edited: 0031337
2012-10-25 18:24 viktor11111 Note Edited: 0031337
2012-10-25 18:28 viktor11111 Note Edited: 0031337
2013-02-12 16:41 viktor11111 Note Added: 0032252
2013-05-17 09:33 Robert Maynard Target Version CMake 2.8.11 => CMake 2.8.12
2013-05-31 07:50 Bud Note Added: 0033159
2013-06-05 10:04 viktor11111 File Added: 0001-new_asm_file_support_vs2010_vs2012.patch
2013-06-05 10:06 viktor11111 Note Added: 0033244
2013-07-29 02:38 db Note Added: 0033624
2013-08-06 17:39 Amine Khaldi Note Added: 0033674
2013-08-08 01:22 db Note Added: 0033680
2014-06-24 14:55 Brad King Relationship added has duplicate 0014984
2014-08-22 10:40 Brad King Note Added: 0036668
2014-08-22 10:40 Brad King Target Version CMake 2.8.12 => CMake 3.1
2014-10-03 09:19 Brad King Status new => resolved
2014-10-03 09:19 Brad King Resolution open => fixed
2014-10-03 09:19 Brad King Fixed in Version => CMake 3.1
2015-04-06 09:07 Robert Maynard Note Added: 0038413
2015-04-06 09:07 Robert Maynard Status resolved => closed

Copyright © 2000 - 2018 MantisBT Team