From 09b6b2305e5424d9666d40171518d2871040e2ea Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 22 Jul 2019 14:13:57 +0200 Subject: [PATCH] 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) ) --- CMakeLists.txt | 17 +++++++---------- src/algorithms/PVT/adapters/CMakeLists.txt | 2 +- .../PVT/gnuradio_blocks/CMakeLists.txt | 2 +- src/algorithms/PVT/libs/CMakeLists.txt | 4 ++-- .../volk_gnsssdr/cmake/Modules/VolkBoost.cmake | 18 ++++++++---------- .../gnuradio_blocks/CMakeLists.txt | 4 ++-- src/algorithms/tracking/libs/CMakeLists.txt | 4 ++-- src/core/monitor/CMakeLists.txt | 5 ++--- src/core/receiver/CMakeLists.txt | 4 ++-- 9 files changed, 27 insertions(+), 33 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9e4865db9..9aeba759f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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(" diff --git a/src/algorithms/PVT/adapters/CMakeLists.txt b/src/algorithms/PVT/adapters/CMakeLists.txt index 013fcdd83..bed0f0dfc 100644 --- a/src/algorithms/PVT/adapters/CMakeLists.txt +++ b/src/algorithms/PVT/adapters/CMakeLists.txt @@ -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() diff --git a/src/algorithms/PVT/gnuradio_blocks/CMakeLists.txt b/src/algorithms/PVT/gnuradio_blocks/CMakeLists.txt index 081a1ab49..bb4c2d432 100644 --- a/src/algorithms/PVT/gnuradio_blocks/CMakeLists.txt +++ b/src/algorithms/PVT/gnuradio_blocks/CMakeLists.txt @@ -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() diff --git a/src/algorithms/PVT/libs/CMakeLists.txt b/src/algorithms/PVT/libs/CMakeLists.txt index 6850f3515..d20cac4c6 100644 --- a/src/algorithms/PVT/libs/CMakeLists.txt +++ b/src/algorithms/PVT/libs/CMakeLists.txt @@ -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 diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Modules/VolkBoost.cmake b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Modules/VolkBoost.cmake index 2aea96b2a..1a966bbe3 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Modules/VolkBoost.cmake +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Modules/VolkBoost.cmake @@ -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() diff --git a/src/algorithms/signal_source/gnuradio_blocks/CMakeLists.txt b/src/algorithms/signal_source/gnuradio_blocks/CMakeLists.txt index 6a1ff6e62..7331f0478 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/CMakeLists.txt +++ b/src/algorithms/signal_source/gnuradio_blocks/CMakeLists.txt @@ -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 diff --git a/src/algorithms/tracking/libs/CMakeLists.txt b/src/algorithms/tracking/libs/CMakeLists.txt index 77178d036..09cc778a7 100644 --- a/src/algorithms/tracking/libs/CMakeLists.txt +++ b/src/algorithms/tracking/libs/CMakeLists.txt @@ -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 diff --git a/src/core/monitor/CMakeLists.txt b/src/core/monitor/CMakeLists.txt index 7fb4008dd..5d0b710d3 100644 --- a/src/core/monitor/CMakeLists.txt +++ b/src/core/monitor/CMakeLists.txt @@ -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 $ diff --git a/src/core/receiver/CMakeLists.txt b/src/core/receiver/CMakeLists.txt index 08e8bec98..95435e407 100644 --- a/src/core/receiver/CMakeLists.txt +++ b/src/core/receiver/CMakeLists.txt @@ -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