3 #==================================================================================
4 # Copyright (c) 2019 Nokia
5 # Copyright (c) 2018-2019 AT&T Intellectual Property.
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
11 # http://www.apache.org/licenses/LICENSE-2.0
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
18 #==================================================================================
21 # simulate the route table manager
22 project( rtm_sim LANGUAGES C )
23 cmake_minimum_required( VERSION 3.5 )
25 set( major_version "1" )
26 set( minor_version "0" )
27 set( patch_level "1" )
29 set( CMAKE_POSITION_INDEPENDENT_CODE ON )
30 set( CMAKE_CXX_FLAGS "-g -Wall -I /usr/local/include" )
32 find_library( nanomsg libnanomsg.a )
34 find_program( rpm NAMES rpmbuild ) # rpm package gen requires this to be installed
36 if( "${rpm}" MATCHES "rpm-NOTFOUND" ) # cannot build rpm
38 message( "+++ `make package` will generate only deb package; cannot find support to generate rpm packages" )
40 set( pkg_list "DEB;RPM" )
41 message( "+++ `make package` will generate both deb and rpm packages" )
44 add_executable( rtm_sim rtm_sim.c )
45 target_link_libraries( rtm_sim nanomsg )
49 DESTINATION /usr/local/bin
52 IF( EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake" )
53 include( InstallRequiredSystemLibraries )
55 set( CPACK_set_DESTDIR "on" )
56 set( CPACK_PACKAGING_INSTALL_PREFIX "${install_root}" )
57 set( CPACK_GENERATOR ${pkg_list} )
59 set( CPACK_PACKAGE_DESCRIPTION "Simplistic route table manager simulator." )
60 set( CPACK_PACKAGE_DESCRIPTION_SUMMARY "RT manager simulation" )
61 set( CPACK_PACKAGE_VENDOR "None" )
62 set( CPACK_PACKAGE_CONTACT "None" )
63 set( CPACK_PACKAGE_VERSION_MAJOR "${major_version}" )
64 set( CPACK_PACKAGE_VERSION_MINOR "${minor_version}" )
65 set( CPACK_PACKAGE_VERSION_PATCH "${patch_level}" )
66 set( CPACK_PACKAGE_FILE_NAME "rtm_sim-${major_version}.${minor_version}.${patch_level}-${CMAKE_SYSTEM_PROCESSOR}" )
68 # we build and ship the libraries, so there is NO dependency
69 set( CPACK_DEBIAN_PACKAGE_DEPENDS "libnanomsg0 (>=0.4)" )
71 set( CPACK_DEBIAN_PACKAGE_PRIORITY "optional" )
72 set( CPACK_DEBIAN_PACKAGE_SECTION "test" )
73 set( CPACK_DEBIAN_ARCHITECTURE ${CMAKE_SYSTEM_PROCESSOR} )
74 set( CPACK_RPM_ARCHITECTURE ${CMAKE_SYSTEM_PROCESSOR} )