Commit a0d1815e authored by Jonathan Hanks's avatar Jonathan Hanks

Put command symlinks in the /usr/share/bash...area on install.

parent c235090a
# https://stackoverflow.com/questions/35765106/symbolic-links-cmake
macro(install_symlink filepath sympath)
install(CODE "execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${filepath} ${sympath})")
install(CODE "message(\"-- Created symlink: ${sympath} -> ${filepath}\")")
endmacro(install_symlink)
# Add commands that can use LIGO channel completion to this list
set (COMPLETE_THESE_COMMANDS
ndscope
cdsutils
caget
caput
camonitor
)
set(COMPLETE_COMMAND_REGISTRATION)
foreach(entry ${COMPLETE_THESE_COMMANDS})
set(COMPLETE_COMMAND_REGISTRATION "${COMPLETE_COMMAND_REGISTRATION}
complete -F _channel_completion ${entry}")
endforeach()
set(COMPLETE_SCRIPT_DIR "${CMAKE_INSTALL_PREFIX}/share/bash-completion/completions")
configure_file(ligo_channel_completion.in ${CMAKE_CURRENT_BINARY_DIR}/ligo_channel_completion @ONLY)
configure_file(link_file.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/link_file.cmake @ONLY)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/ligo_channel_completion"
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/bash-completion/completions)
install_symlink(${CMAKE_INSTALL_PREFIX}/share/bash-completion/completions/ligo_channel_completion
${CMAKE_INSTALL_PREFIX}/share/bash-completion/completions/ndscope)
install_symlink(${CMAKE_INSTALL_PREFIX}/share/bash-completion/completions/ligo_channel_completion
${CMAKE_INSTALL_PREFIX}/share/bash-completion/completions/cdsutils)
install_symlink(${CMAKE_INSTALL_PREFIX}/share/bash-completion/completions/ligo_channel_completion
${CMAKE_INSTALL_PREFIX}/share/bash-completion/completions/caget)
install_symlink(${CMAKE_INSTALL_PREFIX}/share/bash-completion/completions/ligo_channel_completion
${CMAKE_INSTALL_PREFIX}/share/bash-completion/completions/caput)
DESTINATION ${COMPLETE_SCRIPT_DIR})
install_symlink(${CMAKE_INSTALL_PREFIX}/share/bash-completion/completions/ligo_channel_completion
${CMAKE_INSTALL_PREFIX}/share/bash-completion/completions/camonitor)
\ No newline at end of file
install(SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/link_file.cmake)
......@@ -20,8 +20,4 @@ _channel_completion()
return 0
}
complete -F _channel_completion ndscope
complete -F _channel_completion cdsutils
complete -F _channel_completion caget
complete -F _channel_completion caput
complete -F _channel_completion camonitor
@COMPLETE_COMMAND_REGISTRATION@
\ No newline at end of file
message("external process DESTDIR=$ENV{DESTDIR} INSTALL_PREFIX=@CMAKE_INSTALL_PREFIX@ SCRIPT_DIR=@COMPLETE_SCRIPT_DIR@")
# ideas from https://stackoverflow.com/questions/35765106/symbolic-links-cmake
set (LINK_ENTRIES "@COMPLETE_THESE_COMMANDS@")
foreach (entry ${LINK_ENTRIES})
execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ligo_channel_completion ${entry}
WORKING_DIRECTORY "$ENV{DESTDIR}@COMPLETE_SCRIPT_DIR@"
)
message("-- Created symlink: for ${entry}")
endforeach()
message("Working dir = $ENV{DESTDIR}@COMPLETE_SCRIPT_DIR@")
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment