From 5951dab871861164b0590aadb5276264af39d605 Mon Sep 17 00:00:00 2001 From: Avinash Sonawane Date: Wed, 21 Feb 2024 11:15:11 +0530 Subject: [PATCH 1/3] CMake: Replace deprecated exec_program() with execute_process() --- src/cdogs/yajl/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cdogs/yajl/CMakeLists.txt b/src/cdogs/yajl/CMakeLists.txt index 97af2fd18..266decaae 100644 --- a/src/cdogs/yajl/CMakeLists.txt +++ b/src/cdogs/yajl/CMakeLists.txt @@ -70,7 +70,7 @@ configure_file(yajl.pc.cmake ${shareDir}/yajl.pc) foreach (header ${PUB_HDRS}) set (header ${CMAKE_CURRENT_SOURCE_DIR}/${header}) - exec_program(${CMAKE_COMMAND} ARGS -E copy_if_different ${header} ${incDir}) + execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different ${header} ${incDir}) add_custom_command(TARGET yajl_s POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different ${header} ${incDir}) From a287da0afd880573d45c87f44c7c8134d4653a00 Mon Sep 17 00:00:00 2001 From: Avinash Sonawane Date: Wed, 21 Feb 2024 12:43:28 +0530 Subject: [PATCH 2/3] Specify required cmake version in top-level CMakeLists.txt only --- CMakeLists.txt | 2 +- src/cdogs/enet/CMakeLists.txt | 7 +++---- src/proto/nanopb/CMakeLists.txt | 2 -- src/proto/nanopb/conan-wrapper/CMakeLists.txt | 1 - src/tests/cbehave/CMakeLists.txt | 1 - 5 files changed, 4 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 677137b89..f4f69acfd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -64,7 +64,7 @@ endif() set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/src/proto/nanopb/extra") - + find_package(Nanopb 0.4.5...<1.0.0 REQUIRED) find_package(SDL2 REQUIRED) message("SDL2 include dir: ${SDL2_INCLUDE_DIRS}") diff --git a/src/cdogs/enet/CMakeLists.txt b/src/cdogs/enet/CMakeLists.txt index ff6b420a3..26e171f4f 100644 --- a/src/cdogs/enet/CMakeLists.txt +++ b/src/cdogs/enet/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 3.1) cmake_policy(SET CMP0054 NEW) project(enet) @@ -24,7 +23,7 @@ if(MSVC) else() add_definitions(-Wno-error) endif() - + if(HAS_FCNTL) add_definitions(-DHAS_FCNTL=1) endif() @@ -55,9 +54,9 @@ endif() if(HAS_SOCKLEN_T) add_definitions(-DHAS_SOCKLEN_T=1) endif() - + include_directories(${PROJECT_SOURCE_DIR}/include) - + add_library(enet STATIC callbacks.c compress.c diff --git a/src/proto/nanopb/CMakeLists.txt b/src/proto/nanopb/CMakeLists.txt index e7a168ce8..0960003c0 100644 --- a/src/proto/nanopb/CMakeLists.txt +++ b/src/proto/nanopb/CMakeLists.txt @@ -1,5 +1,3 @@ -cmake_minimum_required(VERSION 2.8.12) - project(nanopb C) set(nanopb_VERSION_STRING nanopb-0.4.4) diff --git a/src/proto/nanopb/conan-wrapper/CMakeLists.txt b/src/proto/nanopb/conan-wrapper/CMakeLists.txt index 5f11fd9dc..842694700 100644 --- a/src/proto/nanopb/conan-wrapper/CMakeLists.txt +++ b/src/proto/nanopb/conan-wrapper/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 2.8.12) project(cmake_wrapper) include(${CMAKE_CURRENT_BINARY_DIR}/conanbuildinfo.cmake) diff --git a/src/tests/cbehave/CMakeLists.txt b/src/tests/cbehave/CMakeLists.txt index 2daf61171..cb48c96b6 100644 --- a/src/tests/cbehave/CMakeLists.txt +++ b/src/tests/cbehave/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 3.0) project(cbehave C) include_directories(.) From 2bec3e98a9c2d71884799f701e855505cc75f772 Mon Sep 17 00:00:00 2001 From: Avinash Sonawane Date: Wed, 21 Feb 2024 12:51:08 +0530 Subject: [PATCH 3/3] cmake: handle version range while locating nanopb --- src/proto/nanopb/extra/FindNanopb.cmake | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/proto/nanopb/extra/FindNanopb.cmake b/src/proto/nanopb/extra/FindNanopb.cmake index a6c34fa9b..be3d798a1 100644 --- a/src/proto/nanopb/extra/FindNanopb.cmake +++ b/src/proto/nanopb/extra/FindNanopb.cmake @@ -362,9 +362,7 @@ find_path(NANOPB_GENERATOR_SOURCE_DIR mark_as_advanced(NANOPB_GENERATOR_SOURCE_DIR) include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(Nanopb DEFAULT_MSG - NANOPB_INCLUDE_DIRS - NANOPB_SRCS NANOPB_HDRS - NANOPB_GENERATOR_SOURCE_DIR - PROTOBUF_PROTOC_EXECUTABLE +find_package_handle_standard_args(Nanopb + REQUIRED_VARS NANOPB_INCLUDE_DIRS NANOPB_SRCS NANOPB_HDRS NANOPB_GENERATOR_SOURCE_DIR PROTOBUF_PROTOC_EXECUTABLE + HANDLE_VERSION_RANGE )