1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-14 12:10:34 +00:00

Bump CMake compatibility to version 3.21

This commit is contained in:
Carles Fernandez 2021-07-24 13:59:05 +02:00
parent 6289d920cc
commit c9341b6d35
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
2 changed files with 9 additions and 3 deletions

View File

@ -11,7 +11,7 @@ if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
message(FATAL_ERROR "Prevented in-tree build, it is bad practice.\nTry 'cd build && cmake ..' instead.") message(FATAL_ERROR "Prevented in-tree build, it is bad practice.\nTry 'cd build && cmake ..' instead.")
endif() endif()
cmake_minimum_required(VERSION 2.8.12...3.20) cmake_minimum_required(VERSION 2.8.12...3.21)
project(gnss-sdr CXX C) project(gnss-sdr CXX C)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules) list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules)
@ -1460,7 +1460,9 @@ if(NOT GLOG_FOUND OR ${LOCAL_GFLAGS})
message(STATUS " glog v${GNSSSDR_GLOG_LOCAL_VERSION} will be downloaded, built, and statically linked automatically") message(STATUS " glog v${GNSSSDR_GLOG_LOCAL_VERSION} will be downloaded, built, and statically linked automatically")
message(STATUS " when doing '${CMAKE_MAKE_PROGRAM_PRETTY_NAME}'.") message(STATUS " when doing '${CMAKE_MAKE_PROGRAM_PRETTY_NAME}'.")
if(NOT ${LOCAL_GFLAGS}) if(NOT ${LOCAL_GFLAGS})
add_library(gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION} UNKNOWN IMPORTED) if(NOT TARGET gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION})
add_library(gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION} UNKNOWN IMPORTED)
endif()
set_property(TARGET gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION} PROPERTY IMPORTED_LOCATION "${GFlags_LIBS}") set_property(TARGET gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION} PROPERTY IMPORTED_LOCATION "${GFlags_LIBS}")
string(REPLACE /include "" GFLAGS_PREFIX_PATH ${GFlags_INCLUDE_DIRS}) string(REPLACE /include "" GFLAGS_PREFIX_PATH ${GFlags_INCLUDE_DIRS})
else() else()
@ -1497,6 +1499,10 @@ if(NOT GLOG_FOUND OR ${LOCAL_GFLAGS})
set(GLOG_EXPORT_C_COMPILER "export CC=clang") set(GLOG_EXPORT_C_COMPILER "export CC=clang")
set(GLOG_EXPORT_CXX_COMPILER "export CXX=clang++") set(GLOG_EXPORT_CXX_COMPILER "export CXX=clang++")
endif() endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(GLOG_EXPORT_C_COMPILER "export CC=gcc")
set(GLOG_EXPORT_CXX_COMPILER "export CXX=g++")
endif()
file(WRITE ${CMAKE_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/tmp/configure_with_gflags file(WRITE ${CMAKE_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/tmp/configure_with_gflags
"#!/bin/sh "#!/bin/sh
export CPPFLAGS=-I${GFlags_INCLUDE_DIRS} export CPPFLAGS=-I${GFlags_INCLUDE_DIRS}

View File

@ -86,7 +86,7 @@ macro(add_benchmark)
target_link_libraries(${ARGV0} PRIVATE benchmark::benchmark) target_link_libraries(${ARGV0} PRIVATE benchmark::benchmark)
if(${ARGC} GREATER 1) if(${ARGC} GREATER 1)
set(list_dependencies "${ARGN}") set(list_dependencies "${ARGN}")
list(REMOVE_AT list_dependencies 0 list_dependencies) list(REMOVE_AT list_dependencies 0)
foreach(dependency IN LISTS list_dependencies) foreach(dependency IN LISTS list_dependencies)
target_link_libraries(${ARGV0} PRIVATE ${dependency}) target_link_libraries(${ARGV0} PRIVATE ${dependency})
endforeach() endforeach()