Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cmake): Fix static build #348

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

fix(cmake): Fix static build #348

wants to merge 1 commit into from

Conversation

cvonelm
Copy link
Member

@cvonelm cvonelm commented Oct 29, 2024

Some libraries were not correctly (or at all) checking for static variants if lo2s_USE_STATIC_LIBS was requested, so I fixed that.

Comment on lines 40 to 49
if(Audit_USE_STATIC_LIBS)
try_compile(BUILD_AUDIT
SOURCES "${CMAKE_CURRENT_LIST_DIR}/test_static_audit.c"
LINK_LIBRARIES ${Audit_STATIC_LIBRARIES}
COMPILE_DEFINITIONS "-static")
if(NOT BUILD_AUDIT)
set(Audit_FOUND OFF CACHE INTERNAL "")
endif()
endif()
add_library(Audit::Audit ALIAS PkgConfig::Audit)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you have to define your own target if static should be used. I'd assume PkgConfig::Audit always links the shared lib?

Comment on lines 41 to 50
if(Radare_USE_STATIC_LIBS)
try_compile(BUILD_RADARE
SOURCES "${CMAKE_CURRENT_LIST_DIR}/test_static_radare.c"
LINK_LIBRARIES ${Radare_STATIC_LIBRARIES}
COMPILE_DEFINITIONS "-static")
if(NOT BUILD_RADARE)
set(Radare_FOUND OFF CACHE INTERNAL "")
endif()
endif()
add_library(Radare::Radare ALIAS PkgConfig::Radare)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as with the audit target. you likely need your own target to link against the static libs.

Some libraries were not correctly (or at all) checking for
static variants if lo2s_USE_STATIC_LIBS was requested, so I fixed
that.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants