0

On my ubuntu 18.04 this file (https://github.com/andrewkatson/supercop/blob/main/CMakeLists.txt) works perfectly.

cmake_minimum_required(VERSION 2.8.7)
project(monero-crypto)
enable_language(ASM C)
include(intree.cmake)

add_library(monero-crypto $<TARGET_OBJECTS:monero-crypto-intree>)

INSTALL(FILES "${CMAKE_CURRENT_SOURCE_DIR}/include/monero/crypto/${MONERO_CRYPTO_LIBRARY}.h" DESTINATION "include/monero/crypto")
INSTALL(FILES "${CMAKE_BINARY_DIR}/include/monero/crypto.h" DESTINATION "include/monero")
INSTALL(TARGETS monero-crypto ARCHIVE DESTINATION lib LIBRARY DESTINATION lib)

I have also tried the original way the file was setup.

cmake_minimum_required(VERSION 2.8.7)
project(monero-crypto)
enable_language(ASM C)
include(intree.cmake)

add_library(monero-crypto $<TARGET_OBJECTS:monero-crypto-intree>)

INSTALL(FILES "${CMAKE_CURRENT_SOURCE_DIR}/include/monero/crypto/${MONERO_CRYPTO_LIBRARY}.h" DESTINATION "include/monero/crypto")
INSTALL(FILES "${CMAKE_BINARY_DIR}/include/monero/crypto.h" DESTINATION "include/monero")
INSTALL(TARGETS monero-crypto LIBRARY)

However, on a fresh ubuntu 18.04 ec2 instance this file fails with the following error

CMake Error at CMakeLists.txt:38 (INSTALL):
  INSTALL TARGETS given no ARCHIVE DESTINATION for static library target
  "monero-crypto".


-- Configuring incomplete, errors occurred!

I saw this CMAKE install TARGETS given no ARCHIVE DESTINATION but the solution is specific to them.

You have to do the following commands in that directory to reproduce

cmake .

My ubuntu has cmake version 3.16.3 the ec2 has cmake version 3.10.2

1 Answers1

0

Turns out the file needed to look like this

cmake_minimum_required(VERSION 2.8.7)
project(monero-crypto)
enable_language(ASM C)
include(intree.cmake)
include(GNUInstallDirs)
add_library(monero-crypto $<TARGET_OBJECTS:monero-crypto-intree>)

INSTALL(FILES "${CMAKE_CURRENT_SOURCE_DIR}/include/monero/crypto/${MONERO_CRYPTO_LIBRARY}.h" DESTINATION "include/monero/crypto")
INSTALL(FILES "${CMAKE_BINARY_DIR}/include/monero/crypto.h" DESTINATION "include/monero")
INSTALL(TARGETS monero-crypto ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})