build: use GNUInstallDirs where possible
[vpp.git] / src / tools / appimage / CMakeLists.txt
1 # Copyright (c) 2018 Cisco and/or its affiliates.
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at:
5 #
6 #     http://www.apache.org/licenses/LICENSE-2.0
7 #
8 # Unless required by applicable law or agreed to in writing, software
9 # distributed under the License is distributed on an "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 # See the License for the specific language governing permissions and
12 # limitations under the License.
13 option(VPP_BUILD_APPIMAGE "Build VPP AppImage" OFF)
14 if(VPP_BUILD_APPIMAGE)
15   install(FILES AppRun DESTINATION .
16     PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
17                 GROUP_READ GROUP_WRITE GROUP_EXECUTE
18                 WORLD_READ WORLD_EXECUTE)
19   install(FILES vpp.desktop DESTINATION .)
20   install(FILES vpp.png DESTINATION .)
21   install(FILES vpp.svg DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/scalable/vpp.svg)
22   install(CODE "EXECUTE_PROCESS(COMMAND ln -s . ./usr
23                 WORKING_DIRECTORY ${CMAKE_INSTALL_PREFIX})")
24   install(CODE "EXECUTE_PROCESS(
25           COMMAND linuxdeploy --appdir vpp --output appimage
26           WORKING_DIRECTORY ${CMAKE_INSTALL_PREFIX}/..)")
27 endif()