diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index bed1b53303..291e0cbb8b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -54,6 +54,11 @@ add_library(secp256k1_precomputed OBJECT EXCLUDE_FROM_ALL # from being exported. target_sources(secp256k1 PRIVATE secp256k1.c $) +# Create a helper lib that parent projects can use to link secp256k1 into a +# static lib. +add_library(secp256k1_objs INTERFACE) +target_sources(secp256k1_objs INTERFACE $ $) + add_library(secp256k1_asm INTERFACE) if(SECP256K1_ASM STREQUAL "arm32") add_library(secp256k1_asm_arm OBJECT EXCLUDE_FROM_ALL) @@ -61,6 +66,7 @@ if(SECP256K1_ASM STREQUAL "arm32") asm/field_10x26_arm.s ) target_sources(secp256k1 PRIVATE $) + target_sources(secp256k1_objs INTERFACE $) target_link_libraries(secp256k1_asm INTERFACE secp256k1_asm_arm) endif() @@ -75,10 +81,13 @@ endif() get_target_property(use_pic secp256k1 POSITION_INDEPENDENT_CODE) set_target_properties(secp256k1_precomputed PROPERTIES POSITION_INDEPENDENT_CODE ${use_pic}) +# Add the include path for parent projects so that they don't have to manually add it. target_include_directories(secp256k1 INTERFACE - # Add the include path for parent projects so that they don't have to manually add it. $>:${PROJECT_SOURCE_DIR}/include>> ) +set_target_properties(secp256k1_objs PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "$" +) # This emulates Libtool to make sure Libtool and CMake agree on the ABI version, # see below "Calculate the version variables" in build-aux/ltmain.sh.