Skip to content
Open
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
19 changes: 19 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,25 @@ jobs:
- name: Run tests
run: ctest --output-on-failure -L Packaging
working-directory: build

install-precompiled-all:
name: install tests precompiled full install
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Configure
run: cmake -S . -B build -DCLI11_INSTALL_PACKAGE_TESTS=ON -DCLI11_ENABLE_EXTRA_VALIDATORS=ON -DCMAKE_INSTALL_PREFIX=/home/runner/work/install -DCLI11_PRECOMPILED=ON -DCLI11_FULL_INSTALL=ON
- name: Build
run: cmake --build build -j2
- name: install
run: cmake --install build
- name: Configure2
run: cmake -S . -B build -DCLI11_INSTALL_PACKAGE_TESTS=ON -DCMAKE_INSTALL_PREFIX=/home/runner/work/install
- name: Run tests
run: ctest --output-on-failure -L Packaging
working-directory: build

install-precompiled-macos:
name: install tests precompiled macos
Expand Down
10 changes: 8 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ cmake_dependent_option(CLI11_BUILD_EXAMPLES "Build CLI11 examples" ON
cmake_dependent_option(CLI11_BUILD_EXAMPLES_JSON "Build CLI11 json example" OFF
"CLI11_BUILD_EXAMPLES;NOT CMAKE_VERSION VERSION_LESS 3.15" OFF)

cmake_dependent_option(
CLI11_FULL_INSTALL "Install all headers regardless of SINGLE_FILE OR PRECOMPILED OPTIONS" OFF
"CLI11_SINGLE_FILE OR CLI11_PRECOMPILED" OFF)

cmake_dependent_option(CLI11_SINGLE_FILE_TESTS "Duplicate all the tests for a single file build"
OFF "BUILD_TESTING;CLI11_SINGLE_FILE" OFF)

Expand All @@ -93,7 +97,9 @@ cmake_dependent_option(
CLI11_CUDA_TESTS "Build the tests with NVCC to check for warnings there - requires CMake 3.9+"
OFF "CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME" OFF)

if(CLI11_PRECOMPILED AND CLI11_SINGLE_FILE)
if(NOT CLI11_FULL_INSTALL
AND CLI11_PRECOMPILED
AND CLI11_SINGLE_FILE)
# Sanity check
message(FATAL_ERROR "CLI11_PRECOMPILE and CLI11_SINGLE_FILE are mutually exclusive")
endif()
Expand Down Expand Up @@ -171,7 +177,7 @@ if(CLI11_CUDA_TESTS)
endif()

# This folder should be installed
if(CLI11_INSTALL)
if(CLI11_INSTALL OR CLI11_FULL_INSTALL)

# Use find_package on the installed package
# Since we have no custom code, we can directly write this
Expand Down
1 change: 1 addition & 0 deletions book/chapters/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ default to off if CLI11 is used as a subdirectory in another project.
| `CLI11_BUILD_EXAMPLES=ON` | Build the example programs. |
| `CLI11_BUILD_EXAMPLES_JSON=ON` | Build some additional example using json libraries |
| `CLI11_INSTALL=ON` | install CLI11 to the install folder during the install process |
| `CLI11_FULL_INSTALL=ON` | install all CLI11 headers/libraries regardless of other settings |
| `CLI11_FORCE_LIBCXX=OFF` | use libc++ instead of libstdc++ if building with clang on linux |
| `CLI11_CUDA_TESTS=OFF` | build the tests with NVCC |
| `CLI11_BUILD_TESTS=ON` | Build the tests. |
Expand Down
2 changes: 1 addition & 1 deletion single-include/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ if(CLI11_SINGLE_FILE)
add_custom_target(CLI11-generate-single-file ALL
DEPENDS "${PROJECT_BINARY_DIR}/single-include/CLI11.hpp")
set_property(TARGET CLI11-generate-single-file PROPERTY FOLDER "Scripts")
if(CLI11_INSTALL)
if(CLI11_INSTALL OR CLI11_FULL_INSTALL)
install(FILES "${PROJECT_BINARY_DIR}/single-include/CLI11.hpp"
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
endif()
Expand Down
6 changes: 3 additions & 3 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ if(CMAKE_CXX_STANDARD LESS 14)
target_compile_features(CLI11 INTERFACE cxx_std_11)
endif()

if(CLI11_INSTALL)
if(CLI11_INSTALL OR CLI11_FULL_INSTALL)

# Make an export target
install(TARGETS CLI11 EXPORT CLI11Targets)
if(NOT CLI11_SINGLE_FILE)
if((NOT CLI11_SINGLE_FILE) OR CLI11_FULL_INSTALL)
install(FILES ${CLI11_headers} ${CLI11_library_headers}
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/CLI")
if(NOT CLI11_PRECOMPILED)
if((NOT CLI11_PRECOMPILED) OR CLI11_FULL_INSTALL)
install(FILES ${CLI11_impl_headers} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/CLI/impl")
endif()
endif()
Expand Down