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

[cmake] adding a target install #182

Merged
merged 3 commits into from
May 31, 2018

Conversation

matlo607
Copy link
Contributor

@matlo607 matlo607 commented Feb 13, 2018

I propose to add a target install to CMakeLists.txt

Types of changes

  • Bug fix (non-breaking change which fixes an issue).
  • New feature (non-breaking change which adds functionality).
  • Breaking change (fix or feature that would cause existing functionality to not work as expected).

Checklist:

  • It is my own work, its copyright is implicitly assigned to the project and no substantial part of it has been copied from other sources (including Stack Overflow). In rare occasions this is acceptable, like in CMake modules where the original copyright information should be kept.
  • I'm using the same code standards as the existing code (indentation, spacing, variable naming, ...).
  • I've added tests for my code.
  • I have verified whether my change requires changes to the documentation
  • My change either requires no documentation change or I've updated the documentation accordingly.
  • My branch has been rebased to master, keeping only relevant commits.

@matlo607 matlo607 mentioned this pull request Feb 14, 2018
9 tasks
@matlo607
Copy link
Contributor Author

@paoloambrosio, @muggenhor or @konserw : could you please review the pull request ?
Please ignore the commit 3887d2c, konserw told me it's wrong. I will wait for #184.

@coveralls
Copy link

coveralls commented Mar 21, 2018

Coverage Status

Coverage remained the same at 62.814% when pulling edea427 on matlo607:cmake-add-target-install into 870bfc2 on cucumber:master.

@konserw
Copy link
Contributor

konserw commented Mar 30, 2018

@matlo607 could you please rebase this branch onto master now that it is fixed? Also please drop commmit
8076700

@matlo607
Copy link
Contributor Author

matlo607 commented Apr 3, 2018

Hello @konserw,
I rebased the branch and removed 8076700

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")
Copy link
Contributor

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.

target_include_directories(cucumber-cpp-nomain PUBLIC
$<BUILD_INTERFACE:${CUKE_INCLUDE_DIR}>
$<INSTALL_INTERFACE:include>
PRIVATE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR})
Copy link
Contributor

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

@@ -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>
Copy link
Contributor

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

@@ -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}>
Copy link
Contributor

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?

ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
install(TARGETS cucumber-cpp
Copy link
Contributor

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.

install(TARGETS cucumber-cpp
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
Copy link
Contributor

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.

matlo607 and others added 3 commits May 23, 2018 11:12
To support find_package(CucumberCpp) install(EXPORT). And use
GNUInstallDirs instead of hardcoded installation paths.
@muggenhor muggenhor added this to the v0.5 milestone May 23, 2018
@muggenhor muggenhor merged commit edea427 into cucumber:master May 31, 2018
muggenhor added a commit that referenced this pull request May 31, 2018
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.
@aslakhellesoy
Copy link
Contributor

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:

  • ✅ Continue to use branches and pull requests. When someone on the core team approves a pull request (yours or someone else's), you're welcome to merge it yourself.
  • 💚 Commit to setting a good example by following and upholding our code of conduct in your interactions with other collaborators and users.
  • 💬 Join the community Slack channel to meet the rest of the team and make yourself at home.
  • ℹ️ Don't feel obliged to help, just do what you can if you have the time and the energy.
  • 🙋 Ask if you need anything. We're looking for feedback about how to make the project more welcoming, so please tell us!

On behalf of the Cucumber core team,
Aslak Hellesøy
Creator of Cucumber

@matlo607 matlo607 deleted the cmake-add-target-install branch July 16, 2018 10:33
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

5 participants