mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-10-31 23:26:22 +00:00
Fix for Clang 16
This commit is contained in:
parent
08dcf3f88c
commit
2479e889b8
@ -4,10 +4,24 @@
|
|||||||
# SPDX-FileCopyrightText: 2023 C. Fernandez-Prades cfernandez(at)cttc.es
|
# SPDX-FileCopyrightText: 2023 C. Fernandez-Prades cfernandez(at)cttc.es
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
|
# Downloads and builds the protoc compiler and static libraries of Protocol
|
||||||
|
# Buffers >= v22.0 (see https://protobuf.dev/) It requires CMake >= 3.10 and the
|
||||||
|
# abseil-cpp >= 20230117 libraries (see https://github.com/abseil/abseil-cpp)
|
||||||
|
# already installed. Zlib is used if found.
|
||||||
|
#
|
||||||
|
# Note: requires the patch command if using GCC >= 13 or Clang >= 16
|
||||||
|
#
|
||||||
|
# Creates protobuf::libprotobuf and protobuf::protoc imported targets.
|
||||||
|
|
||||||
|
|
||||||
if(NOT GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION)
|
if(NOT GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION)
|
||||||
set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "22.2")
|
set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "22.2")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(NOT GNSSSDR_BINARY_DIR)
|
||||||
|
set(GNSSSDR_BINARY_DIR "${PROJECT_BINARY_DIR}")
|
||||||
|
endif()
|
||||||
|
|
||||||
if(NOT ZLIB_FOUND)
|
if(NOT ZLIB_FOUND)
|
||||||
find_package(ZLIB)
|
find_package(ZLIB)
|
||||||
set_package_properties(ZLIB PROPERTIES
|
set_package_properties(ZLIB PROPERTIES
|
||||||
@ -43,9 +57,9 @@ list(APPEND UTF8_LIBRARIES
|
|||||||
${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/${CMAKE_INSTALL_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}utf8_range${CMAKE_STATIC_LIBRARY_SUFFIX}
|
${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/${CMAKE_INSTALL_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}utf8_range${CMAKE_STATIC_LIBRARY_SUFFIX}
|
||||||
)
|
)
|
||||||
|
|
||||||
# Fix for GCC 13
|
# Fix for GCC 13 and Clang 16
|
||||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
if(((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "13")) OR
|
||||||
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "12.99")
|
((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "16")))
|
||||||
find_program(Patch_EXECUTABLE NAME patch PATHS ENV PATH)
|
find_program(Patch_EXECUTABLE NAME patch PATHS ENV PATH)
|
||||||
if(NOT Patch_EXECUTABLE)
|
if(NOT Patch_EXECUTABLE)
|
||||||
message(FATAL_ERROR "The patch command is not found. It is required to build Protocol Buffers. Please check your OS documentation and install the patch command.")
|
message(FATAL_ERROR "The patch command is not found. It is required to build Protocol Buffers. Please check your OS documentation and install the patch command.")
|
||||||
@ -58,9 +72,6 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
|||||||
if(EXISTS ${GNSSSDR_BINARY_DIR}/thirdparty/protobuf/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/src/google/protobuf/port.h)
|
if(EXISTS ${GNSSSDR_BINARY_DIR}/thirdparty/protobuf/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/src/google/protobuf/port.h)
|
||||||
set(PROTOBUF_PATCH_COMMAND "")
|
set(PROTOBUF_PATCH_COMMAND "")
|
||||||
endif()
|
endif()
|
||||||
else()
|
|
||||||
set(PROTOBUF_PATCH_COMMAND "")
|
|
||||||
endif()
|
|
||||||
else()
|
else()
|
||||||
set(PROTOBUF_PATCH_COMMAND "")
|
set(PROTOBUF_PATCH_COMMAND "")
|
||||||
endif()
|
endif()
|
||||||
|
Loading…
Reference in New Issue
Block a user