aboutsummaryrefslogtreecommitdiffstats
path: root/src/CMakeLists.txt
diff options
context:
space:
mode:
authorRenato Botelho do Couto <renato@netgate.com>2024-06-20 11:01:40 -0500
committerMatthew Smith <mgsmith@netgate.com>2024-07-12 12:40:15 +0000
commite69ec9c101883a7bc90fdac6d28ddf8e9429b466 (patch)
tree1c332ca7d331aacaec8c189ae5be672ef1776721 /src/CMakeLists.txt
parentd18726eaac8f06aaaebca3e8c42590870de2af21 (diff)
build: Fix crossbuilding definitions
CMAKE_C_COMPILER_TARGET doesn't need to be set when it's not cross compiling, and based on wrong identation of that line I suspect it was intended to be inside CMAKE_CROSSCOMPILING conditional. With this line moved inside, it ends up being the only place where COMPILER_SUFFIX is used, so, move its declaration there as well. It will not bring any change to currently supported systems but will make it easier to build VPP on systems running musl libc. Type: fix Change-Id: Ia8e16d9e8ad9c987ddf246dd0e3f8636ccad1362 Signed-off-by: Renato Botelho do Couto <renato@netgate.com>
Diffstat (limited to 'src/CMakeLists.txt')
-rw-r--r--src/CMakeLists.txt15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 68d0a4fe64e..d5c7fd1c718 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -113,19 +113,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)
+ if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
+ set(COMPILER_SUFFIX "linux-gnu")
+ elseif (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
+ set(COMPILER_SUFFIX "freebsd")
+ endif()
+
set(CMAKE_IGNORE_PATH
/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}-${COMPILER_SUFFIX})
+endif()
+
##############################################################################
# build config
##############################################################################