gmic/0001-Don-t-use-CMake-commands-not-available-in-CMake-3.9.patch
2020-09-08 11:01:48 +00:00

81 lines
2.7 KiB
Diff

From 60377bb25c4f1c8075e17310b00383a4761c9be0 Mon Sep 17 00:00:00 2001
From: Christophe Giboudeaux <christophe@krop.fr>
Date: Sun, 14 Jun 2020 14:57:05 +0200
Subject: [PATCH] Don't use CMake commands not available in CMake 3.9
---
CMakeLists.txt | 2 +-
cmake/FindCImg.cmake | 24 +++++++++++++++---------
2 files changed, 16 insertions(+), 10 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 537ea01..80960be 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -53,7 +53,7 @@
# knowledge of the CeCILL and CeCILL-C licenses and that you accept its terms.
#
-cmake_minimum_required(VERSION 3.14.0)
+cmake_minimum_required(VERSION 3.9.0)
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
message("Build directory is equal to source directory. Binaries will be put in the src directory.")
diff --git a/cmake/FindCImg.cmake b/cmake/FindCImg.cmake
index b5c9005..cbbaba6 100644
--- a/cmake/FindCImg.cmake
+++ b/cmake/FindCImg.cmake
@@ -65,7 +65,8 @@ if(ENABLE_CURL)
if(CURL_FOUND)
list(APPEND COMPILE_FLAGS "cimg_use_curl")
- list(APPEND EXTRA_LIBRARY_TARGETS CURL::libcurl)
+ list(APPEND EXTRA_LIBRARY_TARGETS ${CURL_LIBRARIES})
+ list(APPEND HEADER_DIR ${CURL_INCLUDE_DIRS})
endif()
endif()
@@ -74,10 +75,11 @@ if(ENABLE_X)
find_package(X11)
if(X11_FOUND)
- list(APPEND COMPILE_FLAGS "cimg_display=1" "cimg_appname=\"gmic\"")
- list(APPEND EXTRA_LIBRARY_TARGETS X11::X11)
+ list(APPEND COMPILE_FLAGS cimg_display=1 cimg_appname=\"gmic\")
+ list(APPEND EXTRA_LIBRARY_TARGETS ${X11_LIBRARIES})
+ list(APPEND HEADER_DIR ${X11_INCLUDE_DIR})
else()
- list(APPEND COMPILE_FLAGS "cimg_display=0" "cimg_appname=\"gmic\"")
+ list(APPEND COMPILE_FLAGS cimg_display=0 cimg_appname=\"gmic\")
endif()
if(ENABLE_XSHM AND X11_XShm_FOUND)
@@ -142,7 +144,8 @@ if(ENABLE_JPEG)
if(JPEG_FOUND)
list(APPEND CLI_COMPILE_FLAGS "cimg_use_jpeg")
- list(APPEND EXTRA_LIBRARY_TARGETS JPEG::JPEG)
+ list(APPEND EXTRA_LIBRARY_TARGETS ${JPEG_LIBRARIES})
+ list(APPEND HEADER_DIR ${JPEG_INCLUDE_DIRS})
endif()
endif()
@@ -169,7 +172,10 @@ endif()
add_library(CImg::CImg INTERFACE IMPORTED)
-target_compile_definitions(CImg::CImg INTERFACE ${COMPILE_FLAGS} ${CLI_COMPILE_FLAGS})
-target_link_options(CImg::CImg INTERFACE ${LINK_FLAGS})
-target_link_libraries(CImg::CImg INTERFACE ${EXTRA_LIBRARY_TARGETS})
-target_include_directories(CImg::CImg INTERFACE ${HEADER_DIR})
+set(CIMG_BUILD_FLAGS ${COMPILE_FLAGS} ${CLI_COMPILE_FLAGS})
+
+set_target_properties(CImg::CImg PROPERTIES
+ INTERFACE_COMPILE_DEFINITIONS "${CIMG_BUILD_FLAGS}"
+ INTERFACE_INCLUDE_DIRECTORIES "${HEADER_DIR}"
+ INTERFACE_LINK_LIBRARIES "${EXTRA_LIBRARY_TARGETS}"
+)
--
2.28.0