summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorMauro Sardara <msardara@cisco.com>2019-02-01 17:12:38 +0100
committerMauro Sardara <msardara@cisco.com>2019-02-01 18:41:39 +0100
commite8fabe3f6313a3b9050fe16458e4714d9dce426e (patch)
treeb379acde21e48a0f2e047d47f79ea30e8d43bd80 /CMakeLists.txt
parentc00bc6fc2af9a54fe339f8d6a3ec1ab889c2931e (diff)
[HICN-10] Compile libtransport with libmemif support
Change-Id: I81d1cb4d5f16a61c35f66fe347985f05d8c97383 Signed-off-by: Mauro Sardara <msardara@cisco.com>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt66
1 files changed, 50 insertions, 16 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 29fa1700b..973946c6f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -21,38 +21,72 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set(HICN_INCLUDE_DIRS ${PROJECT_BINARY_DIR}/lib)
-## Target names
-set(LIBHICN hicn)
-set(LIBHICN_SHARED hicn.shared)
-set(LIBHICN_LIGHT hicn-light)
-set(HICN_LIGHT_CONTROL hicnLightControl)
-set(HICN_LIGHT_DAEMON hicnLightDaemon)
-set(HICN_PLUGIN hicn-plugin)
-set(LIBTRANSPORT hicntransport)
-set(LIBTRANSPORT_SHARED hicntransport.shared)
-set(HICN_UTILS hicn-utils)
+## Enabled components
+option(BUILD_LIBHICN "Build the hicn core library" ON)
+option(BUILD_HICNLIGHT "Build the hicn light forwarder" ON)
+option(BUILD_LIBTRANSPORT "Build the hicn transport library" ON)
+option(BUILD_UTILS "Build the hicn utils" ON)
+option(BUILD_HICNPLUGIN "Build the hicn vpp plugin" OFF)
+
+list(APPEND dir_options
+ BUILD_LIBHICN
+ BUILD_HICNLIGHT
+ BUILD_LIBTRANSPORT
+ BUILD_UTILS
+)
+
+set(BUILD_LIBHICN_DIR lib)
+set(BUILD_HICNLIGHT_DIR hicn-light)
+set(BUILD_LIBTRANSPORT_DIR libtransport)
+set(BUILD_UTILS_DIR utils)
+set(BUILD_HICNPLUGIN_DIR hicn-plugin)
## HEADER FILES
set(LIBHICN_HEADER_FILES)
set(LIBHICN_LIGHT_HEADER_FILES)
set(LIBTRANSPORT_HEADER_FILES)
-set(SUBDIRS lib hicn-light libtransport utils)
+## Add enabled components
+foreach (opt ${dir_options})
+ if (${opt})
+ list(APPEND subdirs
+ ${${opt}_DIR}
+ )
+ endif()
+endforeach()
-add_compile_options(-Wall -Werror)
+## Static targets
+set(LIBHICN hicn)
+set(LIBHICN_LIGHT hicn-light)
+set(HICN_LIGHT_CONTROL hicnLightControl)
+set(HICN_LIGHT_DAEMON hicnLightDaemon)
+set(HICN_PLUGIN hicn-plugin)
+set(LIBTRANSPORT hicntransport)
+set(HICN_UTILS hicn-utils)
-if (BUILD_VPP_PLUGIN AND "${CMAKE_SYSTEM_NAME}" STREQUAL "Linux" )
- list(APPEND SUBDIRS
- hicn-plugin
+if (BUILD_HICNPLUGIN AND "${CMAKE_SYSTEM_NAME}" STREQUAL "Linux" )
+ list(APPEND subdirs
+ ${BUILD_HICNPLUGIN_DIR}
)
list(APPEND HICN_BINARY_API_INCLUDE_DIRS
${PROJECT_BINARY_DIR}/hicn-plugin
${PROJECT_BINARY_DIR}/hicn-plugin/vpp_plugins
)
+
+ set(LIBTRANSPORT ${LIBTRANSPORT}-memif)
+ set(HICN_UTILS ${HICN_UTILS}-memif)
endif()
-foreach(dir ${SUBDIRS})
+## Shared targets
+set(LIBHICN_SHARED ${LIBHICN}.shared)
+set(LIBTRANSPORT_SHARED ${LIBTRANSPORT}.shared)
+
+add_compile_options(-Wall -Werror)
+
+message(STATUS "Building the following subprojects: ${subdirs}")
+
+foreach(dir ${subdirs})
add_subdirectory(${dir})
endforeach()