api: vat2 and json autogeneration for api messages
[vpp.git] / src / CMakeLists.txt
index 0d971fd..8947c8a 100644 (file)
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
+cmake_minimum_required(VERSION 3.10)
 
 set(CMAKE_C_COMPILER_NAMES clang-11 clang-10 clang-9 gcc-10 gcc-9 cc)
 
 project(vpp C)
 
 include(CheckCCompilerFlag)
+include(CheckIPOSupported)
 include(cmake/misc.cmake)
 include(cmake/cpu.cmake)
 include(cmake/ccache.cmake)
@@ -105,6 +106,16 @@ string(REPLACE ";" " " BUILD_TYPES "${BUILD_TYPES}")
 set_property(CACHE CMAKE_BUILD_TYPE PROPERTY
             HELPSTRING "Build type - valid options are: ${BUILD_TYPES}")
 
+##############################################################################
+# link time optimizations
+##############################################################################
+if (CMAKE_BUILD_TYPE_UC STREQUAL "RELEASE")
+  check_ipo_supported(RESULT _result)
+  if (_result)
+    option(VPP_USE_LTO "Link time optimization of release binaries" ON)
+  endif()
+endif()
+
 ##############################################################################
 # sanitizers
 ##############################################################################
@@ -153,7 +164,7 @@ if(VPP_HOST_TOOLS_ONLY)
 elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
   find_package(OpenSSL REQUIRED)
   set(SUBDIRS
-    vppinfra svm vlib vlibmemory vlibapi vnet vpp vat vcl plugins
+    vppinfra svm vlib vlibmemory vlibapi vnet vpp vat vat2 vcl plugins
     vpp-api tools/vppapigen tools/g2 tools/perftool cmake pkg
     tools/appimage
   )