From a0acad341455b08b1a4cc408dcb76c022f722fa3 Mon Sep 17 00:00:00 2001 From: Curtis Malainey Date: Wed, 8 Sep 2021 14:54:20 -0700 Subject: [PATCH] CMake: require version 3.13 Without CMP0079 we cannot conditionally include libraries against SOF in sub directories without seriously restructuring the project. This is because the old policy requires the link target must be created in the same folder. This does not work well from a configuration standpoint for 3P audio libraries trying to keep their config in src/audio/*. Rather than enable the policy, lets simply upgrade since 3.13 is widely available. With this upgrade we can also remove the two version dependent checks at the top of our scripts. Signed-off-by: Curtis Malainey --- CMakeLists.txt | 21 +++------------------ doc/CMakeLists.txt | 2 +- scripts/cmake/version-build-counter.cmake | 2 +- scripts/cmake/version.cmake | 2 +- smex/CMakeLists.txt | 2 +- tools/CMakeLists.txt | 2 +- tools/fuzzer/CMakeLists.txt | 2 +- tools/oss-fuzz/CMakeLists.txt | 2 +- tools/probes/CMakeLists.txt | 2 +- tools/testbench/CMakeLists.txt | 2 +- tools/tplg_parser/CMakeLists.txt | 2 +- 11 files changed, 13 insertions(+), 28 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 53e5c46c0540..4cafb26c905e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ # SPDX-License-Identifier: BSD-3-Clause -cmake_minimum_required(VERSION 3.10) +cmake_minimum_required(VERSION 3.13) if("${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}") message(FATAL_ERROR @@ -10,23 +10,8 @@ if("${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}") ) endif() -if(NOT (${CMAKE_VERSION} VERSION_LESS "3.13.0")) - # CMake 3.13+ has less restrictive rules for target_link_libraries() - # Until we make 3.13 as required minimum version we want to - # use old behaviour for compatibility - cmake_policy(SET CMP0079 OLD) -endif() - -if(${CMAKE_VERSION} VERSION_LESS "3.12.0") - # FindPythonInterp is bugged and may sometimes be unable to find - # Python 3 when both Python 2 & 3 are in PATH, - # so it's always better to use CMake 3.12+ - find_package(PythonInterp 3.0) - set(PYTHON3 "${PYTHON_EXECUTABLE}") -else() - find_package(Python3 COMPONENTS Interpreter) - set(PYTHON3 "${Python3_EXECUTABLE}") -endif() +find_package(Python3 COMPONENTS Interpreter) +set(PYTHON3 "${Python3_EXECUTABLE}") option(BUILD_UNIT_TESTS "Build unit tests" OFF) option(BUILD_UNIT_TESTS_HOST "Build unit tests for host" OFF) diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index 8362f07291a3..c6e19303e07c 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -1,6 +1,6 @@ # SPDX-License-Identifier: BSD-3-Clause -cmake_minimum_required(VERSION 3.10) +cmake_minimum_required(VERSION 3.13) project(SOF_DOC NONE) diff --git a/scripts/cmake/version-build-counter.cmake b/scripts/cmake/version-build-counter.cmake index 7946c0f59845..4661d2ace34e 100644 --- a/scripts/cmake/version-build-counter.cmake +++ b/scripts/cmake/version-build-counter.cmake @@ -2,7 +2,7 @@ # Implements build counter and adds it as post-build action for sof -cmake_minimum_required(VERSION 3.10) +cmake_minimum_required(VERSION 3.13) set(VERSION_BUILD_COUNTER_CMAKE_PATH ${CMAKE_CURRENT_LIST_DIR}/version-build-counter.cmake) diff --git a/scripts/cmake/version.cmake b/scripts/cmake/version.cmake index 73b85492844b..067f108f10b5 100644 --- a/scripts/cmake/version.cmake +++ b/scripts/cmake/version.cmake @@ -7,7 +7,7 @@ # Version is checked during configuration step and for every target # that has check_version_h target as dependency -cmake_minimum_required(VERSION 3.10) +cmake_minimum_required(VERSION 3.13) set(VERSION_CMAKE_PATH ${CMAKE_CURRENT_LIST_DIR}/version.cmake) diff --git a/smex/CMakeLists.txt b/smex/CMakeLists.txt index b5bfa6a87868..631104982d51 100644 --- a/smex/CMakeLists.txt +++ b/smex/CMakeLists.txt @@ -1,6 +1,6 @@ # SPDX-License-Identifier: BSD-3-Clause -cmake_minimum_required(VERSION 3.10) +cmake_minimum_required(VERSION 3.13) project(SOF_SMEX C) diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index 77eafd0cdddd..fb16d265c070 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -1,6 +1,6 @@ # SPDX-License-Identifier: BSD-3-Clause -cmake_minimum_required(VERSION 3.10) +cmake_minimum_required(VERSION 3.13) if("${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}") message(FATAL_ERROR diff --git a/tools/fuzzer/CMakeLists.txt b/tools/fuzzer/CMakeLists.txt index a66f1714edad..53bbea1f3cce 100644 --- a/tools/fuzzer/CMakeLists.txt +++ b/tools/fuzzer/CMakeLists.txt @@ -1,6 +1,6 @@ # SPDX-License-Identifier: BSD-3-Clause -cmake_minimum_required(VERSION 3.10) +cmake_minimum_required(VERSION 3.13) project(SOF_FUZZER C) diff --git a/tools/oss-fuzz/CMakeLists.txt b/tools/oss-fuzz/CMakeLists.txt index 1821ece5057b..e025ed946ace 100644 --- a/tools/oss-fuzz/CMakeLists.txt +++ b/tools/oss-fuzz/CMakeLists.txt @@ -1,6 +1,6 @@ # SPDX-License-Identifier: BSD-3-Clause -cmake_minimum_required(VERSION 3.10) +cmake_minimum_required(VERSION 3.13) project(SOF_FUZZ_IPC C) diff --git a/tools/probes/CMakeLists.txt b/tools/probes/CMakeLists.txt index 32f89a607711..21f6f2decfb9 100644 --- a/tools/probes/CMakeLists.txt +++ b/tools/probes/CMakeLists.txt @@ -1,6 +1,6 @@ # SPDX-License-Identifier: BSD-3-Clause -cmake_minimum_required(VERSION 3.10) +cmake_minimum_required(VERSION 3.13) add_executable(sof-probes probes_main.c diff --git a/tools/testbench/CMakeLists.txt b/tools/testbench/CMakeLists.txt index aba067fbe6a2..f4445d574ace 100644 --- a/tools/testbench/CMakeLists.txt +++ b/tools/testbench/CMakeLists.txt @@ -1,6 +1,6 @@ # SPDX-License-Identifier: BSD-3-Clause -cmake_minimum_required(VERSION 3.10) +cmake_minimum_required(VERSION 3.13) project(SOF_TESTBENCH C) diff --git a/tools/tplg_parser/CMakeLists.txt b/tools/tplg_parser/CMakeLists.txt index c61034332dab..640fa677f4ed 100644 --- a/tools/tplg_parser/CMakeLists.txt +++ b/tools/tplg_parser/CMakeLists.txt @@ -1,6 +1,6 @@ # SPDX-License-Identifier: BSD-3-Clause -cmake_minimum_required(VERSION 3.10) +cmake_minimum_required(VERSION 3.13) project(SOF_TPLG_PARSER C)