Skip to content

Add pkg-config support to cmake #121

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

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

Conversation

FlyGoat
Copy link

@FlyGoat FlyGoat commented Jun 1, 2025

pkg-config pc file is essential for distributions. It was provided by autotools based builds but never supported properly by cmake builds.

pkg-config pc file is essential for distributions.
It was provided by autotools based builds but never supported
properly by cmake builds.
@FlyGoat FlyGoat force-pushed the cmake-pkg-config branch from f16b6ed to 6da5579 Compare June 2, 2025 13:01
Comment on lines +725 to +739
# Set compilation and linking flags for SystemC
set(PKGCONFIG_CFLAGS "")
set(PKGCONFIG_DEFINES "")
set(PKGCONFIG_LDPRIV "")

if(ENABLE_PTHREADS)
get_target_property(pthread_cflags Threads::Threads INTERFACE_COMPILE_OPTIONS)
if(pthread_cflags)
set(PKGCONFIG_CFLAGS ${PKGCONFIG_CFLAGS} ${pthread_cflags})
endif()
get_target_property(pthread_lib Threads::Threads INTERFACE_LINK_LIBRARIES)
if(pthread_lib)
set(PKGCONFIG_LDPRIV ${PKGCONFIG_LDPRIV} ${pthread_lib})
endif()
endif()
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it is better to query the target properties directly on the SystemC::systemc library to set PKGCONFIG_CFLAGS, PKGCONFIG_DEFINES, and PKGCONFIG_LDPRIV. This should ensure consistency in all cases. It should also take care on the potential transitive dependency on Pthreads.

Copy link
Author

Choose a reason for hiding this comment

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

Sorry, I attempted to implement that and found it is not possible as SystemC::systemc contains expressions that are only evaluated at GENERATE phase while configuration is done at an earlier phase.

I checked other projects, and it seems like they are all hard-coding flags.

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