-
Notifications
You must be signed in to change notification settings - Fork 353
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
fix: CMake package and pkgconfig rework #916
Merged
Merged
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
80356ae
add tests of the CMake package and pkgconfig
phlptp c3cec5f
style: pre-commit.ci fixes
pre-commit-ci[bot] bac5352
remove extraneous option
phlptp bf484d6
style: pre-commit.ci fixes
pre-commit-ci[bot] 6b5dba4
tweak the workflows
phlptp 70f3e84
add in addition find paths
phlptp 0d0c043
style: pre-commit.ci fixes
pre-commit-ci[bot] 1312011
tweak the directory lists
phlptp f9a2158
style: pre-commit.ci fixes
pre-commit-ci[bot] f88fa6e
update the package_config_tests
phlptp 796c283
install package config to correct location
phlptp 89a9232
add debug output to cmake
phlptp eab3fd2
reorder cmake calls
phlptp 39142e7
try again
phlptp fb9a268
add precompiled package tests
phlptp 4aacecf
fix incorrect cmake variable in install section
phlptp 5bb3c90
add preconfig files for precompiled library
phlptp 7f32799
style: pre-commit.ci fixes
pre-commit-ci[bot] cedfc7c
filter the ctest workflow
phlptp ff96dc2
fix the template file condition
phlptp 7453e29
add single file install test
phlptp b1199a5
add a header for single file include so it has a CLI/CLI.hpp file jus…
phlptp 1ccc25f
style: pre-commit.ci fixes
pre-commit-ci[bot] 81974a5
fix configure location
phlptp 757f0e0
style: pre-commit.ci fixes
pre-commit-ci[bot] 1cb7547
simplify to single pc file for single_file and normal
phlptp File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
configure_file("cmake/CLI11.pc.in" "CLI11.pc" @ONLY) | ||
if(CLI11_PRECOMPILED) | ||
configure_file("cmake/CLI11precompiled.pc.in" "CLI11.pc" @ONLY) | ||
else() | ||
configure_file("cmake/CLI11.pc.in" "CLI11.pc" @ONLY) | ||
endif() | ||
|
||
install(FILES "${PROJECT_BINARY_DIR}/CLI11.pc" DESTINATION "${CMAKE_INSTALL_DATADIR}/pkgconfig") | ||
install(FILES "${PROJECT_BINARY_DIR}/CLI11.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
prefix=@CMAKE_INSTALL_PREFIX@ | ||
exec_prefix=${prefix} | ||
includedir=${prefix}/include | ||
libdir=${exec_prefix}/lib | ||
|
||
Name: CLI11 | ||
Description: C++ command line parser | ||
Version: @PROJECT_VERSION@ | ||
|
||
Cflags: -I${includedir} -DCLI11_COMPILE | ||
Libs: -L${libdir} -lCLI11 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner | ||
// under NSF AWARD 1414736 and by the respective contributors. | ||
// All rights reserved. | ||
// | ||
// SPDX-License-Identifier: BSD-3-Clause | ||
|
||
#pragma once | ||
|
||
//single file header | ||
#include "../CLI11.hpp" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
cmake_minimum_required(VERSION 3.10...3.26) | ||
|
||
project(CLI11-find-package-test) | ||
|
||
include(CTest) | ||
|
||
if(CLI11_DIR) | ||
set(CMAKE_PREFIX_PATH ${CLI11_DIR}) | ||
endif() | ||
|
||
# Test the CLI11 CMake package config | ||
find_package(CLI11 2.0 REQUIRED) | ||
|
||
# Test the target | ||
add_executable(package-test ../../examples/positional_validation.cpp) | ||
target_link_libraries(package-test CLI11::CLI11) | ||
|
||
add_test(NAME package-test1 COMMAND package-test one) | ||
set_property(TEST package-test1 PROPERTY PASS_REGULAR_EXPRESSION "File 1 = one") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
cmake_minimum_required(VERSION 3.10...3.26) | ||
|
||
project(CLI11-package-config-test) | ||
|
||
include(CTest) | ||
|
||
find_package(PkgConfig) | ||
|
||
if(CLI11_DIR) | ||
set(CMAKE_PREFIX_PATH ${CLI11_DIR} ${CLI11_DIR}/lib) | ||
endif() | ||
|
||
message(STATUS "${CLI11_DIR}-- ${CMAKE_PREFIX_PATH}") | ||
pkg_check_modules(CLI11 REQUIRED IMPORTED_TARGET CLI11) | ||
|
||
# Test the target | ||
add_executable(package-config-test ../../examples/positional_validation.cpp) | ||
target_link_libraries(package-config-test PkgConfig::CLI11) | ||
|
||
add_test(NAME package-config-test1 COMMAND package-config-test one) | ||
set_property(TEST package-config-test1 PROPERTY PASS_REGULAR_EXPRESSION "File 1 = one") |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 this change is what caused the coverage change, but I don't think the examples should be built or tested during the single file tests, not entirely sure what is going on.
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.
Coverage upload is finicky, it's possible it just had too many jobs not able to report. Going to try a rebuild to see. Otherwise, not too worked about it.
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 should take another crack at getting back to 100% sometime soon. Probably not in this PR though
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 failing lines are
https://github.com/phlptp/CLI11/blob/1cb75471863bb364038de3a5ef8b596694945990/include/CLI/impl/App_inl.hpp#L608-L609
https://github.com/phlptp/CLI11/blob/1cb75471863bb364038de3a5ef8b596694945990/include/CLI/impl/Config_inl.hpp#L250-L251
https://github.com/phlptp/CLI11/blob/1cb75471863bb364038de3a5ef8b596694945990/include/CLI/impl/Config_inl.hpp#L342-L343
I think they were uncovered before, but for some reason they are now counting as a slightly higher percentage? Coverage is weird unless it's 100%. :/
Not worried about it for this PR.