-
-
Notifications
You must be signed in to change notification settings - Fork 493
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 demo compile issues due to CMake issues finding threading library #1399
base: main
Are you sure you want to change the base?
Conversation
Tested manually on Windows 10 and, assuming the nng library is available for CMake to find, the addition of |
This doesn't feel right. I would have expected that the required threads library would have been pulled in via the nng library. What version of cmake were you using? |
Maybe we need to have the include for FindThreads in the code that is imported. Folks using this library shouldn't have to worry about any of this. |
I think we should probably just add FindThreads to the nng-config.cmake.in file. |
Should the demos be building when someone builds the library? Or are you saying the demos should be able to build relying on the local library source? |
Demos should be able to be built as if they were out of tree -- they represent an example for consumers. I should probably work up a CI/CD recipe to ensure that demos are buildable at least... |
I can probably fix this properly if you prefer -- I've already looked at what is needed. But if you want to work the issue I'm happy to leave it in your hands as well. |
I’ll take a stab at it. Need to brush up on CMake. |
6ed1113
to
911cbbc
Compare
The generated nng-config.cmake file wasn't including dependencies (like Threads) causing the demos to not build properly on systems relying on pthreads. Version info was also not being populated, but it seems that's been the case for at least the last release.
911cbbc
to
1996e7c
Compare
set(NNG_VERSION_MAJOR "@NNG_VERSION_MAJOR@") | ||
set(NNG_VERSION_MINOR "@NNG_VERSION_MINOR@") | ||
set(NNG_VERSION_PATCH "@NNG_VERSION_PATCH@") | ||
set(NNG_VERSION_MAJOR "@NNG_MAJOR_VERSION@") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These haven't been populating properly for quite some time. I'm not sure if it's useful having these properties or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LOl. :-)
@gdamore this approach seems to be working for me in my limited testing, at least making it so the demos build without modification. Question though: what optional external dependencies should be potentially included in the |
The demos weren't using the CMake FindThreads module to properly identify the threading library for use, which caused both CMake warnings like:
And resulted in broken builds where (at least on pthread-based platforms), bogus library args were being passed to the C compiler (
-lThreads::Threads
):This updates each demo to include the FindThreads to resolve both the warning and the broken builds.
Note: While in here, I also bumped the CMake version required to match the nng library itself.