1 # Copyright (c) 2017 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:
6 # http://www.apache.org/licenses/LICENSE-2.0
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.
14 cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
17 set(CMAKE_C_STANDARD 11)
19 include(CheckCCompilerFlag)
20 include(CheckFunctionExists)
22 set(VPP_SRC "${CMAKE_CURRENT_SOURCE_DIR}/../../src")
24 COMMAND find ${VPP_SRC} -type d -name "cmake"
25 OUTPUT_VARIABLE CMAKE_DEPS_FOLDER
26 OUTPUT_STRIP_TRAILING_WHITESPACE
28 include(${CMAKE_DEPS_FOLDER}/library.cmake)
29 include(${CMAKE_DEPS_FOLDER}/pack.cmake)
31 if (NOT CMAKE_BUILD_TYPE)
32 message(STATUS "No build type selected, default to Release")
33 set(CMAKE_BUILD_TYPE "Release")
36 set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g -DMEMIF_DBG -DICMP_DBG")
37 set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
38 set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib)
39 set(CMAKE_INSTALL_MESSAGE NEVER)
41 find_package(Threads REQUIRED)
42 include_directories(${CMAKE_THREADS_INCLUDE_DIRS})
44 check_function_exists(memfd_create HAVE_MEMFD_CREATE)
45 if(${HAVE_MEMFD_CREATE})
46 add_definitions(-DHAVE_MEMFD_CREATE)
49 include_directories(src)
52 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
53 find_package(Check 0.10.0)
55 include_directories(${CHECK_INCLUDE_DIR})
56 add_definitions(-DMEMIF_UNIT_TEST)
57 add_subdirectory(test)
62 add_subdirectory(examples)
67 DESCRIPTION "Shared Memory Interface"