No CMAKE_ASM_COMPILER could be found with MSVC 2015 on project( ASM )
With the CMake 3.10 GUI and generator "Visual Studio 14 2015 Win64" I configure libpng.
An error occurs: No CMAKE_ASM_COMPILER could be found
The ASM compiler identification is unknown Didn't find assembler CMake Error at CMakeLists.txt:34 (project): No CMAKE_ASM_COMPILER could be found Warning: Did not find file Compiler/-ASM Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe -- works Detecting C compiler ABI info Detecting C compiler ABI info - done Configuring incomplete, errors occurred!
The project(libpng ASM C)
line fails.
For a very similar case see http://cmake.3232098.n2.nabble.com/project-with-ASM-fails-with-MSVC-19-td7596299.html
As suggested there by Robert Maynard I tried to use
project(libpng ASM_MASM C)
instead. I get
The ASM_MASM compiler identification is unknown Found assembler: ml64 The C compiler identification is MSVC 19.0.24215.1 Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe -- works Detecting C compiler ABI info Detecting C compiler ABI info - done
and CMake runs through.
Another suggestion by Petr Kmoch is leaving ASM out in project but using enable_language.
Using
project(libpng C)
enable_language( ASM )
gives
The C compiler identification is MSVC 19.0.24215.1 Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe -- works Detecting C compiler ABI info Detecting C compiler ABI info - done The ASM compiler identification is MSVC Found assembler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe Warning: Did not find file Compiler/MSVC-ASM
Not sure if the assembler compiler is really found there.
Finally using CMake 3.10 from a Visual Studio 2015 Command Prompt:
cmake.exe -G "Visual Studio 14 2015 Win64" source_folder
gives
-- The ASM compiler identification is MSVC -- Found assembler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe -- The C compiler identification is MSVC 19.0.24215.1 -- Warning: Did not find file Compiler/MSVC-ASM
So, what is going on?
Is the CMake in the libpng repository be correct or does it need to be changed?
Is there a problem with CMake? If so, what would be the recommended workaround?
If I use the command line version from the developer prompt which only prints out a warning, not an error, did it find the assembler?
Very probably (see linked discussion) the same problem exists for MSVC 2017. I have both installed.