-
Notifications
You must be signed in to change notification settings - Fork 270
cmake : Add install target to support consuming WIL through cmake. #137
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
Conversation
| cmake_minimum_required(VERSION 3.11) | ||
| project(WIL) | ||
|
|
||
| include(GNUInstallDirs) |
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.
Required by install.
| endif() | ||
|
|
||
| # Gather headers into an interface library. | ||
| file(GLOB_RECURSE HEADER_FILES "${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/*.h") |
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.
Adds the INTERFACE target.
| file(GLOB_RECURSE HEADER_FILES "${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/*.h") | ||
| add_library(${PROJECT_NAME} INTERFACE) | ||
|
|
||
| # The interface's include directory. |
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.
The following installs all cmake required files to find the library.
| @@ -1,8 +1,8 @@ | |||
|
|
|||
| include(${CMAKE_SOURCE_DIR}/cmake/common_build_flags.cmake) | |||
| include(${PROJECT_SOURCE_DIR}/cmake/common_build_flags.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.
PROJECT_SOURCE_DIR is required when running through ExternalProject or FetchContent.
These changes allow a user to install WIL using cmake and consume it through available cmake mechanisms like
find_package,ExternalProject_AddorFetchContent.You can install it locally using the following command :
INTERFACEtarget for the headers.Unit tests were ran and passed.