aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTom Jones <thj@freebsd.org>2024-01-24 10:50:14 +0000
committerDamjan Marion <dmarion@0xa5.net>2024-02-18 15:59:11 +0000
commit2cbbbb6d158e4463e64d638f92368d0076840438 (patch)
tree98944bd8c121fffd2b5686b7f7a1f3ed5b767936 /src
parent61b4efc4dae3f60265ed2b6d8bdcad84b1c4e1cb (diff)
build: Add FreeBSD as a supported platform for cmake
Allow FreeBSD as a platform in the main CMakeLists file. This requires a correct target for the compiler and an explicit name in the system check. The included subdirs require further changes to build, but the compiler needs to find them before it can complain. Type: improvement Change-Id: Ic56fe68290519ef5d3ed61082e7fb0ba0528a3fc Signed-off-by: Tom Jones <thj@freebsd.org>
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 7c4f8db7095..9415c4d44fb 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -112,14 +112,20 @@ endif()
##############################################################################
# cross compiling
##############################################################################
+
+if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
+ set(COMPILER_SUFFIX "linux-gnu")
+elseif (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
+ set(COMPILER_SUFFIX "freebsd")
+endif()
+
if(CMAKE_CROSSCOMPILING)
set(CMAKE_IGNORE_PATH
- /usr/lib/${CMAKE_HOST_SYSTEM_PROCESSOR}-linux-gnu/
- /usr/lib/${CMAKE_HOST_SYSTEM_PROCESSOR}-linux-gnu/lib/
+ /usr/lib/${CMAKE_HOST_SYSTEM_PROCESSOR}-${COMPILER_SUFFIX}/
+ /usr/lib/${CMAKE_HOST_SYSTEM_PROCESSOR}-${COMPILER_SUFFIX}/lib/
)
endif()
-set(CMAKE_C_COMPILER_TARGET ${CMAKE_SYSTEM_PROCESSOR}-linux-gnu)
-
+ set(CMAKE_C_COMPILER_TARGET ${CMAKE_SYSTEM_PROCESSOR}-${COMPILER_SUFFIX})
##############################################################################
# build config
##############################################################################
@@ -252,7 +258,7 @@ if(VPP_HOST_TOOLS_ONLY)
DESTINATION ${VPP_RUNTIME_DIR}
COMPONENT vpp-dev
)
-elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
+elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux|FreeBSD")
find_package(OpenSSL)
set(SUBDIRS
vppinfra svm vlib vlibmemory vlibapi vnet vpp vat vat2 vcl vpp-api