Static library command line has "ar"-specific "cr" flag for assembler language
As of CMake 3.23, CMAKE_ASM${ASM_DIALECT}_CREATE_STATIC_LIBRARY
contains an option "cr", which likely belongs to the GNU-specific "ar" archiver tool. For this reason, creation of static library out of only ASM (for example, in NASM dialect) files does not work on Windows:
# /mnt/c/Program Files/CMake/share/cmake-3.23/Modules/CMakeASMInformation.cmake
if(NOT CMAKE_ASM${ASM_DIALECT}_CREATE_STATIC_LIBRARY)
set(CMAKE_ASM${ASM_DIALECT}_CREATE_STATIC_LIBRARY
"<CMAKE_AR> cr <TARGET> <LINK_FLAGS> <OBJECTS> "
"<CMAKE_RANLIB> <TARGET>")
endif()
One trivial workaround on the user side is to enforce the linker language to be some other than ASM, for example C:
set_target_properties(${tgt} PROPERTIES LINKER_LANGUAGE C)
Edited by Dmitry Mikushin