build: use GNUInstallDirs where possible
[vpp.git] / src / tools / vppapigen / 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
14 find_package(
15   Python3
16   REQUIRED
17   COMPONENTS Interpreter
18 )
19
20 execute_process(
21   COMMAND ${Python3_EXECUTABLE} -c "import ply"
22   RESULT_VARIABLE _rv
23   OUTPUT_QUIET
24 )
25
26 if (NOT ${_rv} EQUAL 0)
27   message( FATAL_ERROR "The \"ply\" Python3 package is not installed.")
28 endif()
29
30 install(
31   FILES vppapigen.py
32   RENAME vppapigen
33   DESTINATION ${VPP_RUNTIME_DIR}
34   PERMISSIONS
35     OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE
36     WORLD_READ WORLD_EXECUTE
37   COMPONENT vpp-dev
38 )
39
40 install(
41   FILES
42     vppapigen_c.py
43     vppapigen_json.py
44     generate_json.py
45   DESTINATION
46     ${CMAKE_INSTALL_DATADIR}/vpp
47   COMPONENT
48     vpp-dev
49 )