Handle redefinition of Boost_VERSION variable in CMake 3.15

See Policy CMP0093 https://cmake.org/cmake/help/v3.15/policy/CMP0093.html#policy:CMP0093
CMake 3.15 policies enabled by default (see https://cmake.org/cmake/help/v3.15/manual/cmake-policies.7.html#manual:cmake-policies(7) )
This commit is contained in:
Carles Fernandez 2019-07-22 14:13:57 +02:00
parent 5ba04708a9
commit 09b6b2305e
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
9 changed files with 27 additions and 33 deletions

View File

@ -23,7 +23,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.")
endif()
cmake_minimum_required(VERSION 2.8.12...3.14.5)
cmake_minimum_required(VERSION 2.8.12...3.15)
project(gnss-sdr CXX C)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules)
@ -682,15 +682,12 @@ set_package_properties(Boost PROPERTIES
TYPE REQUIRED
)
if(CMAKE_VERSION VERSION_GREATER 3.14)
set_package_properties(Boost PROPERTIES
DESCRIPTION "Portable C++ source libraries (found: v${Boost_VERSION_STRING})"
)
else()
set_package_properties(Boost PROPERTIES
DESCRIPTION "Portable C++ source libraries (found: v${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION})"
)
if(CMAKE_VERSION VERSION_LESS 3.14)
set(Boost_VERSION_STRING "${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}")
endif()
set_package_properties(Boost PROPERTIES
DESCRIPTION "Portable C++ source libraries (found: v${Boost_VERSION_STRING})"
)
if(CMAKE_VERSION VERSION_LESS 3.5)
if(NOT TARGET Boost::boost)
@ -761,7 +758,7 @@ if(CMAKE_VERSION VERSION_LESS 3.5)
endif()
# Fix for Boost Asio < 1.70 when using Clang in macOS
if(${Boost_VERSION} VERSION_LESS 107000)
if(Boost_VERSION_STRING VERSION_LESS 1.70.0)
# Check if we have std::string_view
include(CheckCXXSourceCompiles)
check_cxx_source_compiles("

View File

@ -44,7 +44,7 @@ target_include_directories(pvt_adapters
${CMAKE_SOURCE_DIR}/src/core/interfaces
)
if(Boost_VERSION LESS 105800)
if(Boost_VERSION_STRING VERSION_LESS 1.58.0)
target_compile_definitions(pvt_adapters PRIVATE -DOLD_BOOST=1)
endif()

View File

@ -62,7 +62,7 @@ if(ENABLE_CLANG_TIDY)
endif()
endif()
if(Boost_VERSION LESS 105800)
if(Boost_VERSION_STRING VERSION_LESS 1.58.0)
target_compile_definitions(pvt_gr_blocks PRIVATE -DOLD_BOOST=1)
endif()

View File

@ -95,7 +95,7 @@ target_include_directories(pvt_libs
target_compile_definitions(pvt_libs PRIVATE -DGNSS_SDR_VERSION="${VERSION}")
if(Boost_VERSION VERSION_GREATER "106599")
if(Boost_VERSION_STRING VERSION_GREATER 1.65.99)
target_compile_definitions(pvt_libs
PUBLIC
-DBOOST_GREATER_1_65
@ -104,7 +104,7 @@ endif()
# Fix for Boost Asio < 1.70
if(OS_IS_MACOSX)
if((CMAKE_CXX_COMPILER_ID MATCHES "Clang") AND (${Boost_VERSION} VERSION_LESS 107000))
if((CMAKE_CXX_COMPILER_ID MATCHES "Clang") AND (Boost_VERSION_STRING VERSION_LESS 1.70.0))
if(${has_string_view})
target_compile_definitions(pvt_libs
PUBLIC

View File

@ -73,23 +73,21 @@ if(ENABLE_BAD_BOOST)
message(STATUS "Enabling use of known bad versions of Boost.")
endif()
# For any unsuitable Boost version, add the version number below in
# the following format: XXYYZZ
# Where:
# XX is the major version ('10' for version 1)
# YY is the minor version number ('46' for 1.46)
# ZZ is the patcher version number (typically just '00')
set(Boost_NOGO_VERSIONS
104600 104601 104700 105200
"1.46.0" "1.46.1" "1.47.0" "1.52.0"
)
if(CMAKE_VERSION VERSION_LESS 3.14)
set(Boost_VERSION_STRING "${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}")
endif()
foreach(ver ${Boost_NOGO_VERSIONS})
if("${Boost_VERSION}" STREQUAL "${ver}")
if("${Boost_VERSION_STRING}" STREQUAL "${ver}")
if(NOT ENABLE_BAD_BOOST)
message(STATUS "WARNING: Found a known bad version of Boost (v${Boost_VERSION}). Disabling.")
message(STATUS "WARNING: Found a known bad version of Boost (v${Boost_VERSION_STRING}). Disabling.")
set(Boost_FOUND FALSE)
else()
message(STATUS "WARNING: Found a known bad version of Boost (v${Boost_VERSION}). Continuing anyway.")
message(STATUS "WARNING: Found a known bad version of Boost (v${Boost_VERSION_STRING}). Continuing anyway.")
set(Boost_FOUND TRUE)
endif()
endif()

View File

@ -83,7 +83,7 @@ endif()
# Fix for Boost Asio < 1.70
if(OS_IS_MACOSX)
if((CMAKE_CXX_COMPILER_ID MATCHES "Clang") AND (${Boost_VERSION} VERSION_LESS 107000))
if((CMAKE_CXX_COMPILER_ID MATCHES "Clang") AND (Boost_VERSION_STRING VERSION_LESS 1.70.0))
if(${has_string_view})
target_compile_definitions(signal_source_gr_blocks
PUBLIC
@ -98,7 +98,7 @@ if(OS_IS_MACOSX)
endif()
endif()
if(Boost_VERSION VERSION_GREATER "106599")
if(Boost_VERSION_STRING VERSION_GREATER 1.65.99)
target_compile_definitions(signal_source_gr_blocks
PUBLIC
-DBOOST_GREATER_1_65

View File

@ -110,7 +110,7 @@ if(NOT CMAKE_VERSION VERSION_GREATER 3.11)
)
endif()
if(Boost_VERSION VERSION_GREATER "106599")
if(Boost_VERSION_STRING VERSION_GREATER 1.65.99)
target_compile_definitions(tracking_libs
PUBLIC
-DBOOST_GREATER_1_65
@ -119,7 +119,7 @@ endif()
# Fix for Boost Asio < 1.70
if(OS_IS_MACOSX)
if((CMAKE_CXX_COMPILER_ID MATCHES "Clang") AND (${Boost_VERSION} VERSION_LESS 107000))
if((CMAKE_CXX_COMPILER_ID MATCHES "Clang") AND (Boost_VERSION_STRING VERSION_LESS 1.70.0))
if(${has_string_view})
target_compile_definitions(tracking_libs
PUBLIC

View File

@ -60,7 +60,7 @@ target_include_directories(core_monitor
)
if(Boost_VERSION VERSION_GREATER "106599")
if(Boost_VERSION_STRING VERSION_GREATER 1.65.99)
target_compile_definitions(core_monitor
PUBLIC
-DBOOST_GREATER_1_65
@ -70,7 +70,7 @@ endif()
# Fix for Boost Asio < 1.70
if(OS_IS_MACOSX)
if((CMAKE_CXX_COMPILER_ID MATCHES "Clang") AND (${Boost_VERSION} VERSION_LESS 107000))
if((CMAKE_CXX_COMPILER_ID MATCHES "Clang") AND (Boost_VERSION_STRING VERSION_LESS 1.70.0))
if(${has_string_view})
target_compile_definitions(core_monitor
PUBLIC
@ -96,7 +96,6 @@ if(ENABLE_CLANG_TIDY)
endif()
set_property(TARGET core_monitor
APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES
$<BUILD_INTERFACE:${PROTO_INCLUDE_HEADERS}>

View File

@ -124,7 +124,7 @@ if(ENABLE_CUDA)
target_compile_definitions(core_receiver PRIVATE -DCUDA_GPU_ACCEL=1)
endif()
if(Boost_VERSION VERSION_GREATER "106599")
if(Boost_VERSION_STRING VERSION_GREATER 1.65.99)
target_compile_definitions(core_receiver
PRIVATE
-DBOOST_GREATER_1_65
@ -158,7 +158,7 @@ target_link_libraries(core_receiver
# Fix for Boost Asio < 1.70
if(OS_IS_MACOSX)
if((CMAKE_CXX_COMPILER_ID MATCHES "Clang") AND (${Boost_VERSION} VERSION_LESS 107000))
if((CMAKE_CXX_COMPILER_ID MATCHES "Clang") AND (Boost_VERSION_STRING VERSION_LESS 1.70.0))
if(${has_string_view})
target_compile_definitions(core_receiver
PUBLIC