Generation fails for ASM-only project (linux, gcc, x86_64)
Likely related to:
https://discourse.cmake.org/t/building-lib-file-from-asm-cmake-bug/1959
$ lsb_release -d
Description: Linux Mint 20
$ gcc --version
gcc (Ubuntu 10.2.0-5ubuntu1~20.04) 10.2.0
$ cmake --version
cmake version 3.19.0
CMake suite maintained and supported by Kitware (kitware.com/cmake).
I have a simple "Hello, world!" x86_64 ASM project with one file, test.S.
CMakeLists.txt
cmake_minimum_required(VERSION 3.18)
project(asm_test ASM)
add_library(test SHARED test.S)
Generation fails.
$ cmake
-- The C compiler identification is GNU 10.2.0
-- The ASM compiler identification is GNU
-- Found assembler: /usr/bin/gcc-10
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/gcc-10 - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Configuring done
CMake Error: Error required internal CMake variable not set, cmake may not be built correctly.
Missing variable is:
CMAKE_ASM_CREATE_SHARED_LIBRARY
-- Generating done
CMake Generate step failed. Build files cannot be regenerated correctly.
Add an empty C-language file to my project.
$ touch empty.c
CMakeLists.txt
cmake_minimum_required(VERSION 3.18)
project(asm_test C ASM)
add_library(test SHARED test.S empty.c)
Generation succeeds, and the build is correct.
$ cmake ..
-- The C compiler identification is GNU 10.2.0
-- The ASM compiler identification is GNU
-- Found assembler: /usr/bin/gcc-10
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/gcc-10 - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /home/tim/Downloads/asm_test/build
$ make
Scanning dependencies of target test
[ 33%] Building ASM object CMakeFiles/test.dir/test.S.o
[ 66%] Building C object CMakeFiles/test.dir/empty.c.o
[100%] Linking C shared library libtest.so
[100%] Built target test
This is slightly different from #18889 where the indication was that there are missing variable exports in Modules/CMakeASMInformation.cmake
for creating archive files. Is this just more missing information from that file? If so, is there interest in updating that? I'd be willing to throw in some time to make it happen.
Edited by Tim Haines