Add curl support for the cli app and base library and make it truly optional
for gmic-qt instead of automagic.

--- gmic-2.4.3/CMakeLists.txt
+++ gmic-2.4.3/CMakeLists.txt
@@ -83,6 +83,7 @@
 option(BUILD_MAN "Build the manpage" ON)
 option(BUILD_BASH_COMPLETION "Build Bash completion" ON)
 option(CUSTOM_CFLAGS "Override default compiler optimization flags" OFF)
+option(ENABLE_CURL "Add support for curl" ON)
 option(ENABLE_X "Add support for X11" ON)
 option(ENABLE_FFMPEG "Add support for FFMpeg" ON)
 option(ENABLE_FFTW "Add support for FFTW" ON)
@@ -136,6 +137,16 @@
   link_directories(${ZLIB_LIBRARY_DIRS})
 endif()
 
+# curl support
+if(ENABLE_CURL)
+  find_package(CURL)
+endif()
+if(CURL_FOUND)
+  set(COMPILE_FLAGS "${COMPILE_FLAGS} -Dcimg_use_curl")
+  include_directories(${CURL_INCLUDE_DIRS})
+  link_directories(${CURL_LIBRARY_DIRS})
+endif()
+
 #X11 support
 if(ENABLE_X)
   find_package(X11)
@@ -288,6 +299,7 @@
     ${OPENEXR_LIBRARIES}
     ${OPENCV_LIBRARIES}
     ${ZLIB_LIBRARIES}
+    ${CURL_LIBRARIES}
     ${FFTW3_LIBRARIES}
     ${EXTRA_LIBRARIES}
   )
@@ -316,6 +328,7 @@
     ${OPENEXR_LIBRARIES}
     ${OPENCV_LIBRARIES}
     ${ZLIB_LIBRARIES}
+    ${CURL_LIBRARIES}
     ${FFTW3_LIBRARIES}
     ${EXTRA_LIBRARIES}
   )
@@ -345,6 +358,7 @@
       ${OPENEXR_LIBRARIES}
       ${OPENCV_LIBRARIES}
       ${ZLIB_LIBRARIES}
+      ${CURL_LIBRARIES}
       ${FFTW3_LIBRARIES}
       ${EXTRA_LIBRARIES}
     )
--- gmic-2.4.3/gmic-qt/CMakeLists.txt
+++ gmic-2.4.3/gmic-qt/CMakeLists.txt
@@ -30,6 +30,7 @@
 message("G'MIC path: " ${GMIC_PATH})
 
 option(ENABLE_DYNAMIC_LINKING "Dynamically link the binaries to the GMIC shared library" OFF)
+option(ENABLE_CURL "Add support for curl" ON)
 set (GMIC_LIB_PATH "${GMIC_PATH}" CACHE STRING "Define the path to the GMIC shared library")
 
 #
@@ -149,10 +150,12 @@
 #
 # CURL
 #
-find_package(CURL)
-if (CURL_FOUND)
-    add_definitions(-Dcimg_use_curl)
-    include_directories(SYSTEM ${CURL_INCLUDE_DIRS} )
+if(ENABLE_CURL)
+    find_package(CURL)
+    if (CURL_FOUND)
+        add_definitions(-Dcimg_use_curl)
+        include_directories(SYSTEM ${CURL_INCLUDE_DIRS} )
+    endif()
 endif()
 
 #
@@ -187,11 +190,13 @@
         ${ZLIB_LIBRARIES}
 )
 
-if (CURL_FOUND)
-    set(gmic_qt_LIBRARIES
-        ${gmic_qt_LIBRARIES}
-        ${CURL_LIBRARIES}
-    )
+if(ENABLE_CURL)
+    if (CURL_FOUND)
+        set(gmic_qt_LIBRARIES
+            ${gmic_qt_LIBRARIES}
+            ${CURL_LIBRARIES}
+        )
+    endif()
 endif()
 
 add_definitions(-Dgmic_build)
