From 6f00d32f7e698d4f8bd7f23c386c132a04708be2 Mon Sep 17 00:00:00 2001 From: John Freeman Date: Thu, 1 Feb 2024 18:57:29 -0600 Subject: [PATCH] fix(libxrpl): change library names in Conan recipe (#4831) Use consistent platform-agnostic library names on all platforms. Fix an issue that prevents dependents like validator-keys-tool from linking to libxrpl on Windows. It is bad practice to change the binary base name depending on the platform. CMake already manipulates the base name into a final name that fits the conventions of the platform. Linkers accept base names on the command line and then look for conventional names on disk. --- conanfile.py | 6 +++--- src/secp256k1/src/CMakeLists.txt | 13 ++++++++++--- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/conanfile.py b/conanfile.py index c789cacf568..d9e2a0ae7c4 100644 --- a/conanfile.py +++ b/conanfile.py @@ -147,9 +147,9 @@ def package(self): def package_info(self): libxrpl = self.cpp_info.components['libxrpl'] libxrpl.libs = [ - 'libxrpl_core.a', - 'libed25519.a', - 'libsecp256k1.a', + 'xrpl_core', + 'ed25519', + 'secp256k1', ] # TODO: Fix the protobufs to include each other relative to # `include/`, not `include/ripple/proto/`. diff --git a/src/secp256k1/src/CMakeLists.txt b/src/secp256k1/src/CMakeLists.txt index 93844caa7f2..dace09201f8 100644 --- a/src/secp256k1/src/CMakeLists.txt +++ b/src/secp256k1/src/CMakeLists.txt @@ -64,9 +64,16 @@ elseif(APPLE) endif() elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows") set(${PROJECT_NAME}_windows "secp256k1") - if(MSVC) - set(${PROJECT_NAME}_windows "${PROJECT_NAME}") - endif() + # This step is commented out from the original. It is bad practice to change + # the binary base name depending on the platform. CMake already manipulates + # the base name into a final name that fits the conventions of the platform. + # Linkers accept base names on the command line and then look for + # conventional names on disk. This way, developers can use base names + # everywhere (in the CMake and Conan they write) and the tools will do the + # right thing. + # if(MSVC) + # set(${PROJECT_NAME}_windows "${PROJECT_NAME}") + # endif() set_target_properties(secp256k1 PROPERTIES ARCHIVE_OUTPUT_NAME "${${PROJECT_NAME}_windows}" RUNTIME_OUTPUT_NAME "${${PROJECT_NAME}_windows}-${${PROJECT_NAME}_soversion}"