mirror of
https://github.com/curl/curl.git
synced 2026-05-30 08:47:28 +03:00
cmake: fix shell completion install when just one flavor is enabled
Also:
- tidy up the `if` tree.
- drop `include(GNUInstallDirs)` in favor of the upper-level one.
Reported-by: Daniel Engberg
Bug: https://github.com/curl/curl/issues/16946#issuecomment-2814663246
Follow-up to c8b0f0c9ad #16833
Closes #17094
This commit is contained in:
parent
cd0ec4784c
commit
f616704980
1 changed files with 19 additions and 17 deletions
|
|
@ -52,27 +52,29 @@ if(CURL_COMPLETION_FISH OR
|
|||
|
||||
if(NOT CURL_DISABLE_INSTALL)
|
||||
if(NOT CMAKE_CROSSCOMPILING)
|
||||
if(NOT CURL_COMPLETION_FISH_DIR)
|
||||
find_package(PkgConfig QUIET)
|
||||
pkg_get_variable(CURL_COMPLETION_FISH_DIR "fish" "completionsdir")
|
||||
if(NOT _pkg_fish_completionsdir)
|
||||
include(GNUInstallDirs)
|
||||
if(CMAKE_INSTALL_DATAROOTDIR)
|
||||
set(CURL_COMPLETION_FISH_DIR "${CMAKE_INSTALL_DATAROOTDIR}/fish/vendor_completions.d")
|
||||
if(CURL_COMPLETION_FISH)
|
||||
if(NOT CURL_COMPLETION_FISH_DIR)
|
||||
find_package(PkgConfig QUIET)
|
||||
pkg_get_variable(CURL_COMPLETION_FISH_DIR "fish" "completionsdir")
|
||||
if(NOT _pkg_fish_completionsdir)
|
||||
if(CMAKE_INSTALL_DATAROOTDIR)
|
||||
set(CURL_COMPLETION_FISH_DIR "${CMAKE_INSTALL_DATAROOTDIR}/fish/vendor_completions.d")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
if(NOT CURL_COMPLETION_ZSH_DIR)
|
||||
include(GNUInstallDirs)
|
||||
if(CMAKE_INSTALL_DATAROOTDIR)
|
||||
set(CURL_COMPLETION_ZSH_DIR "${CMAKE_INSTALL_DATAROOTDIR}/zsh/site-functions")
|
||||
if(CURL_COMPLETION_FISH_DIR)
|
||||
install(FILES "${_completion_fish}" DESTINATION "${CURL_COMPLETION_FISH_DIR}")
|
||||
endif()
|
||||
endif()
|
||||
if(CURL_COMPLETION_FISH_DIR)
|
||||
install(FILES "${_completion_fish}" DESTINATION "${CURL_COMPLETION_FISH_DIR}")
|
||||
endif()
|
||||
if(CURL_COMPLETION_ZSH_DIR)
|
||||
install(FILES "${_completion_zsh}" DESTINATION "${CURL_COMPLETION_ZSH_DIR}")
|
||||
if(CURL_COMPLETION_ZSH)
|
||||
if(NOT CURL_COMPLETION_ZSH_DIR)
|
||||
if(CMAKE_INSTALL_DATAROOTDIR)
|
||||
set(CURL_COMPLETION_ZSH_DIR "${CMAKE_INSTALL_DATAROOTDIR}/zsh/site-functions")
|
||||
endif()
|
||||
endif()
|
||||
if(CURL_COMPLETION_ZSH_DIR)
|
||||
install(FILES "${_completion_zsh}" DESTINATION "${CURL_COMPLETION_ZSH_DIR}")
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "We cannot install completion scripts when cross-compiling")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue