@@ -11,15 +11,21 @@ else()
11
11
set (common_obj "" )
12
12
endif ()
13
13
14
- add_library (precomputed OBJECT
14
+ add_library (precomputed_for_shared OBJECT EXCLUDE_FROM_ALL
15
+ precomputed_ecmult.c
16
+ precomputed_ecmult_gen.c
17
+ )
18
+ set_target_properties (precomputed_for_shared PROPERTIES POSITION_INDEPENDENT_CODE TRUE )
19
+
20
+ add_library (precomputed_for_static OBJECT EXCLUDE_FROM_ALL
15
21
precomputed_ecmult.c
16
22
precomputed_ecmult_gen.c
17
23
)
18
- set (internal_obj "$<TARGET_OBJECTS:precomputed>" "${common_obj} " )
19
24
20
25
add_library (secp256k1 SHARED EXCLUDE_FROM_ALL
21
26
secp256k1.c
22
- ${internal_obj}
27
+ ${common_obj}
28
+ $<TARGET_OBJECTS:precomputed_for_shared>
23
29
)
24
30
target_include_directories (secp256k1 INTERFACE
25
31
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR} >
@@ -32,15 +38,14 @@ set_target_properties(secp256k1 PROPERTIES
32
38
SOVERSION "${${PROJECT_NAME} _LIB_VERSION_CURRENT}"
33
39
)
34
40
if (SECP256K1_BUILD_SHARED)
35
- get_target_property (use_pic secp256k1 POSITION_INDEPENDENT_CODE )
36
- set_target_properties (precomputed PROPERTIES POSITION_INDEPENDENT_CODE ${use_pic} )
37
41
set_target_properties (secp256k1 PROPERTIES EXCLUDE_FROM_ALL FALSE )
38
42
list (APPEND ${PROJECT_NAME} _installables secp256k1)
39
43
endif ()
40
44
41
45
add_library (secp256k1_static STATIC EXCLUDE_FROM_ALL
42
46
secp256k1.c
43
- ${internal_obj}
47
+ ${common_obj}
48
+ $<TARGET_OBJECTS:precomputed_for_static>
44
49
)
45
50
target_include_directories (secp256k1_static INTERFACE
46
51
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR} >
@@ -63,8 +68,10 @@ target_compile_definitions(binary_interface INTERFACE
63
68
add_library (link_library INTERFACE )
64
69
if (SECP256K1_BUILD_SHARED)
65
70
target_link_libraries (link_library INTERFACE secp256k1)
71
+ set (internal_obj "$<TARGET_OBJECTS:precomputed_for_shared>" "${common_obj} " )
66
72
elseif (SECP256K1_BUILD_STATIC)
67
73
target_link_libraries (link_library INTERFACE secp256k1_static)
74
+ set (internal_obj "$<TARGET_OBJECTS:precomputed_for_static>" "${common_obj} " )
68
75
endif ()
69
76
70
77
if (SECP256K1_BUILD_BENCHMARK)
0 commit comments