Skip to content

Commit

Permalink
CMake: require version 3.13
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
cujomalainey authored and lgirdwood committed Sep 10, 2021
1 parent 9a09b97 commit a0acad3
Show file tree
Hide file tree
Showing 11 changed files with 13 additions and 28 deletions.
21 changes: 3 additions & 18 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion doc/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
2 changes: 1 addition & 1 deletion scripts/cmake/version-build-counter.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion scripts/cmake/version.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion smex/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
2 changes: 1 addition & 1 deletion tools/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion tools/fuzzer/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
2 changes: 1 addition & 1 deletion tools/oss-fuzz/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
2 changes: 1 addition & 1 deletion tools/probes/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion tools/testbench/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
2 changes: 1 addition & 1 deletion tools/tplg_parser/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)

Expand Down

0 comments on commit a0acad3

Please sign in to comment.