Skip to content

[cmake] adding a target install #182

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

Merged
merged 3 commits into from
May 31, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,17 @@ git submodule update
cmake -E make_directory build

# Generate Makefiles
cmake -E chdir build cmake -DCUKE_ENABLE_EXAMPLES=on ..
cmake -E chdir build cmake -DCUKE_ENABLE_EXAMPLES=on -DCMAKE_INSTALL_PREFIX=${prefix} ..

# Build cucumber-cpp and tests
cmake --build build

# Run unit tests
cmake --build build --target test

# Run install
cmake --build build --target install

# Check implementation against common cucumber test suite
cmake --build build --target features
```
Expand Down
1 change: 1 addition & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ test_script:
- set CTEST_OUTPUT_ON_FAILURE=ON
- cmake --build build --target test
- cmake --build build --target features
- cmake --build build --target install

after_test:
- for /r %%v in (TEST-*.xml) do curl -s -F "file=@%%v;filename=%%~nxv" https://ci.appveyor.com/api/testresults/junit/%APPVEYOR_JOB_ID%
Expand Down
28 changes: 26 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,9 @@ foreach(TARGET
)
target_include_directories(${TARGET}
PUBLIC
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_SOURCE_DIR}/include
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>
)
target_link_libraries(${TARGET}
PUBLIC
Expand Down Expand Up @@ -102,3 +103,26 @@ target_link_libraries(cucumber-cpp
PRIVATE
Boost::program_options
)

include(GNUInstallDirs)
install(DIRECTORY ${CUKE_INCLUDE_DIR}/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install(
FILES
"${CMAKE_CURRENT_BINARY_DIR}/cucumber-cpp/internal/CukeExport.hpp"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/cucumber-cpp/internal"
)
install(
TARGETS
cucumber-cpp-nomain
cucumber-cpp
EXPORT CucumberCpp
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
install(
EXPORT CucumberCpp
NAMESPACE CucumberCpp::
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake
FILE CucumberCppConfig.cmake
)
3 changes: 3 additions & 0 deletions travis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ cmake -E chdir build cmake \
-G Ninja \
-DCUKE_ENABLE_EXAMPLES=on \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_INSTALL_PREFIX=${HOME}/.local \
${CMAKE_PREFIX_PATH:+"-DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}"} \
${COVERALLS_SERVICE_NAME:+"-DCMAKE_BUILD_TYPE=Debug"} \
${COVERALLS_SERVICE_NAME:+"-DCMAKE_CXX_FLAGS='--coverage'"} \
Expand Down Expand Up @@ -109,3 +110,5 @@ if [ -f "${TEST}" ]; then
fi

killXvfb

cmake --build build --target install