cmake: pass linker flags, use devtoolset on centos 7

Change-Id: I8439fd070dc47a080e2df859c9f9ac67d8a08f04
Signed-off-by: Damjan Marion <damarion@cisco.com>
diff --git a/build-data/packages/vpp.mk b/build-data/packages/vpp.mk
index 230f890..4002cbc 100644
--- a/build-data/packages/vpp.mk
+++ b/build-data/packages/vpp.mk
@@ -52,16 +52,29 @@
 endif
 
 else
+ifneq ($(shell which cmake3),)
+CMAKE?=cmake3
+else
+CMAKE?=cmake
+endif
+
+vpp_cmake_args ?=
+vpp_cmake_args += -DCMAKE_INSTALL_PREFIX:PATH=$(PACKAGE_INSTALL_DIR)
+vpp_cmake_args += -DCMAKE_C_FLAGS="$($(TAG)_TAG_CFLAGS)"
+vpp_cmake_args += -DCMAKE_LINKER_FLAGS="$($(TAG)_TAG_LDFLAGS)"
+vpp_cmake_args += -DDPDK_INCLUDE_DIR_HINT="$(PACKAGE_INSTALL_DIR)/../dpdk/include"
+vpp_cmake_args += -DDPDK_LIB_DIR_HINT="$(PACKAGE_INSTALL_DIR)/../dpdk/lib"
+
+# Use devtoolset on centos 7
+ifneq ($(wildcard /opt/rh/devtoolset-7/enable),)
+vpp_cmake_args += -DCMAKE_PROGRAM_PATH:PATH="/opt/rh/devtoolset-7/root/bin"
+endif
+
 vpp_configure_depend += dpdk-install
 vpp_configure = \
   cd $(PACKAGE_BUILD_DIR) && \
-  cmake -G Ninja \
-    -DCMAKE_INSTALL_PREFIX:PATH=$(PACKAGE_INSTALL_DIR) \
-    -DCMAKE_C_FLAGS="$($(TAG)_TAG_CFLAGS)" \
-    -DDPDK_INCLUDE_DIR_HINT="$(PACKAGE_INSTALL_DIR)/../dpdk/include" \
-    -DDPDK_LIB_DIR_HINT="$(PACKAGE_INSTALL_DIR)/../dpdk/lib" \
-    $(call find_source_fn,$(PACKAGE_SOURCE))
+  $(CMAKE) -G Ninja $(vpp_cmake_args) $(call find_source_fn,$(PACKAGE_SOURCE))
 #vpp_make_args = --no-print-directory
-vpp_build = cmake --build $(PACKAGE_BUILD_DIR)
-vpp_install = cmake --build $(PACKAGE_BUILD_DIR) -- install | grep -v 'Set runtime path'
+vpp_build = $(CMAKE) --build $(PACKAGE_BUILD_DIR)
+vpp_install = $(CMAKE) --build $(PACKAGE_BUILD_DIR) -- install | grep -v 'Set runtime path'
 endif