summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri@ouroboros.rocks>2024-01-21 11:49:00 +0100
committerSander Vrijders <sander@ouroboros.rocks>2024-01-31 10:27:56 +0100
commitdb09a1406e8165dc607a900b719852e2275cf717 (patch)
tree91ec9de3cf81b62a9086c00a3d58450c1d4769d3
parent02f68ff5ccc637b2177f832a4f7ddf4f9f737d22 (diff)
downloadouroboros-db09a1406e8165dc607a900b719852e2275cf717.tar.gz
ouroboros-db09a1406e8165dc607a900b719852e2275cf717.zip
cmake: Use execute_process in newer CMake versions
Fixes warnings in CMake 3.28 and newer related to CMP0153. https://cmake.org/cmake/help/latest/policy/CMP0153.html Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
-rw-r--r--CMakeLists.txt2
-rw-r--r--cmake/CmakeUninstall.cmake.in22
2 files changed, 16 insertions, 8 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index dd356216..e6340e55 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 2.8.12.2...3.27.1)
+cmake_minimum_required(VERSION 2.8.12.2...3.28.1)
cmake_policy(VERSION ${CMAKE_VERSION})
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
diff --git a/cmake/CmakeUninstall.cmake.in b/cmake/CmakeUninstall.cmake.in
index 4c07dc7b..985b31b2 100644
--- a/cmake/CmakeUninstall.cmake.in
+++ b/cmake/CmakeUninstall.cmake.in
@@ -7,14 +7,22 @@ string(REGEX REPLACE "\n" ";" files "${files}")
foreach(file ${files})
message(STATUS "Uninstalling $ENV{DESTDIR}${file}")
if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
- exec_program(
- "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
- OUTPUT_VARIABLE rm_out
- RETURN_VALUE rm_retval
- )
- if(NOT "${rm_retval}" STREQUAL 0)
+ if(CMAKE_VERSION VERSION_LESS "3.28.0")
+ exec_program(
+ "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
+ OUTPUT_VARIABLE rm_out
+ RETURN_VALUE rm_retval
+ )
+ else()
+ execute_process(
+ COMMAND @CMAKE_COMMAND@ -E remove "$ENV{DESTDIR}${file}"
+ RESULT_VARIABLE rm_out
+ ERROR_VARIABLE rm_retval
+ )
+ endif ()
+ if(NOT "${rm_retval}" STREQUAL "" AND NOT "${rm_retval}" STREQUAL 0)
message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}")
- endif(NOT "${rm_retval}" STREQUAL 0)
+ endif(NOT "${rm_retval}" STREQUAL "" AND NOT "${rm_retval}" STREQUAL 0)
else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
message(STATUS "File $ENV{DESTDIR}${file} does not exist.")
endif(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")