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
Use cmake helper macros #103
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Instead of having to copy-paste all of the cmake magic for finding prereqs and building our libraries and programs, lets add a handful of helper macros that encapsulate the details.
The new ENABLE_SHARED, ENABLE_SHARED_EXECUTABLES, and ENABLE_STATIC cmake flags give you full control over whether to build shared and/or static libraries, and whether to link any executables against shared libraries or static.
Enable static libraries
We need to be careful about when we're passing the `__SOURCES` variable as a list (and therefore don't want to quote it). We can't use `target_include_directories` before 2.8.12, and need to fall back on `include_directories` if it isn't available. And we have to explicitly include the file that defines `cmake_parse_arguments` on some earlier cmake versions (although I'm not sure precisely where the boundary is).
dcreager
force-pushed
the
feature/static-template
branch
from
June 26, 2015 13:41
29b389c
to
44127f9
Compare
@johnzachary ready for review |
The build rules for a library look much cleaner now! |
dcreager
force-pushed
the
feature/static-template
branch
from
June 29, 2015 14:54
44127f9
to
7cff348
Compare
As one example, the Ubuntu pkgconfig file for check includes a `-pthread` switch, which cmake doesn't pass through if we use the `_LIBRARIES` variable instead of the `_LDFLAGS` variable.
dcreager
force-pushed
the
feature/static-template
branch
from
June 29, 2015 15:03
7cff348
to
79ece7c
Compare
…c-template * template/c-template: Use all LDFLAGS when linking via pkgconfig Fix macros for cmake 2.8.7 Enable static libraries Add cmake helper macros
dcreager
force-pushed
the
feature/static-template
branch
from
June 30, 2015 15:25
79ece7c
to
67ebf2b
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The C template now provides helper macros that define all of our cmake rules for building libraries and executables. This patch updates our build scripts to use them.