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

Use cmake helper macros #103

Merged
merged 6 commits into from Jun 30, 2015
Merged

Use cmake helper macros #103

merged 6 commits into from Jun 30, 2015

Conversation

dcreager
Copy link
Owner

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.

Douglas Creager added 4 commits June 25, 2015 14:39
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.
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
Copy link
Owner Author

@johnzachary ready for review

@dcreager
Copy link
Owner Author

The build rules for a library look much cleaner now!

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.
…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 pushed a commit that referenced this pull request Jun 30, 2015
@dcreager dcreager merged commit 26729a4 into develop Jun 30, 2015
@dcreager dcreager deleted the feature/static-template branch June 30, 2015 18:00
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.

None yet

1 participant