CMake issueshttps://gitlab.kitware.com/cmake/cmake/-/issues2017-10-13T13:17:55-04:00https://gitlab.kitware.com/cmake/cmake/-/issues/16546VS: Cannot compile two `.asm` files with the same name2017-10-13T13:17:55-04:00Egor PuginVS: Cannot compile two `.asm` files with the same nameHi,
There's some mess with generated Object File property in VS solution for .asm files. The repro is in archive.
Unpack, then run:
```
mkdir win32 && cd win32 && cmake .. && cmake --build .
```
I see:
```
CustomBuild:
B...Hi,
There's some mess with generated Object File property in VS solution for .asm files. The repro is in archive.
Unpack, then run:
```
mkdir win32 && cd win32 && cmake .. && cmake --build .
```
I see:
```
CustomBuild:
Building Custom Rule H:/Temp/101/CMakeLists.txt
CMake does not need to re-run because H:\Temp\101\win32\CMakeFiles\generate.stamp is up-to-date.
_MASM:
Assembling H:\Temp\101\1.asm...
cmd.exe /C "C:\Users\egor\AppData\Local\Temp\tmp5dd0185685ca4204854801f7d64c5345.cmd"
ml.exe /c /nologo /Zi /Fo"x.dir\Debug\/1.obj" /D"_M_X86" /D"CMAKE_INTDIR="Debug"" /W3 /errorReport:prompt /safeseh /TaH:\Temp\101\1.asm
_MASM:
Assembling H:\Temp\101\b3e3654a.dir\1.asm...
cmd.exe /C "C:\Users\egor\AppData\Local\Temp\tmp9593c5d4a3f34d2baea0f10f674db120.cmd"
ml.exe /c /nologo /Zi /Fo"x.dir\Debug\/b3e3654a.dir/1.obj" /D"_M_X86" /D"CMAKE_INTDIR="Debug"" /W3 /errorReport:prompt /safeseh /TaH:\Temp\101\b3
e3654a.dir\1.asm
H:\Temp\101\b3e3654a.dir\1.asm(1): fatal error A1000: cannot open file : x.dir\Debug\/b3e365a. [H:\Temp\101\win32\x.vcxproj]
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\BuildCustomizations\masm.targets(50,5): error MSB3721: The command "ml.exe /c /nologo /Zi /Fo"
x.dir\Debug\/b3e3654a.dir/1.obj" /D"_M_X86" /D"CMAKE_INTDIR="Debug"" /W3 /errorReport:prompt /safeseh /TaH:\Temp\101\b3e3654a.dir\1.asm" exited wit
h code 1. [H:\Temp\101\win32\x.vcxproj]
Done Building Project "H:\Temp\101\win32\x.vcxproj" (default targets) -- FAILED.
```
`/Fo` option for the second file (under tricky dir) is completely broken! `/Fo"x.dir\Debug\/b3e3654a.dir/1.obj"`
```
H:\Temp\101\b3e3654a.dir\1.asm(1): fatal error A1000: cannot open file : x.dir\Debug\/b3e365a.
```
[asm_repro.zip](/uploads/5ea1b29b6e4912426e3370b1e4470dab/asm_repro.zip)https://gitlab.kitware.com/cmake/cmake/-/issues/15617When assembler is enabled TI Compiler might end up with wrong archiver2017-10-13T13:17:56-04:00Kitware RobotWhen assembler is enabled TI Compiler might end up with wrong archiverThis issue was created automatically from an original [Mantis Issue](https://cmake.org/Bug/view.php?id=15617). Further discussion may take place here.This issue was created automatically from an original [Mantis Issue](https://cmake.org/Bug/view.php?id=15617). Further discussion may take place here.https://gitlab.kitware.com/cmake/cmake/-/issues/15974Some cmake variables not set for gas assembler2017-10-13T13:17:56-04:00Kitware RobotSome cmake variables not set for gas assemblerThis issue was created automatically from an original [Mantis Issue](https://cmake.org/Bug/view.php?id=15974). Further discussion may take place here.This issue was created automatically from an original [Mantis Issue](https://cmake.org/Bug/view.php?id=15974). Further discussion may take place here.https://gitlab.kitware.com/cmake/cmake/-/issues/15538set_property(SOURCE ) not working for MASM assembly files within Visual Studi...2017-10-13T13:17:56-04:00Kitware Robotset_property(SOURCE ) not working for MASM assembly files within Visual Studio 2014 generatorThis issue was created automatically from an original [Mantis Issue](https://cmake.org/Bug/view.php?id=15538). Further discussion may take place here.This issue was created automatically from an original [Mantis Issue](https://cmake.org/Bug/view.php?id=15538). Further discussion may take place here.https://gitlab.kitware.com/cmake/cmake/-/issues/15973ASM-ATT: cannot set assembler using environment variable2017-10-13T13:17:56-04:00Kitware RobotASM-ATT: cannot set assembler using environment variableThis issue was created automatically from an original [Mantis Issue](https://cmake.org/Bug/view.php?id=15973). Further discussion may take place here.This issue was created automatically from an original [Mantis Issue](https://cmake.org/Bug/view.php?id=15973). Further discussion may take place here.https://gitlab.kitware.com/cmake/cmake/-/issues/14711CMAKE_ASM_MASM_FLAGS and CMAKE_ASM_MASM_FLAGS_xx have no effect2017-10-13T13:17:57-04:00Kitware RobotCMAKE_ASM_MASM_FLAGS and CMAKE_ASM_MASM_FLAGS_xx have no effectThis issue was created automatically from an original [Mantis Issue](https://cmake.org/Bug/view.php?id=14711). Further discussion may take place here.This issue was created automatically from an original [Mantis Issue](https://cmake.org/Bug/view.php?id=14711). Further discussion may take place here.https://gitlab.kitware.com/cmake/cmake/-/issues/14652Ninja generator add ASM file with wrong deps2017-10-13T13:18:30-04:00Kitware RobotNinja generator add ASM file with wrong depsThis issue was created automatically from an original [Mantis Issue](https://cmake.org/Bug/view.php?id=14652). Further discussion may take place here.This issue was created automatically from an original [Mantis Issue](https://cmake.org/Bug/view.php?id=14652). Further discussion may take place here.https://gitlab.kitware.com/cmake/cmake/-/issues/13275Assembly source files are not recognized by Xcode 4.3.2 due to lastKnownFileType2017-10-13T13:18:31-04:00Kitware RobotAssembly source files are not recognized by Xcode 4.3.2 due to lastKnownFileTypeThis issue was created automatically from an original [Mantis Issue](https://cmake.org/Bug/view.php?id=13275). Further discussion may take place here.This issue was created automatically from an original [Mantis Issue](https://cmake.org/Bug/view.php?id=13275). Further discussion may take place here.https://gitlab.kitware.com/cmake/cmake/-/issues/13584Framework include directories propagate to other build tools2017-10-13T13:18:31-04:00Kitware RobotFramework include directories propagate to other build toolsThis issue was created automatically from an original [Mantis Issue](https://cmake.org/Bug/view.php?id=13584). Further discussion may take place here.This issue was created automatically from an original [Mantis Issue](https://cmake.org/Bug/view.php?id=13584). Further discussion may take place here.https://gitlab.kitware.com/cmake/cmake/-/issues/12951Assembly preprocessor definition support in VS IDE generators2017-10-13T13:18:31-04:00Kitware RobotAssembly preprocessor definition support in VS IDE generatorsThis issue was created automatically from an original [Mantis Issue](https://cmake.org/Bug/view.php?id=12951). Further discussion may take place here.This issue was created automatically from an original [Mantis Issue](https://cmake.org/Bug/view.php?id=12951). Further discussion may take place here.https://gitlab.kitware.com/cmake/cmake/-/issues/15819CMake / Assembler header .ah file is not visibile2018-04-28T09:16:20-04:00Kitware RobotCMake / Assembler header .ah file is not visibileThis issue was created automatically from an original [Mantis Issue](https://cmake.org/Bug/view.php?id=15819). Further discussion may take place here.This issue was created automatically from an original [Mantis Issue](https://cmake.org/Bug/view.php?id=15819). Further discussion may take place here.https://gitlab.kitware.com/cmake/cmake/-/issues/15818The variable CMAKE_ASM_OUTPUT_EXTENSION is ignored when creating a compiled file2018-04-28T09:16:20-04:00Kitware RobotThe variable CMAKE_ASM_OUTPUT_EXTENSION is ignored when creating a compiled fileThis issue was created automatically from an original [Mantis Issue](https://cmake.org/Bug/view.php?id=15818). Further discussion may take place here.This issue was created automatically from an original [Mantis Issue](https://cmake.org/Bug/view.php?id=15818). Further discussion may take place here.https://gitlab.kitware.com/cmake/cmake/-/issues/10848Issue with space in paths used for <OBJECT> and <SOURCE> in CMAKE_ASM2018-04-28T09:16:22-04:00Kitware RobotIssue with space in paths used for <OBJECT> and <SOURCE> in CMAKE_ASMThis issue was created automatically from an original [Mantis Issue](https://cmake.org/Bug/view.php?id=10848). Further discussion may take place here.This issue was created automatically from an original [Mantis Issue](https://cmake.org/Bug/view.php?id=10848). Further discussion may take place here.https://gitlab.kitware.com/cmake/cmake/-/issues/18912Compiling ASM source does not work with Visual Studio compiler, VS project or...2019-02-14T15:58:12-05:00Wil StarkCompiling ASM source does not work with Visual Studio compiler, VS project or NMakeThis code:
```cmake
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...This code:
```cmake
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):
```xml
<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.https://gitlab.kitware.com/cmake/cmake/-/issues/19014Add NASM support in Xcode Generator2019-06-21T12:29:27-04:00Harry MallonAdd NASM support in Xcode GeneratorSpun out from https://gitlab.kitware.com/cmake/cmake/issues/16469#note_531760
Xcode generator does not support using NASM sources correctly (it is possible to work around with custom stuff). Native support would be great.
Specific exam...Spun out from https://gitlab.kitware.com/cmake/cmake/issues/16469#note_531760
Xcode generator does not support using NASM sources correctly (it is possible to work around with custom stuff). Native support would be great.
Specific example is libjpeg-turbo https://github.com/libjpeg-turbo/libjpeg-turboGregor JasnyGregor Jasnyhttps://gitlab.kitware.com/cmake/cmake/-/issues/19644CMAKE_ASM_ARCHIVE_CREATE, _APPEND and _FINISH are silently ignored2019-08-27T09:23:06-04:00Marc HerbertCMAKE_ASM_ARCHIVE_CREATE, _APPEND and _FINISH are silently ignoredhttps://cmake.org/cmake/help/v3.14/variable/CMAKE_LANG_ARCHIVE_CREATE.html doesn't treat ASM differently from C and C++ and doesn't say CMAKE_ASM_ARCHIVE_CREATE is missing. However defining CMAKE_ASM_ARCHIVE_CREATE and friends is silent...https://cmake.org/cmake/help/v3.14/variable/CMAKE_LANG_ARCHIVE_CREATE.html doesn't treat ASM differently from C and C++ and doesn't say CMAKE_ASM_ARCHIVE_CREATE is missing. However defining CMAKE_ASM_ARCHIVE_CREATE and friends is silently ignored.
Comparing [/usr/share/cmake/Modules/] CMakeASMInformation.cmake with CMakeCInformation.cmake and CMakeCXXInformation.cmake in version 3.14, one can see that CMAKE_ASM_ARCHIVE_CREATE and friends simply don't exist.
Maybe _ASM is different by design and this Works As Intended? In such a case please consider as a missing documentation bug.
Workarounds:
- Add at least one (empty) C file to add_library(): `add_library(a.s b.S ... empty.c)` and use `CMAKE_C_ARCHIVE_CREATE` instead. See tested example at https://github.com/zephyrproject-rtos/zephyr/pull/17632/
- Provide the entire, higher level `CMAKE_ASM_CREATE_STATIC_LIBRARY` function instead. This runs into other issues, see #19474
Test code for quick reproduction:
```cmake
# Test with:
#
# rm -rf build/; cmake -B build && make -C build VERBOSE=1 mylib
cmake_minimum_required(VERSION 3.14)
project(assembly_lib ASM C)
add_library(mylib STATIC hello_main.S)
# Documented at
# https://cmake.org/cmake/help/v3.14/variable/CMAKE_LANG_ARCHIVE_CREATE.html
# but not implemented in Modules/CMakeASMInformation.cmake and silently ignored.
SET(CMAKE_ASM_ARCHIVE_CREATE
"<CMAKE_AR> qc -should_fail_but_ignored <TARGET> <LINK_FLAGS> <OBJECTS>")
# Optional, just in case you want to actually run the code.
# add_executable(myexe something.c) # something.c can be empty too
# target_link_libraries(myexe mylib)
```https://gitlab.kitware.com/cmake/cmake/-/issues/20738VS: ASM_MASM not fully implemented by Visual Studio generators2020-05-22T06:28:25-04:00Sam EdgeVS: ASM_MASM not fully implemented by Visual Studio generatorsTrying to compile a `.asm` file against MSVC 9.0. It's an older project that's locked to this toolchain. By design, this particular `.asm` may only be compiled on x64 platforms.
Here is my minimal CMakeLists.txt:
```
cmake_minimum_requi...Trying to compile a `.asm` file against MSVC 9.0. It's an older project that's locked to this toolchain. By design, this particular `.asm` may only be compiled on x64 platforms.
Here is my minimal CMakeLists.txt:
```
cmake_minimum_required(VERSION 3.17)
project(TestMASM)
enable_language(ASM_MASM)
add_library(Common winos_x64.asm)
```
Make phase:
```
mkdir build
cd build
cmake -G "Visual Studio 9 2008" -A x64 ..\source
-- The C compiler identification is MSVC 15.0.21022.8
-- The CXX compiler identification is MSVC 15.0.21022.8
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 9.0/VC/bin/x86_amd64/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 9.0/VC/bin/x86_amd64/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 9.0/VC/bin/x86_amd64/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 9.0/VC/bin/x86_amd64/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- The ASM_MASM compiler identification is MSVC
-- Found assembler: C:/Program Files (x86)/Microsoft Visual Studio 9.0/VC/bin/x86_amd64/ml64.exe
-- Configuring done
-- Generating done
-- Build files have been written to: xxx
```
It has correctly detected the `ml64` ASM compiler. This is also verified in `CMakeCache.txt`:
```
########################
# EXTERNAL cache entries
########################
//ASM_MASM compiler
CMAKE_ASM_MASM_COMPILER:FILEPATH=C:/Program Files (x86)/Microsoft Visual Studio 9.0/VC/bin/x86_amd64/ml64.exe
```
However, the build phase fails because the `ml.exe` is somehow used in place of `ml64.exe`.
```
Build Log
Build started: Project: Common, Configuration: Release|x64
Command Lines
Creating temporary file "xxx\Release\BAT00000144169512.bat" with contents
[
@echo off
ml.exe /c /nologo /Fo"\Release\winos_x64.obj" /D"CMAKE_INTDIR=\"Release\"" /W3 /Zi /errorReport:prompt /Ta..\source\winos_x64.asm
if errorlevel 1 goto VCReportError
goto VCEnd
:VCReportError
echo Project : error PRJ0019: A tool returned an error code from "Assembling..."
exit 1
:VCEnd
]
Creating command line "xxx\Release\BAT00000144169512.bat"
Output Window
Assembling...
Assembling: ..\source\winos_x64.asm
..\source\Common\winos_x64.asm(4) : error A2013:.MODEL must precede this directive
..\source\Common\winos_x64.asm(6) : error A2034:must be in segment block
..\source\Common\winos_x64.asm(7) : error A2034:must be in segment block : cpuid64
..\source\Common\winos_x64.asm(10) : error A2034:must be in segment block
..\source\Common\winos_x64.asm(11) : error A2008:syntax error : .
..\source\Common\winos_x64.asm(12) : error A2034:must be in segment block
..\source\Common\winos_x64.asm(13) : error A2008:syntax error : .
..\source\Common\winos_x64.asm(14) : error A2008:syntax error : .
..\source\Common\winos_x64.asm(16) : error A2034:must be in segment block
..\source\Common\winos_x64.asm(17) : error A2085:instruction or register not accepted in current CPU mode
..\source\Common\winos_x64.asm(18) : error A2085:instruction or register not accepted in current CPU mode
..\source\Common\winos_x64.asm(19) : error A2085:instruction or register not accepted in current CPU mode
..\source\Common\winos_x64.asm(20) : error A2085:instruction or register not accepted in current CPU mode
..\source\Common\winos_x64.asm(21) : error A2085:instruction or register not accepted in current CPU mode
..\source\Common\winos_x64.asm(22) : error A2085:instruction or register not accepted in current CPU mode
..\source\Common\winos_x64.asm(23) : error A2085:instruction or register not accepted in current CPU mode
..\source\Common\winos_x64.asm(25) : error A2034:must be in segment block
..\source\Common\winos_x64.asm(26) : error A2034:must be in segment block
..\source\Common\winos_x64.asm(28) : error A2034:must be in segment block
..\source\Common\winos_x64.asm(29) : error A2034:must be in segment block
..\source\Common\winos_x64.asm(30) : fatal error A1010:unmatched block nesting : cpuid64
Project : error PRJ0019: A tool returned an error code from "Assembling..."
```
As you can see, the generated .BAT has elected to use `ml.exe` instead of `ml64.exe`. The CMake variables all align with a x64 configuration.
I've isolated problem to MSVC 9.0 (Visual Studio 2008) projects.
I generated solutions for the latest Visual Studio 2019 and it works correctly.https://gitlab.kitware.com/cmake/cmake/-/issues/20426ASM: No include dependecies tracking for the source files2020-08-08T14:01:40-04:00Sergey BelyashovASM: No include dependecies tracking for the source filesMy project is written on assembler. There is no C compiler for target architecture. I try to build project by CMake, but have an issue: CMake does not track `.include` and `.incbin` directives (of GNU Assembler) in the sources. GNU Assem...My project is written on assembler. There is no C compiler for target architecture. I try to build project by CMake, but have an issue: CMake does not track `.include` and `.incbin` directives (of GNU Assembler) in the sources. GNU Assembler have support for `-MD <file>` option which generates dependency file. But it is not used by CMake. Moreover, I found ASM.includechache file in the build directory. It contains:
```
#IncludeRegexLine: ^[ ]*[#%][ ]*(include|import)[ ]*[<"]([^">]+)([">])
#IncludeRegexScan: ^.*$
#IncludeRegexComplain: ^$
#IncludeRegexTransform:
/home/user/test.s
```
It is incorrect for assembler.
I try found which module generate this file, but nothing found.
I attach simple test case for the issue. To reproduce:
1. Unpack, configure and build
2. Change test.inc and build again.
Expected: target is rebuilt
Actual: no second build is done.
[test.s](/uploads/81fb53e0de1f91f8cb9162e0b9cb438b/test.s)
[test.inc](/uploads/309915a20eed86d581e50ee89d8fd560/test.inc)
[CMakeLists.txt](/uploads/ebb8511fe0e29384dd0d0630e422595a/CMakeLists.txt)https://gitlab.kitware.com/cmake/cmake/-/issues/21877ASM_NASM: Incorrect command line argument style when using MSVC2021-03-04T12:09:17-05:00Francesco BertolacciniASM_NASM: Incorrect command line argument style when using MSVCOn Windows using MSVC, a simple project such as this one:
```
cmake_minimum_required(VERSION 3.16.0)
project(test VERSION 1.0.0 LANGUAGES C CXX ASM_NASM)
add_library(test STATIC test.asm)
```
fails to link because during the linking ...On Windows using MSVC, a simple project such as this one:
```
cmake_minimum_required(VERSION 3.16.0)
project(test VERSION 1.0.0 LANGUAGES C CXX ASM_NASM)
add_library(test STATIC test.asm)
```
fails to link because during the linking step `link.exe` is called with GNU-style arguments (e.g. `link` complains about not being able to find `cr`)
Additionally, when not specifying `C` or `CXX` languages, building using Ninja fails because no linker is found.https://gitlab.kitware.com/cmake/cmake/-/issues/19178VS/ASM_MASM: sources not getting compile definitions added via target_compile...2021-04-19T10:03:59-04:00Alastair HolmesVS/ASM_MASM: sources not getting compile definitions added via target_compile_definitions()The source file 'test.asm' doesn't get the compiled with the compile definition 'LANG_IS_MASM' in the following CMake:
```
cmake_minimum_required(VERSION 3.14)
project("problem")
enable_language(ASM_MASM)
add_library(Problem STATIC "te...The source file 'test.asm' doesn't get the compiled with the compile definition 'LANG_IS_MASM' in the following CMake:
```
cmake_minimum_required(VERSION 3.14)
project("problem")
enable_language(ASM_MASM)
add_library(Problem STATIC "test.asm")
target_compile_definitions(Problem PRIVATE "MY_MASM_DEFINITION")
```
Using VS 15 2017 Generator
Also even if set like this: `set(CMAKE_ASM_MASM_FLAGS "/DMY_MASM_DEFINITION" ${CMAKE_ASM_MASM_FLAGS})`. It is still isn't compiled with the definitions, but if I do this instead `set(CMAKE_ASM_MASM_FLAGS "MY_FAKE_FLAG" ${CMAKE_ASM_MASM_FLAGS})`, 'MY_FAKE_FLAG' does get passed to the compiler.
I am also seeing the same problem using `set_target_properties`.
Using `set_target_properties(Problem PROPERTIES COMPILE_DEFINITIONS "MY_MASM_DEFINITION")` to set the compile definition does seem to work.
Edit:
I tried this also with ASM_NASM and the same issue exists.