Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
CMake
CMake
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,187
    • Issues 3,187
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 15
    • Merge Requests 15
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • CI / CD
    • Repository
    • Value Stream
  • External Wiki
    • External Wiki
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • CMake
  • CMakeCMake
  • Issues
  • #18912

Closed
Open
Opened Feb 12, 2019 by Wil Stark@wilstarkDeveloper

Compiling ASM source does not work with Visual Studio compiler, VS project or NMake

This code:

cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
project(TestAsm C ASM)
file(WRITE ${CMAKE_BINARY_DIR}/test.s "; Test ASM file\n")
file(WRITE ${CMAKE_BINARY_DIR}/main.c "// Main\nint main(int argc, char* argv[])\n{}\n")

add_executable(myprog test.s main.c)

results in this with the VS10 generator (VS12):

  <ItemGroup>
    <None Include="C:\TEMP\test\cmake_multi\VS12\test.s" />
    <ClCompile Include="C:\TEMP\test\cmake_multi\VS12\main.c" />
  </ItemGroup>

The VS project lists test.s as "no action" for compiling, rather than assembling with MASM.

When using NMake (using a VS15 command shell), the build prints out:

[ 33%] Building ASM object CMakeFiles/myprog.dir/test.s.obj
Microsoft (R) C/C++ Optimizing Compiler Version 19.15.26730 for x86
Copyright (C) Microsoft Corporation.  All rights reserved.

cl : Command line warning D9035 : option 'o' has been deprecated and will be removed in a future release
cl : Command line warning D9024 : unrecognized source file type 'C:\TEMP\test\cmake_multi\NMake15\test.s', object file assumed
cl : Command line warning D9027 : source file 'C:\TEMP\test\cmake_multi\NMake15\test.s' ignored
cl : Command line warning D9021 : no action performed
[ 66%] Building C object CMakeFiles/myprog.dir/main.c.obj
main.c

It appears to be trying to compile test.s with cl.exe and failing. VS will use ml.exe as the assember, or for WindowsCE (WEC2013) targeting ARM, it will use armasm.exe. So... CMake is not detecting and using these assemblers?

This was using cmake 3.13.0-rc1 on Win10/x64.

Edited Feb 12, 2019 by Wil Stark
To upload designs, you'll need to enable LFS and have admin enable hashed storage. More information
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
Reference: cmake/cmake#18912