Skip to content

Commit eb038cf

Browse files
committed
Keep fix the CMake compatibility issue
``` CMake Error at CMakeLists.txt:4 (cmake_minimum_required): Compatibility with CMake < 3.5 has been removed from CMake. Update the VERSION argument <min> value. Or, use the <min>...<max> syntax to tell CMake that the project requires at least <min> but has been updated to work with policies introduced by <max> or earlier. Or, add -DCMAKE_POLICY_VERSION_MINIMUM=3.5 to try configuring anyway. ```
1 parent 4e50d21 commit eb038cf

24 files changed

Lines changed: 60 additions & 19 deletions

File tree

core/iwasm/fast-jit/iwasm_fast_jit.cmake

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
11
# Copyright (C) 2019 Intel Corporation. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
33

4-
set (IWASM_FAST_JIT_DIR ${CMAKE_CURRENT_LIST_DIR})
4+
include(CMakePrintHelpers)
5+
6+
# Yes. To solve the compatibility issue with CMAKE (>= 4.0), we need to update
7+
# our `cmake_minimum_required()` to 3.14. However, there are CMakeLists.txt
8+
# from 3rd parties that we should not alter. Therefore, in addition to
9+
# changing the `cmake_minimum_required()`, we should also add a configuration
10+
# here that is compatible with earlier versions.
11+
set(CMAKE_POLICY_VERSION_MINIMUM 3.5 FORCE)
512

13+
set (IWASM_FAST_JIT_DIR ${CMAKE_CURRENT_LIST_DIR})
614
add_definitions(-DWASM_ENABLE_FAST_JIT=1)
715
if (WAMR_BUILD_FAST_JIT_DUMP EQUAL 1)
816
add_definitions(-DWASM_ENABLE_FAST_JIT_DUMP=1)
@@ -27,6 +35,9 @@ if (WAMR_BUILD_TARGET STREQUAL "X86_64" OR WAMR_BUILD_TARGET STREQUAL "AMD_64")
2735
PATCH_COMMAND git apply ${IWASM_FAST_JIT_DIR}/asmjit_sgx_patch.diff
2836
)
2937
endif ()
38+
39+
cmake_print_variables(CMAKE_POLICY_VERSION_MINIMUM WAMR_BUILD_FAST_JIT_DUMP)
40+
3041
FetchContent_GetProperties(asmjit)
3142
if (NOT asmjit_POPULATED)
3243
message ("-- Fetching asmjit ..")
@@ -51,6 +62,9 @@ if (WAMR_BUILD_TARGET STREQUAL "X86_64" OR WAMR_BUILD_TARGET STREQUAL "AMD_64")
5162
)
5263
endif ()
5364
if (WAMR_BUILD_FAST_JIT_DUMP EQUAL 1)
65+
66+
cmake_print_variables(CMAKE_POLICY_VERSION_MINIMUM)
67+
5468
FetchContent_Declare(
5569
zycore
5670
GIT_REPOSITORY https://github.com/zyantific/zycore-c.git
@@ -66,6 +80,8 @@ if (WAMR_BUILD_TARGET STREQUAL "X86_64" OR WAMR_BUILD_TARGET STREQUAL "AMD_64")
6680
add_subdirectory(${zycore_SOURCE_DIR} ${zycore_BINARY_DIR} EXCLUDE_FROM_ALL)
6781
file (GLOB_RECURSE c_source_zycore ${zycore_SOURCE_DIR}/src/*.c)
6882
endif ()
83+
84+
cmake_print_variables(CMAKE_POLICY_VERSION_MINIMUM)
6985
FetchContent_Declare(
7086
zydis
7187
GIT_REPOSITORY https://github.com/zyantific/zydis.git

samples/multi-module/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ ExternalProject_Add(WASM_MODULE
148148
-DCMAKE_TOOLCHAIN_FILE=${WASI_TOOLCHAIN_FILE}
149149
-DCMAKE_SYSROOT=${WASI_SYS_ROOT}
150150
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
151+
-DCMAKE_POLICY_VERSION_MINIMUM=3.5
151152
-S ${CMAKE_CURRENT_SOURCE_DIR}/wasm-apps
152153
BUILD_COMMAND ${CMAKE_COMMAND} --build .
153154
INSTALL_COMMAND ${CMAKE_COMMAND} -E copy

samples/multi-module/wasm-apps/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@
44
cmake_minimum_required (VERSION 3.14)
55
project(wasm-apps)
66

7+
# Yes. To solve the compatibility issue with CMAKE (>= 4.0), we need to update
8+
# our `cmake_minimum_required()` to 3.14. However, there are CMakeLists.txt
9+
# from 3rd parties that we should not alter. Therefore, in addition to
10+
# changing the `cmake_minimum_required()`, we should also add a configuration
11+
# here that is compatible with earlier versions.
12+
set(CMAKE_POLICY_VERSION_MINIMUM 3.5)
13+
714
message(CHECK_START "Detecting WABT")
815
if(NOT (DEFINED WABT_DIR OR DEFINED CACHE{WABT_DIR}))
916
find_path(WABT_DIR

samples/socket-api/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ ExternalProject_Add(wasm-app
8787
-DWASI_SDK_PREFIX=${WASI_SDK_DIR}
8888
-DCMAKE_TOOLCHAIN_FILE=${WASI_TOOLCHAIN_FILE}
8989
-DCMAKE_SYSROOT=${WASI_SYS_ROOT}
90+
-DCMAKE_POLICY_VERSION_MINIMUM=3.5
9091
${CMAKE_CURRENT_SOURCE_DIR}/wasm-src
9192
BUILD_COMMAND ${CMAKE_COMMAND} --build .
9293
INSTALL_COMMAND ${CMAKE_COMMAND} -E copy

samples/socket-api/wasm-src/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@
44
cmake_minimum_required(VERSION 3.14)
55
project(socket_api_sample_wasm_app)
66

7+
# Yes. To solve the compatibility issue with CMAKE (>= 4.0), we need to update
8+
# our `cmake_minimum_required()` to 3.14. However, there are CMakeLists.txt
9+
# from 3rd parties that we should not alter. Therefore, in addition to
10+
# changing the `cmake_minimum_required()`, we should also add a configuration
11+
# here that is compatible with earlier versions.
12+
set(CMAKE_POLICY_VERSION_MINIMUM 3.5)
13+
714
message(CHECK_START "Detecting WABT")
815
if(NOT (DEFINED WABT_DIR OR DEFINED CACHE{WABT_DIR}))
916
find_path(WABT_DIR

samples/wasm-c-api-imports/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ if(WAMR_BUILD_AOT EQUAL 1 AND WAMR_BUILD_INTERP EQUAL 0)
146146
-DWASM_TO_AOT=ON
147147
-DWAMRC_PATH=${CMAKE_CURRENT_BINARY_DIR}/wamrc
148148
-DSOCKET_WASI_CMAKE=${WAMR_ROOT}/core/iwasm/libraries/lib-socket/lib_socket_wasi.cmake
149+
-DCMAKE_POLICY_VERSION_MINIMUM=3.5
149150
BUILD_COMMAND ${CMAKE_COMMAND} --build build
150151
INSTALL_COMMAND ${CMAKE_COMMAND} --install build --prefix ${CMAKE_CURRENT_BINARY_DIR}
151152
)
@@ -159,6 +160,7 @@ else()
159160
-DCMAKE_TOOLCHAIN_FILE=${WASI_TOOLCHAIN_FILE}
160161
-DCMAKE_SYSROOT=${WASI_SYS_ROOT}
161162
-DSOCKET_WASI_CMAKE=${WAMR_ROOT}/core/iwasm/libraries/lib-socket/lib_socket_wasi.cmake
163+
-DCMAKE_POLICY_VERSION_MINIMUM=3.5
162164
BUILD_COMMAND ${CMAKE_COMMAND} --build build
163165
INSTALL_COMMAND ${CMAKE_COMMAND} --install build --prefix ${CMAKE_CURRENT_BINARY_DIR}
164166
)

tests/fuzz/wasm-mutator-fuzz/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Copyright (C) 2019 Intel Corporation. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
33

4-
cmake_minimum_required (VERSION 2.8)
4+
cmake_minimum_required (VERSION 3.14)
55

66
if (NOT DEFINED CMAKE_C_COMPILER)
77
set (CMAKE_C_COMPILER "clang")

tests/fuzz/wasm-mutator-fuzz/workspace/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Copyright (C) 2019 Intel Corporation. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
33

4-
cmake_minimum_required (VERSION 2.8)
4+
cmake_minimum_required (VERSION 3.14)
55

66
project(wasm_mutator)
77

tests/standalone/test-module-malloc/wasm-app/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Copyright (C) 2019 Intel Corporation. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
33

4-
cmake_minimum_required(VERSION 3.0)
4+
cmake_minimum_required(VERSION 3.14)
55
project(wasm-app)
66

77
set (WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../../..)

tests/unit/CMakeLists.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
# Copyright (C) 2019 Intel Corporation. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
33

4-
cmake_minimum_required(VERSION 2.9)
4+
cmake_minimum_required(VERSION 3.14)
55

66
project(unit-test)
77

8+
# Yes. To solve the compatibility issue with CMAKE (>= 4.0), we need to update
9+
# our `cmake_minimum_required()` to 3.14. However, there are CMakeLists.txt
10+
# from 3rd parties that we should not alter. Therefore, in addition to
11+
# changing the `cmake_minimum_required()`, we should also add a configuration
12+
# here that is compatible with earlier versions.
13+
set(CMAKE_POLICY_VERSION_MINIMUM 3.5)
14+
815
SET(CMAKE_BUILD_TYPE Debug)
916

1017
# add_definitions (-m32)

0 commit comments

Comments
 (0)