CMAKE_ASM_ARCHIVE_CREATE, _APPEND and _FINISH are silently ignored
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.
- Add at least one (empty) C file to add_library():
add_library(a.s b.S ... empty.c)and use
CMAKE_C_ARCHIVE_CREATEinstead. See tested example at https://github.com/zephyrproject-rtos/zephyr/pull/17632/
- Provide the entire, higher level
CMAKE_ASM_CREATE_STATIC_LIBRARYfunction instead. This runs into other issues, see #19474
Test code for quick reproduction:
# 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)