Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/daniele77/cli
Browse files Browse the repository at this point in the history
  • Loading branch information
daniele77 committed Nov 2, 2022
2 parents c659fd3 + 7270d6e commit af8c76e
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 32 deletions.
64 changes: 33 additions & 31 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -116,34 +116,36 @@ if (CLI_BuildTests)
endif()

# Install
install(DIRECTORY include/cli DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})

include(CMakePackageConfigHelpers)
configure_package_config_file(
"cliConfig.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cliConfig.cmake"
INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/cli"
)

# Generate pkg-config .pc file
set(PKGCONFIG_INSTALL_DIR
${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig
CACHE PATH "Installation directory for pkg-config (cli.pc) file"
)
configure_file(
"cli.pc.in"
"cli.pc"
@ONLY
)

install(TARGETS cli EXPORT cliTargets LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(EXPORT cliTargets FILE cliTargets.cmake NAMESPACE cli:: DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/cli)

install(
FILES "${CMAKE_CURRENT_BINARY_DIR}/cliConfig.cmake"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/cli"
)
install(
FILES "${CMAKE_CURRENT_BINARY_DIR}/cli.pc"
DESTINATION ${PKGCONFIG_INSTALL_DIR}
)
if(NOT CMAKE_SKIP_INSTALL_RULES)
install(DIRECTORY include/cli DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})

include(CMakePackageConfigHelpers)
configure_package_config_file(
"cliConfig.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cliConfig.cmake"
INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/cli"
)

# Generate pkg-config .pc file
set(PKGCONFIG_INSTALL_DIR
${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig
CACHE PATH "Installation directory for pkg-config (cli.pc) file"
)
configure_file(
"cli.pc.in"
"cli.pc"
@ONLY
)

install(TARGETS cli EXPORT cliTargets LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(EXPORT cliTargets FILE cliTargets.cmake NAMESPACE cli:: DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/cli)

install(
FILES "${CMAKE_CURRENT_BINARY_DIR}/cliConfig.cmake"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/cli"
)
install(
FILES "${CMAKE_CURRENT_BINARY_DIR}/cli.pc"
DESTINATION ${PKGCONFIG_INSTALL_DIR}
)
endif()
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,21 @@ or, if you want to specify the installation path:
mkdir build && cd build
cmake .. -DCMAKE_INSTALL_PREFIX:PATH=<cli_install_location>
make install

Alternatively, you can use CMake's `FetchContent` module to include CLI library in your project directly.
Add something like this in your `CMakeLists.txt` file:

include(FetchContent)
FetchContent_Declare(
cli
GIT_REPOSITORY https://github.com/daniele77/cli.git
GIT_TAG v2.0.2
)
FetchContent_MakeAvailable(cli)

add_executable(main-project)
target_link_libraries(main-project PRIVATE cli::cli)


## Compilation of the examples

Expand Down
4 changes: 3 additions & 1 deletion include/cli/detail/linuxkeyboard.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,9 @@ class LinuxKeyboard : public InputDevice
case 4: // EOT
return std::make_pair(KeyType::eof,' ');
break;
case 127: return std::make_pair(KeyType::backspace,' '); break;
case 127:
case 8:
return std::make_pair(KeyType::backspace,' '); break;
case 10: return std::make_pair(KeyType::ret,' '); break;
case 27: // symbol
ch = std::getchar();
Expand Down

0 comments on commit af8c76e

Please sign in to comment.