-
Notifications
You must be signed in to change notification settings - Fork 132
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
[cmake] adding a target install #182
Conversation
@paoloambrosio, @muggenhor or @konserw : could you please review the pull request ? |
3887d2c
to
8076700
Compare
8076700
to
116615b
Compare
CMakeLists.txt
Outdated
@@ -188,9 +188,13 @@ endif() | |||
# | |||
# Cucumber-Cpp | |||
# | |||
set (CMAKE_INSTALL_INCLUDEDIR "${CMAKE_INSTALL_PREFIX}") | |||
set (CMAKE_INSTALL_LIBDIR "${CMAKE_INSTALL_PREFIX}/lib") | |||
set (CMAKE_INSTALL_BINDIR "${CMAKE_INSTALL_PREFIX}/bin") |
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.
I think include(GNUInstallDirs)
should already do the right thing here.
src/CMakeLists.txt
Outdated
target_include_directories(cucumber-cpp-nomain PUBLIC | ||
$<BUILD_INTERFACE:${CUKE_INCLUDE_DIR}> | ||
$<INSTALL_INTERFACE:include> | ||
PRIVATE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}) |
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 current source directory isn't necessary as include path so don't add it. Same below
src/CMakeLists.txt
Outdated
@@ -45,9 +45,27 @@ endif() | |||
add_library(cucumber-cpp-nomain STATIC ${CUKE_SOURCES}) | |||
add_library(cucumber-cpp STATIC ${CUKE_SOURCES} main.cpp) | |||
|
|||
target_include_directories(cucumber-cpp-nomain PUBLIC | |||
$<BUILD_INTERFACE:${CUKE_INCLUDE_DIR}> | |||
$<INSTALL_INTERFACE:include> |
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.
This should be $<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>
. Same below
src/CMakeLists.txt
Outdated
@@ -45,9 +45,27 @@ endif() | |||
add_library(cucumber-cpp-nomain STATIC ${CUKE_SOURCES}) | |||
add_library(cucumber-cpp STATIC ${CUKE_SOURCES} main.cpp) | |||
|
|||
target_include_directories(cucumber-cpp-nomain PUBLIC | |||
$<BUILD_INTERFACE:${CUKE_INCLUDE_DIR}> |
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.
Is adding this enough to permit us from removing the directory-scoped include_directories(${CUKE_INCLUDE_DIR})
in the toplevel CMakeLists.txt
?
src/CMakeLists.txt
Outdated
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) | ||
install(TARGETS cucumber-cpp |
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.
Why the duplication? The install()
command supports multiple targets after TARGETS
.
src/CMakeLists.txt
Outdated
install(TARGETS cucumber-cpp | ||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) |
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.
For usability I'm expecting an export()
of the library targets too.
To support find_package(CucumberCpp) install(EXPORT). And use GNUInstallDirs instead of hardcoded installation paths.
116615b
to
edea427
Compare
This makes installing of the built libraries along with their headers possible through the CMake-standard 'install' target. It responds to the usual DESTDIR and CMAKE_INSTALL_PREFIX variables to control installation location.
Hi @matlo607, Thanks for your making your first contribution to Cucumber, and welcome to the Cucumber committers team! You can now push directly to this repo and all other repos under the cucumber organization! 🍾 In return for this generous offer we hope you will:
On behalf of the Cucumber core team, |
I propose to add a target
install
to CMakeLists.txtTypes of changes
Checklist: