-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
[WIP] CMake Install rule proposal #182
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
## absl CMake configuration file | ||
|
||
set(ABSL_VERSION @PROJECT_VERSION@) | ||
|
||
@PACKAGE_INIT@ | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would be nice to have more meta data here, e.g. set_and_check(@PROJECT_NAME@_HOME "${PACKAGE_PREFIX_DIR}")
set_and_check(@PROJECT_NAME@_INCLUDEDIR "${PACKAGE_PREFIX_DIR}/@CMAKE_INSTALL_INCLUDEDIR@")
set_and_check(@PROJECT_NAME@_LIBDIR "${PACKAGE_PREFIX_DIR}/@CMAKE_INSTALL_LIBDIR@")
set(@PROJECT_NAME@_TARGETS absl::* absl::*_internal)
set(@PROJECT_NAME@_PUBLIC_TARGETS absl::*)
set(@PROJECT_NAME@_PRIVATE_TARGETS absl::*_internal) The paths may be extracted from the target properties, but experience shows, it is nicer to have them at hand in a convenient variable ( The entries in the proposed target lists could e.g. easily be collected in the Note: Note: If you decide to export a path via |
||
include ("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake") |
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.
To support shared libraries (Please ignore, if this is not a desired feature at all):
The user can now choose between static and shared libraries via
-DBUILD_SHARED_LIBS=ON/OFF
. For good practice, you may want to explicitely declare this build switch with an explicit default viaoption()
. Without declaring it as an option, the default isOFF
(=> static).Because there are library dependencies within the
absl
package, it is recommended to add relativeRPATH
entries for relocatability. Here is a snippet how we usually add such entries on Linux and MacOS: