Skip to content

Commit

Permalink
Make MCL_STATIC_LIB full static
Browse files Browse the repository at this point in the history
Currently MCL_STATIC_LIB will produce static mcl::mclbn{N} targets, but
these static targets still link to the *non*-static mcl::mcl and so you
end up with a half-static result that still depends on a dynamic lib.

This fixes it to link to the mcl_st static target when MCL_STATIC_LIB is
enabled.
  • Loading branch information
jagerman authored and herumi committed May 15, 2024
1 parent d1efd49 commit 01d1a43
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,10 @@ endif()
foreach(bit IN ITEMS 256 384 384_256)
if (MCL_STATIC_LIB)
add_library(mclbn${bit} STATIC src/bn_c${bit}.cpp)
target_link_libraries(mclbn${bit} PUBLIC mcl::mcl_st)
else()
add_library(mclbn${bit} SHARED src/bn_c${bit}.cpp)
target_link_libraries(mclbn${bit} PUBLIC mcl::mcl)
endif()
add_library(mcl::mclbn${bit} ALIAS mclbn${bit})
set_target_properties(mclbn${bit} PROPERTIES
Expand All @@ -294,7 +296,6 @@ foreach(bit IN ITEMS 256 384 384_256)
target_compile_options(mclbn${bit} PRIVATE ${MCL_COMPILE_OPTIONS})
target_compile_definitions(mclbn${bit}
PUBLIC MCL_NO_AUTOLINK MCLBN_NO_AUTOLINK)
target_link_libraries(mclbn${bit} PUBLIC mcl::mcl)
set_target_properties(mclbn${bit} PROPERTIES
VERSION ${mcl_VERSION}
SOVERSION ${mcl_VERSION_MAJOR})
Expand Down

0 comments on commit 01d1a43

Please sign in to comment.