cmake: pass linker flags, use devtoolset on centos 7
@@ -52,16 +52,29 @@ vpp_configure_args += --enable-tests
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
