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,235
    • Issues 3,235
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 14
    • Merge Requests 14
  • 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
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • CMake
  • CMakeCMake
  • Issues
  • #19644

Closed
Open
Opened Aug 26, 2019 by Marc Herbert@marc.herbert

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.

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:

# 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)
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
Reference: cmake/cmake#19644