View Issue Details

IDProjectCategoryView StatusLast Update
0015980ScribusBuild Systempublic2019-12-14 08:20
Reporterale Assigned To 
PrioritynormalSeverityminorReproducibilityN/A
Status newResolutionopen 
Product Version1.5.6.svn 
Target VersionFixed in Version 
Summary0015980: [PATCH] clean up the cmake files
Descriptiontonight, dakon showed in irc and listed a few issues with our cmake files.

there seem to be checks for cmake < 2.6 (while we're requiring 3.5) and many of the modules we are shipping can be removed and standard modules can be used.

i attache the irc log below.
TagsNo tags attached.
PatchYes

Activities

ale

2019-12-01 21:28

manager   ~0047184

Last edited: 2019-12-01 21:35

View 3 revisions

a user just was over at #cmake to get some assistance building scribus with poppler in a custom location
looks like the modules misuse the include path of it
but it resulted in me looking in cmake/modules and noticing there is a bunch of code for CMake <2.6 in there
I strongly suggest getting rid of that
also the modules that duplicate what CMake has upstream, e.g. FindLibXml2, FindFreetype and so on
you can probably just delete half of that directory with minimal adaption
I suggest using the imported modules that the newer upstream modules provide, e.g. ZLIB::ZLIB, as they bundle all needed things in one call
and for me it looks like all poppler includes are wrong
they use <poppler/*>, while it should be just <*>
the poppler pkg-config file exports the directory as .../include/poppler
this only happens to work if things are in /usr/include/poppler

deleting the pre-2.6 code should be easy, there are several if(cmake_version) things then can just be deleted
just look at the first line of FindPOPPLER.cmake

and for the things you find through pkg-config I suggest to have a look at the IMPORTED_TARGET argument to pkg_search_module()

also passing this whole /usr{local/}?/lib{,64,${CMAKE_LIBRARY_ARCH}) stuff to find_library is totally needless, these are default paths searched anyway

the configreport.cmake can probably be replaced with FeatureSummary.cmake from upstream

ale

2019-12-01 22:13

manager   ~0047185

we will need to make sure that the change work on all system (linux, bsd, macos, os/2, ...)

ale

2019-12-02 09:30

manager   ~0047187

Last edited: 2019-12-03 13:22

View 2 revisions

here the action taken:

- [x] remove the unused modules
  - [x] LCMS (we're using LCMS2)
  - [x] remove the modules in `old/`
  - [x] remove Zlib (which was only used by the old Png module)
- [x] remove the _duplicate_ modules (cmake already provides better ones)
  - [x] ZLib
  - [x] Freetype
  - [x] LibXml2
  - [x] Fontconfig can't be removed yet since the module is only in cmake 3.14.0+
    - [x] Add a note about it in the main `CMakeLists.txt`
- [x] Replace the Scribus Fontconfig module by the 3.14.0 one
- [x] Get fontconfig to link
- Warning: When compiling on macos, `/opt/local/include` might not be automatically detected anymore
- [x] remove `ScribusFindPackageHandleStandardArgs`
- [x] remove all `CMAKE_MAJOR_VERSION` that target anything lower then the current required minimum
- [x] remove paths from find_library() and friends that are already searched by default (like /usr/lib64 and /usr/local/*)
- [x] line 27 in `FindGMAGICK.cmake` is probably just some noise
- [x] simplify the poppler finding, put it in `_Dependencies`, and remove `poppler/` from the `#include<poppler/....h>`
    - the current includes only work because we have `/usr/include` by default, and stuff is in `/usr/include/poppler`. no way to have poppler in a different path.

ale

2019-12-03 13:46

manager   ~0047192

hier ist die merge request...

https://gitlab.com/scribus/scribus/merge_requests/18

don't forget to comment, like, subscribe, hit the notification bell...

... and i'll add a diff as soon it's clear that i'm not getting further hints from the cmake guys...
but you're already welcome to commit the patch as is.

(btw, there were some very helpful people in #cmake . thanks!)

ale

2019-12-03 13:54

manager   ~0047193

we could also remove the cairo detection and deprecate `-DPREFIX_CAIRO` in favor of `export PKG_CONFIG_PATH=/path/to/cairo` what do you think?

ale

2019-12-05 08:35

manager   ~0047200

ok, i got no feedback from the cmake guys anymore... here is the patch.

cmake-refactoring.diff (42,305 bytes)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 821e5fa148099604f90390fce36a4b6db8ad1426..8ae0bada740786dd5ac0d9400903a00a0c846f8f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -7,6 +7,8 @@
 #Require 3.2.0 for add_custom_target with byproducts
 #Require 3.12 for new Find Python modules
 cmake_minimum_required(VERSION 3.12.0 FATAL_ERROR)
+#TODO: as soon as we require 3.14.0, use the Cmake own modules for
+# - Fontconfig
 
 message(STATUS "CMake Version: ${CMAKE_VERSION}")
 
@@ -404,7 +406,6 @@ include_directories(
 	${CMAKE_BINARY_DIR}/scribus
 	${QT_INCLUDES}
 	${FREETYPE_INCLUDE_DIR}
-	${FONTCONFIG_INCLUDE_DIR}
 	${JPEG_INCLUDE_DIR}
 	${LCMS2_INCLUDE_DIR}
 	${LIBXML2_INCLUDE_DIR}
diff --git a/CMakeLists_Dependencies.cmake b/CMakeLists_Dependencies.cmake
index 8bb70eeffb38f9da8c74254b65b37738a70b0ec5..6477d4d514830086259f091864f27b3f544dfe99 100644
--- a/CMakeLists_Dependencies.cmake
+++ b/CMakeLists_Dependencies.cmake
@@ -235,15 +235,12 @@ endif()
 
 #<<FontConfig
 if(NOT WIN32)
-	set(FONTCONFIG_DIR ${CMAKE_MODULE_PATH})
-	find_package(FONTCONFIG)
-	if(FONTCONFIG_FOUND)
+	# Windows builds neither use nor require fontconfig
+	find_package(Fontconfig REQUIRED)
+	if(Fontconfig_FOUND)
 		message("FontConfig Found OK")
 		set(HAVE_FONTCONFIG ON)
 	endif()
-else()
-	# Windows builds neither use nor require fontconfig
-	set(FONTCONFIG_INCLUDE_DIR)
 endif()
 #>>FontConfig
 
@@ -302,12 +299,17 @@ endif()
 #>> GraphicsMagick for image import
 
 #<<Poppler for PDF import
-find_package(POPPLER REQUIRED)
+pkg_search_module(POPPLER IMPORTED_TARGET libpoppler>=0.58 poppler>=0.58)
 if (POPPLER_FOUND)
+    pkg_search_module(POPPLER_CPP REQUIRED IMPORTED_TARGET libpoppler-cpp>=0.58 poppler-cpp>=0.58)
+
 	set(HAVE_POPPLER ON)
+    set(POPPLER_LIBRARY  PkgConfig::POPPLER PkgConfig::POPPLER_CPP)
+
 	message(STATUS "Found poppler")
 	message(STATUS "Found poppler libs: ${POPPLER_LIBRARY}")
-	message(STATUS "Found poppler includes: ${POPPLER_INCLUDE_DIR}")
+	message(STATUS "Found poppler includes: ${POPPLER_INCLUDE_DIRS}")
+	message(STATUS "Found poppler-cpp includes: ${POPPLER_CPP_INCLUDE_DIRS}")
 else()
 	message(FATAL_ERROR "Could not find poppler library")
 endif()
diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake
index fafe00521fdc0a71be22262b1222145facd15250..6f4489bd9a1b6f6ce6ddfb6cea63a1aff90d293e 100644
--- a/ConfigureChecks.cmake
+++ b/ConfigureChecks.cmake
@@ -8,8 +8,6 @@ include(CheckLibraryExists)
 #include(CheckPrototypeExists)
 include(CheckTypeSize)
 
-
-#check for libz using the cmake supplied FindZLIB.cmake
 if(ZLIB_FOUND)
    set(HAVE_LIBZ 1)
 else(ZLIB_FOUND)
diff --git a/cmake/modules/CAIROConfig.cmake b/cmake/modules/CAIROConfig.cmake
index 14abfdea84259c913bb24abd05b93c35201e2255..c047da39fa2e729b52f00eb903fcde436643c55c 100644
--- a/cmake/modules/CAIROConfig.cmake
+++ b/cmake/modules/CAIROConfig.cmake
@@ -18,27 +18,20 @@ if(PREFIX_CAIRO)
 else(PREFIX_CAIRO)
   # use pkgconfig to get the directories and then use these values
   # in the find_path() and find_library() calls
-  if (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} LESS 2.5)
-    include(UsePkgConfig)
-    PKGCONFIG(cairo _libCairoIncDir _libCairoLinkDir _libCairoLinkFlags _libCairoCflags)
-    set(PKG_CAIRO_INCLUDE_DIRS ${_libCairoIncDir})
-    set(PKG_CAIRO_LIBRARIES ${_libCairoLinkDir})
-  else (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} LESS 2.5)
-    include(FindPkgConfig)
-    pkg_search_module(CAIRO REQUIRED libcairo>=1.14.0 cairo>=1.14.0)
-  endif (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} LESS 2.5)
+  include(FindPkgConfig)
+  pkg_search_module(CAIRO REQUIRED libcairo>=1.14.0 cairo>=1.14.0)
 endif(PREFIX_CAIRO)
 
 find_path(CAIRO_INCLUDE_DIR 
   NAMES cairo.h
-  PATHS ${PREFIX_CAIRO_INCLUDE} ${PKG_CAIRO_INCLUDE_DIRS} ${CAIRO_INCLUDE_DIRS} /usr/local/include /usr/include
+  PATHS ${PREFIX_CAIRO_INCLUDE} ${PKG_CAIRO_INCLUDE_DIRS} ${CAIRO_INCLUDE_DIRS}
   PATH_SUFFIXES cairo
   NO_DEFAULT_PATH
 )
 
 find_library(CAIRO_LIBRARY
   NAMES libcairo cairo
-  PATHS ${PREFIX_CAIRO_LIB} ${PKG_CAIRO_LIBRARIES} ${CAIRO_LIBRARY_DIRS} /usr/local/lib /usr/lib
+  PATHS ${PREFIX_CAIRO_LIB} ${PKG_CAIRO_LIBRARIES} ${CAIRO_LIBRARY_DIRS}
   NO_DEFAULT_PATH
 )
 
diff --git a/cmake/modules/FONTCONFIGConfig.cmake b/cmake/modules/FONTCONFIGConfig.cmake
deleted file mode 100644
index 1a74069550316390bf29b1bea6bda68b7ab9af69..0000000000000000000000000000000000000000
--- a/cmake/modules/FONTCONFIGConfig.cmake
+++ /dev/null
@@ -1,71 +0,0 @@
-#
-# Find the native FONTCONFIG includes and library
-#
-
-# This module defines
-# FONTCONFIG_INCLUDE_DIR, where to find art*.h etc
-# FONTCONFIG_LIBRARY, the libraries to link against to use FONTCONFIG.
-# FONTCONFIG_FOUND, If false, do not try to use FONTCONFIG.
-# LIBFONTCONFIG_LIBS, link information
-# LIBFONTCONFIG_CFLAGS, cflags for include information
-
-if (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} LESS 2.5)
-	include(UsePkgConfig)
-	PKGCONFIG(fontconfig _fontconfigIncDir _fontconfigLinkDir _fontconfigLinkFlags _fontconfigCflags)
-	set(FONTCONFIG_LIBS ${_fontconfigCflags})
-else (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} LESS 2.5)
-	include(FindPkgConfig)
-	pkg_search_module(FONTCONFIG REQUIRED fontconfig)
-endif (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} LESS 2.5)
-
-#include(UsePkgConfig)
-
-# use pkg-config to get the directories and then use these values
-# in the find_path() and find_library() calls
-#PKGCONFIG(fontconfig _fontconfigIncDir _fontconfigLinkDir _fontconfigLinkFlags _fontconfigCflags)
-
-#set(FONTCONFIG_LIBS ${_fontconfigCflags})
-
-if(BUILD_OSX_BUNDLE)
-	find_path(FONTCONFIG_INCLUDE_DIR
-		NAMES fontconfig/fontconfig.h
-		PATHS ${FONTCONFIG_INCLUDE_DIRS} /opt/local/include
-		NO_DEFAULT_PATH
-		)
-	find_library(FONTCONFIG_LIBRARY
-		NAMES fontconfig
-		PATHS ${FONTCONFIG_LIBRARY_DIRS} /opt/local/lib
-		NO_DEFAULT_PATH
-		)
-else(BUILD_OSX_BUNDLE)
-	find_path(FONTCONFIG_INCLUDE_DIR
-		NAMES fontconfig/fontconfig.h
-		PATHS ${FONTCONFIG_INCLUDE_DIRS}
-		${_fontconfigIncDir}
-		/usr/include
-		/usr/local/include
-		PATH_SUFFIXES fontconfig
-		)
-	# quick hack as the above finds it nicely but our source includes the libart_lgpl text at the moment
-	#string(REGEX REPLACE "/libart_lgpl" "" FONTCONFIG_INCLUDE_DIR ${FONTCONFIG_INCLUDE_DIR})
-	find_library(FONTCONFIG_LIBRARY NAMES fontconfig
-		PATHS ${FONTCONFIG_LIBRARY_DIRS} /usr/lib /usr/local/lib
-		)
-endif(BUILD_OSX_BUNDLE)
-
-
-# message(STATUS "fclib ${FONTCONFIG_LIBRARY}")
-# message(STATUS "fcinclude ${FONTCONFIG_INCLUDE_DIR}")
-
-
-if (FONTCONFIG_LIBRARY)
-	if (FONTCONFIG_INCLUDE_DIR)
-		set( FONTCONFIG_FOUND "YES" )
-		set( FONTCONFIG_LIBRARIES ${FONTCONFIG_LIBRARY} )
-		find_program(FONTCONFIG_CONFIG NAMES fontconfig-config PATHS ${prefix}/bin ${exec_prefix}/bin /usr/local/bin /opt/local/bin /usr/bin /usr/nekoware/bin /usr/X11/bin)
-		# 	exec_program(${FONTCONFIG_CONFIG} ARGS --libs OUTPUT_VARIABLE FONTCONFIG_LIBS)
-		# 	exec_program(${FONTCONFIG_CONFIG} ARGS --cflags OUTPUT_VARIABLE FONTCONFIG_CFLAGS)
-		#  	message(STATUS ${FONTCONFIG_LIBS})
-		#  	message(STATUS ${FONTCONFIG_CFLAGS})
-	endif (FONTCONFIG_INCLUDE_DIR)
-endif (FONTCONFIG_LIBRARY)
diff --git a/cmake/modules/FREETYPEConfig.cmake b/cmake/modules/FREETYPEConfig.cmake
deleted file mode 100644
index 6ffae9e5f2793a172c3f8df71b877d1224cf8dcb..0000000000000000000000000000000000000000
--- a/cmake/modules/FREETYPEConfig.cmake
+++ /dev/null
@@ -1,81 +0,0 @@
-#
-# Find the native FREETYPE includes and library
-#
-
-# This module defines
-# FREETYPE_INCLUDE_DIR, where to find ft2build.h, ftheader.h, ...
-# FREETYPE_LIBRARIES, the libraries to link against to use FREETYPE.
-# FREETYPE_FOUND, If false, do not try to use FREETYPE.
-
-# also defined, but not for general use are
-# FREETYPE_LIBRARY, where to find the FREETYPE library.
-
-if (BUILD_OSX_BUNDLE)
-	find_path(FREETYPE_INCLUDE_DIR_FT2BUILD ft2build.h
-		/opt/local/include/
-		NO_CMAKE_SYSTEM_PATH
-		)
-else (BUILD_OSX_BUNDLE)
-	find_path(FREETYPE_INCLUDE_DIR_FT2BUILD ft2build.h
-		/usr/include/
-		/usr/local/include/
-		NO_CMAKE_SYSTEM_PATH
-		)
-endif (BUILD_OSX_BUNDLE)
-
-
-if (BUILD_OSX_BUNDLE)
-	find_path(FREETYPE_INCLUDE_DIR_FTHEADER freetype/config/ftheader.h
-		/opt/local/include/freetype2
-		NO_CMAKE_SYSTEM_PATH
-		)
-else (BUILD_OSX_BUNDLE)
-	find_path(FREETYPE_INCLUDE_DIR_FTHEADER freetype/config/ftheader.h
-		/usr/include/freetype2
-		/usr/local/include/freetype2
-		NO_CMAKE_SYSTEM_PATH
-		)
-endif (BUILD_OSX_BUNDLE)
-
-set(FREETYPE_LIBRARY_NAMES_DEBUG ${FREETYPE_LIBRARY_NAMES_DEBUG} freetyped)
-set(FREETYPE_LIBRARY_NAMES_RELEASE ${FREETYPE_LIBRARY_NAMES_RELEASE} freetype)
-
-if(BUILD_OSX_BUNDLE)
-	set(FREETYPE_LIB_PATHS /opt/local/lib)
-else(BUILD_OSX_BUNDLE)
-	set(FREETYPE_LIB_PATHS /usr/lib /usr/local/lib)
-endif(BUILD_OSX_BUNDLE)
-
-find_library(FREETYPE_LIBRARY_RELEASE ${FREETYPE_LIBRARY_NAMES_RELEASE} ${FREETYPE_LIBRARY_NAMES}
-	PATHS
-	${FREETYPE_LIB_PATHS}
-	NO_CMAKE_SYSTEM_PATH)
-find_library(FREETYPE_LIBRARY_DEBUG ${FREETYPE_LIBRARY_NAMES_DEBUG}
-	PATHS
-	${FREETYPE_LIB_PATHS}
-	NO_CMAKE_SYSTEM_PATH)
-
-include(LibraryDebugAndRelease)
-SET_LIBRARY_FROM_DEBUG_AND_RELEASE(FREETYPE)
-
-# message(STATUS "ft lib ${FREETYPE_LIBRARY}")
-# message(STATUS "ft2 build ${FREETYPE_INCLUDE_DIR_FT2BUILD}")
-# message(STATUS "ft header ${FREETYPE_INCLUDE_DIR_FTHEADER}")
-
-set(FREETYPE_FIND_QUIETLY ON)
-
-if (FREETYPE_LIBRARY)
-	if (NOT FREETYPE_FIND_QUIETLY)
-		message(STATUS "Found Freetype2: ${FREETYPE_LIBRARY}")
-	endif (NOT FREETYPE_FIND_QUIETLY)
-	if (FREETYPE_INCLUDE_DIR_FTHEADER AND FREETYPE_INCLUDE_DIR_FT2BUILD)
-		set( FREETYPE_FOUND "YES" )
-		set( FREETYPE_INCLUDE_DIR
-			${FREETYPE_INCLUDE_DIR_FT2BUILD}
-			${FREETYPE_INCLUDE_DIR_FTHEADER} )
-		set( FREETYPE_LIBRARIES ${FREETYPE_LIBRARY} )
-		find_program(FREETYPE_CONFIG NAMES freetype-config PATHS ${prefix}/bin ${exec_prefix}/bin /usr/local/bin /opt/local/bin /usr/bin /usr/nekoware/bin /usr/X11/bin)
-		exec_program(${FREETYPE_CONFIG} ARGS --libs OUTPUT_VARIABLE LIBFREETYPE_LIBS)
-		exec_program(${FREETYPE_CONFIG} ARGS --cflags OUTPUT_VARIABLE LIBFREETYPE_CFLAGS)
-	endif (FREETYPE_INCLUDE_DIR_FTHEADER AND FREETYPE_INCLUDE_DIR_FT2BUILD)
-endif (FREETYPE_LIBRARY)
diff --git a/cmake/modules/FindFontconfig.cmake b/cmake/modules/FindFontconfig.cmake
new file mode 100644
index 0000000000000000000000000000000000000000..a6f0180b37d0e3fea68ecf5623b010a96e690c1a
--- /dev/null
+++ b/cmake/modules/FindFontconfig.cmake
@@ -0,0 +1,101 @@
+# Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+#[=======================================================================[.rst:
+FindFontconfig
+--------------
+
+Find Fontconfig headers and library.
+
+Imported Targets
+^^^^^^^^^^^^^^^^
+
+``Fontconfig::Fontconfig``
+  The Fontconfig library, if found.
+
+Result Variables
+^^^^^^^^^^^^^^^^
+
+This will define the following variables in your project:
+
+``Fontconfig_FOUND``
+  true if (the requested version of) Fontconfig is available.
+``Fontconfig_VERSION``
+  the version of Fontconfig.
+``Fontconfig_LIBRARIES``
+  the libraries to link against to use Fontconfig.
+``Fontconfig_INCLUDE_DIRS``
+  where to find the Fontconfig headers.
+``Fontconfig_COMPILE_OPTIONS``
+  this should be passed to target_compile_options(), if the
+  target is not used for linking
+
+#]=======================================================================]
+
+
+# use pkg-config to get the directories and then use these values
+# in the FIND_PATH() and FIND_LIBRARY() calls
+find_package(PkgConfig QUIET)
+pkg_check_modules(PKG_FONTCONFIG QUIET fontconfig)
+set(Fontconfig_COMPILE_OPTIONS ${PKG_FONTCONFIG_CFLAGS_OTHER})
+set(Fontconfig_VERSION ${PKG_FONTCONFIG_VERSION})
+
+find_path( Fontconfig_INCLUDE_DIR
+  NAMES
+    fontconfig/fontconfig.h
+  HINTS
+    ${PKG_FONTCONFIG_INCLUDE_DIRS}
+    /usr/X11/include
+)
+
+find_library( Fontconfig_LIBRARY
+  NAMES
+    fontconfig
+  PATHS
+    ${PKG_FONTCONFIG_LIBRARY_DIRS}
+)
+
+if (Fontconfig_INCLUDE_DIR AND NOT Fontconfig_VERSION)
+  file(STRINGS ${Fontconfig_INCLUDE_DIR}/fontconfig/fontconfig.h _contents REGEX "^#define[ \t]+FC_[A-Z]+[ \t]+[0-9]+$")
+  unset(Fontconfig_VERSION)
+  foreach(VPART MAJOR MINOR REVISION)
+    foreach(VLINE ${_contents})
+      if(VLINE MATCHES "^#define[\t ]+FC_${VPART}[\t ]+([0-9]+)$")
+        set(Fontconfig_VERSION_PART "${CMAKE_MATCH_1}")
+        if(Fontconfig_VERSION)
+          string(APPEND Fontconfig_VERSION ".${Fontconfig_VERSION_PART}")
+        else()
+          set(Fontconfig_VERSION "${Fontconfig_VERSION_PART}")
+        endif()
+      endif()
+    endforeach()
+  endforeach()
+endif ()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Fontconfig
+  FOUND_VAR
+    Fontconfig_FOUND
+  REQUIRED_VARS
+    Fontconfig_LIBRARY
+    Fontconfig_INCLUDE_DIR
+  VERSION_VAR
+    Fontconfig_VERSION
+)
+
+
+if(Fontconfig_FOUND AND NOT TARGET Fontconfig::Fontconfig)
+  add_library(Fontconfig::Fontconfig UNKNOWN IMPORTED)
+  set_target_properties(Fontconfig::Fontconfig PROPERTIES
+    IMPORTED_LOCATION "${Fontconfig_LIBRARY}"
+    INTERFACE_COMPILE_OPTIONS "${Fontconfig_COMPILE_OPTIONS}"
+    INTERFACE_INCLUDE_DIRECTORIES "${Fontconfig_INCLUDE_DIR}"
+  )
+endif()
+
+mark_as_advanced(Fontconfig_LIBRARY Fontconfig_INCLUDE_DIR)
+
+if(Fontconfig_FOUND)
+  set(Fontconfig_LIBRARIES ${Fontconfig_LIBRARY})
+  set(Fontconfig_INCLUDE_DIRS ${Fontconfig_INCLUDE_DIR})
+endif()
diff --git a/cmake/modules/FindGMAGICK.cmake b/cmake/modules/FindGMAGICK.cmake
index 44910698b788620ca29ec5e831e0cce061ef4f76..6ba9c7a2b81f419d2f340d70a66e4607ddf8755d 100644
--- a/cmake/modules/FindGMAGICK.cmake
+++ b/cmake/modules/FindGMAGICK.cmake
@@ -24,7 +24,6 @@ find_library(GMAGICK_LIBRARY
   PATHS ${GMAGICK_PKGCONF_LIBRARY_DIRS}
 )
 
-message("GRAPHICS_MAGIC debug: pkgconf: ${GMAGICK_PKGCONF_INCLUDE_DIRS},${GMAGICK_PKGCONF_LIBRARY_DIRS} include:${GMAGICK_INCLUDE_DIR} lib:${GMAGICK_LIBRARY}")
 include(FindPackageHandleStandardArgs)
 FIND_PACKAGE_HANDLE_STANDARD_ARGS(GMAGICK DEFAULT_MSG GMAGICK_LIBRARY GMAGICK_INCLUDE_DIR)
 if(GMAGICK_FOUND)
diff --git a/cmake/modules/FindHUNSPELL.cmake b/cmake/modules/FindHUNSPELL.cmake
index 42157ba74588572ca53b60c0916e1e6cf0389d5c..ffe9059039156b95d8c731fd10e9dcbf95b4eb3f 100644
--- a/cmake/modules/FindHUNSPELL.cmake
+++ b/cmake/modules/FindHUNSPELL.cmake
@@ -13,14 +13,14 @@ pkg_search_module(HUNSPELL REQUIRED hunspell)
 
 find_path(HUNSPELL
   NAMES hunspell.h
-  PATHS ${PKG_HUNSPELL_INCLUDE_DIRS} ${HUNSPELL_INCLUDE_DIRS} /usr/local/include /usr/include
+  PATHS ${PKG_HUNSPELL_INCLUDE_DIRS} ${HUNSPELL_INCLUDE_DIRS}
   PATH_SUFFIXES hunspell
   NO_DEFAULT_PATH
 )
 
 find_library(HUNSPELL_LIBRARIES
   NAMES libhunspell
-  PATHS ${PKG_HUNSPELL_LIBRARIES} ${HUNSPELL_LIBRARY_DIRS} /usr/local/lib /usr/lib
+  PATHS ${PKG_HUNSPELL_LIBRARIES} ${HUNSPELL_LIBRARY_DIRS}
   NO_DEFAULT_PATH
 )
 
@@ -33,9 +33,4 @@ if(CMAKE_MATCH_1 GREATER 4)
 	message(STATUS "HUNSPELL LIBRARIES ${HUNSPELL_LIBRARIES}")
 endif()
 
-#find_path(HUNSPELL_INCLUDE_DIR hunspell/hunspell.hxx )
-#find_library(HUNSPELL_LIBRARIES NAMES hunspell-1.5 hunspell-1.4 hunspell-1.3 hunspell-1.2 PATHS /opt/local/lib /usr/local/lib /usr/lib )
-#include(FindPackageHandleStandardArgs)
-#FIND_PACKAGE_HANDLE_STANDARD_ARGS(HUNSPELL DEFAULT_MSG HUNSPELL_LIBRARIES HUNSPELL_INCLUDE_DIR )
-
 mark_as_advanced(HUNSPELL_INCLUDE_DIR HUNSPELL_LIBRARIES)
diff --git a/cmake/modules/FindLCMS.cmake b/cmake/modules/FindLCMS.cmake
deleted file mode 100644
index 200c69d39064f39cc56a1b569fa4b4636d3c916d..0000000000000000000000000000000000000000
--- a/cmake/modules/FindLCMS.cmake
+++ /dev/null
@@ -1,61 +0,0 @@
-#
-# Find the native LCMS includes and library
-#
-
-# This module defines
-# LCMS_INCLUDE_DIR, where to find art*.h etc
-# LCMS_LIBRARY, the libraries
-# LCMS_FOUND, If false, do not try to use LCMS.
-# LIBLCMS_LIBS, link information
-# LIBLCMS_CFLAGS, cflags for include information
-
-
-# include(UsePkgConfig)
-
-# use pkg-config to get the directories and then use these values
-# in the find_path() and find_library() calls
-# PKGCONFIG(lcms _lcmsIncDir _lcmsLinkDir _lcmsLinkFlags _lcmsCflags)
-
-# set(LCMS_LIBS ${_lcmsCflags})
-
-find_path(LCMS_INCLUDE_DIR lcms.h
-  /usr/include
-  /usr/local/include
-  PATH_SUFFIXES lcms
-)
-
-find_library(LCMS_LIBRARY_RELEASE
-  NAMES ${LCMS_NAMES_RELEASE} ${LCMS_NAMES} lcms liblcms lcmsdll
-  PATHS /usr/lib /usr/local/lib
-)
-
-find_library(LCMS_LIBRARY_DEBUG
-  NAMES ${LCMS_NAMES_DEBUG} lcmsd liblcmsd lcmsdlld
-  PATHS /usr/lib /usr/local/lib
-)
-
-include(LibraryDebugAndRelease)
-SET_LIBRARY_FROM_DEBUG_AND_RELEASE(LCMS)
-
-message("LCMS ReleaseLibrary: ${LCMS_LIBRARY_RELEASE}")
-message("LCMS Debug Library: ${LCMS_LIBRARY_DEBUG}")
-message("LCMS Library: ${LCMS_LIBRARY}")
-
-if (LCMS_LIBRARY AND LCMS_INCLUDE_DIR)
-	set( LCMS_FOUND ON )
-	set( LCMS_LIBRARIES ${LCMS_LIBRARY} )
-else (LCMS_LIBRARY AND LCMS_INCLUDE_DIR)
-	set( LCMS_FOUND OFF )
-endif (LCMS_LIBRARY AND LCMS_INCLUDE_DIR)
-
-set(LCMS_FIND_QUIETLY ON)
-
-if (LCMS_FOUND)
-	if (NOT LCMS_FIND_QUIETLY)
-		message(STATUS "Found LittleCMS: ${LCMS_LIBRARY}")
-	endif (NOT LCMS_FIND_QUIETLY)
-else (LCMS_FOUND)
-	if (LCMS_FIND_REQUIRED)
-		message(FATAL_ERROR "Could not find LittleCMS")
-	endif (LCMS_FIND_REQUIRED)
-endif (LCMS_FOUND)
diff --git a/cmake/modules/FindLCMS2.cmake b/cmake/modules/FindLCMS2.cmake
index e3332c69ea807cd8b1458e8d0885feec2c253970..dec9c691ebfa026c4c9b26b7a0dc93c5e0be9934 100644
--- a/cmake/modules/FindLCMS2.cmake
+++ b/cmake/modules/FindLCMS2.cmake
@@ -19,8 +19,6 @@
 # set(LCMS2_LIBS ${_lcmsCflags})
 
 find_path(LCMS2_INCLUDE_DIR lcms2.h
-  /usr/include
-  /usr/local/include
   PATH_SUFFIXES lcms2
 )
 
diff --git a/cmake/modules/FindLIBPODOFO.cmake b/cmake/modules/FindLIBPODOFO.cmake
index 9add853dcd642a62d06678f711458fa13ada2f4a..1eb4f1707f412e063d4aceb890398039a775816a 100644
--- a/cmake/modules/FindLIBPODOFO.cmake
+++ b/cmake/modules/FindLIBPODOFO.cmake
@@ -18,8 +18,6 @@ find_path(LIBPODOFO_INCLUDE_DIR
 	"${LIBPODOFO_DIR}/include"
 	"${LIBPODOFO_DIR}/src"
 	"${LIBPODOFO_DIR}"
-	/usr/include
-	/usr/local/include
 	)
 
 set(LIBPODOFO_FIND_QUIETLY ON)
@@ -30,7 +28,6 @@ find_library(LIBPODOFO_LIBRARY
 	"${LIBPODOFO_DIR}/lib"
 	"${LIBPODOFO_DIR}/src"
 	"${LIBPODOFO_DIR}"
-	/usr/lib /usr/local/lib
 	)
 
 if(LIBPODOFO_INCLUDE_DIR AND LIBPODOFO_LIBRARY)
diff --git a/cmake/modules/FindOSG.cmake b/cmake/modules/FindOSG.cmake
index 87afe8b169c76a052c2a5351e3a8b1b0bf62b26a..a4bc47e7def7094e05971d055d62e74f9862339a 100644
--- a/cmake/modules/FindOSG.cmake
+++ b/cmake/modules/FindOSG.cmake
@@ -23,65 +23,34 @@ find_path(OSG_INCLUDE_DIR osg/Node)
 
 macro(FIND_OSG_LIBRARY MYLIBRARY MYLIBRARYNAME)
 
-	find_library("${MYLIBRARY}_DEBUG"
-		NAMES "${MYLIBRARYNAME}${CMAKE_DEBUG_POSTFIX}"
-		PATHS
-		${OSG_DIR}/lib/Debug
-		${OSG_DIR}/lib
-		$ENV{OSG_DIR}/lib/debug
-		$ENV{OSG_DIR}/lib
-		$ENV{OSG_DIR}
-		$ENV{OSGDIR}/lib
-		$ENV{OSGDIR}
-		$ENV{OSG_ROOT}/lib
-		NO_DEFAULT_PATH
-		)
-
-	find_library("${MYLIBRARY}_DEBUG"
+find_library("${MYLIBRARY}_DEBUG"
 		NAMES "${MYLIBRARYNAME}${CMAKE_DEBUG_POSTFIX}"
+                HINTS
+                      "${OSG_DIR}"
+                      ENV OSG_DIR
+                      ENV OSGDIR
+                      ENV OSG_ROOT
+                PATH_SUFFIXES
+                      Debug
+                      debug
 		PATHS
 		~/Library/Frameworks
 		/Library/Frameworks
-		/usr/local/lib
-		/usr/local/lib64
-		/usr/lib
-		/usr/lib64
-		/sw/lib
-		/opt/local/lib
-		/opt/csw/lib
-		/opt/lib
-		[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/lib
+	[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/lib
 		/usr/freeware/lib64
 		)
 
-	find_library(${MYLIBRARY}
-		NAMES ${MYLIBRARYNAME}
-		PATHS
-		${OSG_DIR}/lib/Release
-		${OSG_DIR}/lib
-		$ENV{OSG_DIR}/lib/Release
-		$ENV{OSG_DIR}/lib
-		$ENV{OSG_DIR}
-		$ENV{OSGDIR}/lib
-		$ENV{OSGDIR}
-		$ENV{OSG_ROOT}/lib
-		NO_DEFAULT_PATH
-		)
-
-	find_library(${MYLIBRARY}
+find_library(${MYLIBRARY}
 		NAMES ${MYLIBRARYNAME}
+                HINTS
+                      "${OSG_DIR}"
+                      ENV OSG_DIR
+                      ENV OSGDIR
+                      ENV OSG_ROOT
 		PATHS
 		~/Library/Frameworks
 		/Library/Frameworks
-		/usr/local/lib
-		/usr/local/lib64
-		/usr/lib
-		/usr/lib64
-		/sw/lib
-		/opt/local/lib
-		/opt/csw/lib
-		/opt/lib
-		[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/lib
+	[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/lib
 		/usr/freeware/lib64
 		)
 
diff --git a/cmake/modules/FindPOPPLER.cmake b/cmake/modules/FindPOPPLER.cmake
deleted file mode 100644
index 89e34e7837f6a81ba6e9e4eea691d42cd9d2ee1f..0000000000000000000000000000000000000000
--- a/cmake/modules/FindPOPPLER.cmake
+++ /dev/null
@@ -1,48 +0,0 @@
-if (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} LESS 2.5)
-	include(UsePkgConfig)
-	PKGCONFIG(poppler _libPopplerIncDir _libPopplerLinkDir _libPopplerLinkFlags _libPopplerCflags)
-	set(PKG_POPPLER_INCLUDE_DIRS ${_libPopplerIncDir})
-	set(PKG_POPPLER_LIBRARIES ${_libPopplerLinkDir})
-else (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} LESS 2.5)
-	include(FindPkgConfig)
-	pkg_search_module(POPPLER libpoppler>=0.58.0 poppler>=0.58.0)
-	if (POPPLER_FOUND)
-		pkg_search_module(POPPLER_CPP REQUIRED libpoppler-cpp>=0.58.0 poppler-cpp>=0.58.0)
-	endif(POPPLER_FOUND)
-endif (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} LESS 2.5)
- 
-find_path(POPPLER_INCLUDE_DIR 
-	NAMES poppler-config.h
-	PATHS ${PKG_POPPLER_INCLUDE_DIRS} ${POPPLER_INCLUDE_DIRS} /usr/local/include /usr/include
-	PATH_SUFFIXES poppler
-	NO_DEFAULT_PATH
-	)
-
-find_path(POPPLER_CPP_INCLUDE_DIR 
-	NAMES poppler-version.h
-	PATHS ${PKG_POPPLER_CPP_INCLUDE_DIRS} ${POPPLER_CPP_INCLUDE_DIRS} /usr/local/include /usr/include
-	PATH_SUFFIXES poppler
-	NO_DEFAULT_PATH
-	)
-
-find_library(POPPLER_LIBRARY
-	NAMES libpoppler poppler
-	PATHS ${PKG_POPPLER_LIBRARIES} ${POPPLER_LIBRARY_DIRS} /usr/local/lib /usr/lib /usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}
-	PATH_SUFFIXES poppler
-	NO_DEFAULT_PATH
-	)
-
-find_library(POPPLER_CPP_LIBRARY
-	NAMES libpoppler-cpp poppler-cpp
-	PATHS ${PKG_POPPLER_CPP_LIBRARIES} ${POPPLER_CPP_LIBRARY_DIRS} /usr/local/lib /usr/lib /usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}
-	PATH_SUFFIXES poppler
-	NO_DEFAULT_PATH
-	)
-
-if (POPPLER_LIBRARY)
-	if (POPPLER_INCLUDE_DIR AND POPPLER_CPP_INCLUDE_DIR)
-		set( FOUND_POPPLER ON )
-		set( POPPLER_LIBRARIES ${POPPLER_LIBRARY} ${POPPLER_CPP_LIBRARY} )
-		set( POPPLER_INCLUDES ${POPPLER_INCLUDE_DIR} ${POPPLER_CPP_INCLUDE_DIR} )
-	endif (POPPLER_INCLUDE_DIR AND POPPLER_CPP_INCLUDE_DIR)
-endif (POPPLER_LIBRARY)
diff --git a/cmake/modules/FindZLIB.cmake b/cmake/modules/FindZLIB.cmake
deleted file mode 100644
index dc6f88ab8d7c4cf9a531f64a4e23943325781d78..0000000000000000000000000000000000000000
--- a/cmake/modules/FindZLIB.cmake
+++ /dev/null
@@ -1,55 +0,0 @@
-# - Find zlib
-# Find the native ZLIB includes and library
-#
-#  ZLIB_INCLUDE_DIR - where to find zlib.h, etc.
-#  ZLIB_LIBRARIES   - List of libraries when using zlib.
-#  ZLIB_FOUND       - True if zlib found.
-
-
-if (ZLIB_INCLUDE_DIR)
-	# Already in cache, be silent
-	set(ZLIB_FIND_QUIETLY TRUE)
-endif (ZLIB_INCLUDE_DIR)
-
-find_path(ZLIB_INCLUDE_DIR zlib.h)
-
-# On win32, qt statically links to zlib and libpng, and exports their symbols.
-# We can just link to Qt to get zlib and libpng. We still require the user to
-# supply their own headers on the search path, but they can and should just
-# specify ${QTDIR}/src/3rdparty/zlib/include .
-# To use this, you must use FindQt before FindZlib.
-if(QT_QTCORE_LIBRARY AND USE_QT_ZLIB_PNGLIB)
-
-	message("Using zlib from qt")
-	set(ZLIB_LIBRARY_RELEASE ${QT_QTCORE_LIBRARY_RELEASE})
-	set(ZLIB_LIBRARY_DEBUG ${QT_QTCORE_LIBRARY_DEBUG})
-	set(ZLIB_LIBRARY ${QT_QTCORE_LIBRARY})
-
-else(QT_QTCORE_LIBRARY AND USE_QT_ZLIB_PNGLIB)
-
-	set(ZLIB_NAMES_RELEASE ${ZLIB_NAMES_RELEASE} ${ZLIB_NAMES} z zlib zdll zlib1)
-	find_library(ZLIB_LIBRARY_RELEASE NAMES ${ZLIB_NAMES_RELEASE} )
-
-	# Find a debug library if one exists and use that for debug builds.
-	# This really only does anything for win32, but does no harm on other
-	# platforms.
-	set(ZLIB_NAMES_DEBUG ${ZLIB_NAMES_DEBUG} zlibd zlib1d)
-	find_library(ZLIB_LIBRARY_DEBUG NAMES ${ZLIB_NAMES_DEBUG})
-
-	include(LibraryDebugAndRelease)
-	SET_LIBRARY_FROM_DEBUG_AND_RELEASE(ZLIB)
-
-endif(QT_QTCORE_LIBRARY AND USE_QT_ZLIB_PNGLIB)
-
-# handle the QUIETLY and REQUIRED arguments and set ZLIB_FOUND to TRUE if 
-# all listed variables are TRUE
-include(ScribusFindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(ZLIB DEFAULT_MSG ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
-
-if(ZLIB_FOUND)
-	set( ZLIB_LIBRARIES ${ZLIB_LIBRARY} )
-else(ZLIB_FOUND)
-	set( ZLIB_LIBRARIES )
-endif(ZLIB_FOUND)
-
-mark_as_advanced( ZLIB_LIBRARY ZLIB_INCLUDE_DIR )
diff --git a/cmake/modules/LibXml2Config.cmake b/cmake/modules/LibXml2Config.cmake
deleted file mode 100644
index c3ed00901928af5770a8e24ab472807e4ac2cdb5..0000000000000000000000000000000000000000
--- a/cmake/modules/LibXml2Config.cmake
+++ /dev/null
@@ -1,43 +0,0 @@
-# - Try to find LibXml2
-# Once done this will define
-#
-#  LIBXML2_FOUND - system has LibXml2
-#  LIBXML2_INCLUDE_DIR - the LibXml2 include directory
-#  LIBXML2_LIBRARIES - the libraries needed to use LibXml2
-#  LIBXML2_DEFINITIONS - Compiler switches required for using LibXml2
-#
-# use pkg-config to get the directories and then use these values
-# in the find_path() and find_library() calls
-
-
-include(UsePkgConfig)
-
-PKGCONFIG(libxml-2.0 _LibXml2IncDir _LibXml2LinkDir _LibXml2LinkFlags _LibXml2Cflags)
-
-set(LIBXML2_DEFINITIONS ${_LibXml2Cflags})
-
-find_path(LIBXML2_INCLUDE_DIR libxml/xpath.h
-	PATHS ${_LibXml2IncDir} PATH_SUFFIXES libxml2
-	)
-
-find_library(LIBXML2_LIBRARIES NAMES xml2 libxml2
-	PATHS ${_LibXml2LinkDir}
-	)
-
-if (LIBXML2_INCLUDE_DIR AND LIBXML2_LIBRARIES)
-	set(LIBXML2_FOUND TRUE)
-endif (LIBXML2_INCLUDE_DIR AND LIBXML2_LIBRARIES)
-
-set(LibXml2_FIND_QUIETLY ON)
-
-if (LIBXML2_FOUND)
-	if (NOT LibXml2_FIND_QUIETLY)
-		message(STATUS "Found LibXml2: ${LIBXML2_LIBRARIES}")
-	endif (NOT LibXml2_FIND_QUIETLY)
-else (LIBXML2_FOUND)
-	if (LibXml2_FIND_REQUIRED)
-		message(SEND_ERROR "Could NOT find LibXml2")
-	endif (LibXml2_FIND_REQUIRED)
-endif (LIBXML2_FOUND)
-
-mark_as_advanced(LIBXML2_INCLUDE_DIR LIBXML2_LIBRARIES)
diff --git a/cmake/modules/ScribusFindPackageHandleStandardArgs.cmake b/cmake/modules/ScribusFindPackageHandleStandardArgs.cmake
deleted file mode 100644
index a8c1ff5d4532b97607588f960d51e592151e2d57..0000000000000000000000000000000000000000
--- a/cmake/modules/ScribusFindPackageHandleStandardArgs.cmake
+++ /dev/null
@@ -1,66 +0,0 @@
-#
-# This file was copied from CMake 2.5. It's used to permit CMake 2.4
-# to use the CMake 2.5-derived find scripts here.
-#
-if (NOT ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} LESS 2.5)
-  # Use the original from cmake 2.5 if possible
-  include(FindPackageHandleStandardArgs)
-else(NOT ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} LESS 2.5)
-  # or define our own...
-
-# FIND_PACKAGE_HANDLE_STANDARD_ARGS(NAME (DEFAULT_MSG|"Custom failure message") VAR1 ... )
-#    This macro is intended to be used in FindXXX.cmake modules files.
-#    It handles the REQUIRED and QUIET argument to find_package() and
-#    it also sets the <UPPERCASED_NAME>_FOUND variable.
-#    The package is found if all variables listed are TRUE.
-#    Example:
-#
-#    FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibXml2 DEFAULT_MSG LIBXML2_LIBRARIES LIBXML2_INCLUDE_DIR)
-#
-#    LibXml2 is considered to be found, if both LIBXML2_LIBRARIES and 
-#    LIBXML2_INCLUDE_DIR are valid. Then also LIBXML2_FOUND is set to TRUE.
-#    If it is not found and REQUIRED was used, it fails with FATAL_ERROR, 
-#    independent whether QUIET was used or not.
-#    If it is found, the location is reported using the VAR1 argument, so 
-#    here a message "Found LibXml2: /usr/lib/libxml2.so" will be printed out.
-#    If the second argument is DEFAULT_MSG, the message in the failure case will 
-#    be "Could NOT find LibXml2", if you don't like this message you can specify
-#    your own custom failure message there.
-
-macro(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FAIL_MSG _VAR1 )
-
-	if("${_FAIL_MSG}" STREQUAL "DEFAULT_MSG")
-		set(_FAIL_MESSAGE "Could NOT find ${_NAME}")
-	else("${_FAIL_MSG}" STREQUAL "DEFAULT_MSG")
-		set(_FAIL_MESSAGE "${_FAIL_MSG}")
-	endif("${_FAIL_MSG}" STREQUAL "DEFAULT_MSG")
-
-	string(TOUPPER ${_NAME} _NAME_UPPER)
-
-	set(${_NAME_UPPER}_FOUND TRUE)
-	if(NOT ${_VAR1})
-		set(${_NAME_UPPER}_FOUND FALSE)
-	endif(NOT ${_VAR1})
-
-	foreach(_CURRENT_VAR ${ARGN})
-		if(NOT ${_CURRENT_VAR})
-			set(${_NAME_UPPER}_FOUND FALSE)
-		endif(NOT ${_CURRENT_VAR})
-	endforeach(_CURRENT_VAR)
-
-	if (${_NAME_UPPER}_FOUND)
-		if (NOT ${_NAME}_FIND_QUIETLY)
-			message(STATUS "Found ${_NAME}: ${${_VAR1}}")
-		endif (NOT ${_NAME}_FIND_QUIETLY)
-	else (${_NAME_UPPER}_FOUND)
-		if (${_NAME}_FIND_REQUIRED)
-			message(FATAL_ERROR "${_FAIL_MESSAGE}")
-		else (${_NAME}_FIND_REQUIRED)
-			if (NOT ${_NAME}_FIND_QUIETLY)
-				message(STATUS "${_FAIL_MESSAGE}")
-			endif (NOT ${_NAME}_FIND_QUIETLY)
-		endif (${_NAME}_FIND_REQUIRED)
-	endif (${_NAME_UPPER}_FOUND)
-endmacro(FIND_PACKAGE_HANDLE_STANDARD_ARGS)
-
-endif(NOT ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} LESS 2.5)
diff --git a/cmake/modules/old/CupsConfig.cmake b/cmake/modules/old/CupsConfig.cmake
deleted file mode 100644
index cd4fa23e6b58bff58447e0fbe5c41a87873703cd..0000000000000000000000000000000000000000
--- a/cmake/modules/old/CupsConfig.cmake
+++ /dev/null
@@ -1,31 +0,0 @@
-# - Try to find Cups
-# Once done this will define
-#
-#  CUPS_FOUND - system has Cups
-#  CUPS_INCLUDE_DIR - the Cups include directory
-#  CUPS_LIBRARY - Link these to use CUPS
-#
-
-FIND_PATH(CUPS_INCLUDE_DIR cups/cups.h
-  /usr/include
-  /usr/local/include
-)
-
-FIND_LIBRARY(CUPS_LIBRARY NAMES cups PATHS /usr/lib /usr/local/lib)
-
-IF(CUPS_INCLUDE_DIR AND CUPS_LIBRARY)
-   SET(CUPS_FOUND TRUE)
-ENDIF(CUPS_INCLUDE_DIR AND CUPS_LIBRARY)
-
-SET(Cups_FIND_QUIETLY 1)
-
-IF(CUPS_FOUND)
-  SET( CUPS_LIBRARIES ${CUPS_LIBRARY} )
-  IF(NOT Cups_FIND_QUIETLY)
-    MESSAGE(STATUS "Found Cups: ${CUPS_LIBRARY}")
-  ENDIF(NOT Cups_FIND_QUIETLY)
-ELSE(CUPS_FOUND)
-  IF(Cups_FIND_REQUIRED)
-    MESSAGE(SEND_ERROR "Could not find Cups")
-  ENDIF(Cups_FIND_REQUIRED)
-ENDIF(CUPS_FOUND)
\ No newline at end of file
diff --git a/cmake/modules/old/FindJPEG.cmake b/cmake/modules/old/FindJPEG.cmake
deleted file mode 100644
index 4534b4c7d1067c7c83746c8124567669e7a6f990..0000000000000000000000000000000000000000
--- a/cmake/modules/old/FindJPEG.cmake
+++ /dev/null
@@ -1,35 +0,0 @@
-# - Find JPEG
-# Find the native JPEG includes and library
-# This module defines
-#  JPEG_INCLUDE_DIR, where to find jpeglib.h, etc.
-#  JPEG_LIBRARIES, the libraries needed to use JPEG.
-#  JPEG_FOUND, If false, do not try to use JPEG.
-# also defined, but not for general use are
-#  JPEG_LIBRARY, where to find the JPEG library.
-
-FIND_PATH(JPEG_INCLUDE_DIR jpeglib.h)
-
-SET(JPEG_NAMES_RELEASE ${JPEG_NAMES_RELEASE} ${JPEG_NAMES} jpeg libjpeg)
-FIND_LIBRARY(JPEG_LIBRARY_RELEASE NAMES ${JPEG_NAMES_RELEASE} )
-
-SET(JPEG_NAMES_DEBUG ${JPEG_NAMES_DEBUG} jpegd libjpegd jpeg_d libjpeg_d)
-FIND_LIBRARY(JPEG_LIBRARY_DEBUG NAMES ${JPEG_NAMES_DEBUG} )
-
-INCLUDE(LibraryDebugAndRelease)
-SET_LIBRARY_FROM_DEBUG_AND_RELEASE(JPEG)
-
-
-# handle the QUIETLY and REQUIRED arguments and set JPEG_FOUND to TRUE if 
-# all listed variables are TRUE
-INCLUDE(ScribusFindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(JPEG DEFAULT_MSG JPEG_LIBRARY JPEG_INCLUDE_DIR)
-
-IF(JPEG_FOUND)
-  SET(JPEG_LIBRARIES ${JPEG_LIBRARY})
-ENDIF(JPEG_FOUND)
-
-# Deprecated declarations.
-SET (NATIVE_JPEG_INCLUDE_PATH ${JPEG_INCLUDE_DIR} )
-GET_FILENAME_COMPONENT (NATIVE_JPEG_LIB_PATH ${JPEG_LIBRARY} PATH)
-
-MARK_AS_ADVANCED(JPEG_LIBRARY JPEG_INCLUDE_DIR )
diff --git a/cmake/modules/old/FindPNG.cmake b/cmake/modules/old/FindPNG.cmake
deleted file mode 100644
index 3b82f003ce45110f35d0c46c514b8419a28bbc62..0000000000000000000000000000000000000000
--- a/cmake/modules/old/FindPNG.cmake
+++ /dev/null
@@ -1,75 +0,0 @@
-# - Find the native PNG includes and library
-#
-# This module defines
-#  PNG_INCLUDE_DIR, where to find png.h, etc.
-#  PNG_LIBRARIES, the libraries to link against to use PNG.
-#  PNG_DEFINITIONS - You should ADD_DEFINITONS(${PNG_DEFINITIONS}) before compiling code that includes png library files.
-#  PNG_FOUND, If false, do not try to use PNG.
-# also defined, but not for general use are
-#  PNG_LIBRARY, where to find the PNG library.
-# None of the above will be defined unles zlib can be found.
-# PNG depends on Zlib
-INCLUDE(FindZLIB)
-
-IF(ZLIB_FOUND)
-
-  FIND_PATH(PNG_PNG_INCLUDE_DIR png.h
-  /usr/local/include/libpng             # OpenBSD
-  )
-
-  # On win32, qt statically links to zlib and libpng, and exports their symbols.
-  # We can just link to Qt to get zlib and libpng. We still require the user to
-  # supply their own headers on the search path, but they can and should just
-  # specify ${QTDIR}/src/3rdparty/zlib/include .
-  # To use this, you must use FindQt before FindPng.
-  IF(QT_QTCORE_LIBRARY AND USE_QT_ZLIB_PNGLIB)
-
-    MESSAGE("Using libpng from qt")
-    IF(NOT "${ZLIB_LIBRARY}" STREQUAL "${QT_QTCORE_LIBRARY}")
-       MESSAGE("WARNING: We may be using an external zlib but qt's libpng")
-    ENDIF(NOT "${ZLIB_LIBRARY}" STREQUAL "${QT_QTCORE_LIBRARY}")
-    SET(PNG_LIBRARY_RELEASE ${QT_QTCORE_LIBRARY_RELEASE})
-    SET(PNG_LIBRARY_DEBUG ${QT_QTCORE_LIBRARY_DEBUG})
-    SET(PNG_LIBRARY ${QT_QTCORE_LIBRARY})
-
-  ELSE(QT_QTCORE_LIBRARY AND USE_QT_ZLIB_PNGLIB)
-
-    SET(PNG_NAMES_RELEASE ${PNG_NAMES_RELEASE} ${PNG_NAMES} png libpng png13 libpng13)
-    FIND_LIBRARY(PNG_LIBRARY_RELEASE NAMES ${PNG_NAMES_RELEASE} )
-
-    SET(PNG_NAMES_DEBUG ${PNG_NAMES} pngd libpngd png13d libpng13d)
-    FIND_LIBRARY(PNG_LIBRARY_DEBUG NAMES ${PNG_NAMES_DEBUG} )
-
-    INCLUDE(LibraryDebugAndRelease)
-    SET_LIBRARY_FROM_DEBUG_AND_RELEASE(PNG)
-
-  ENDIF(QT_QTCORE_LIBRARY AND USE_QT_ZLIB_PNGLIB)
-
-  IF (PNG_LIBRARY AND PNG_PNG_INCLUDE_DIR)
-      # png.h includes zlib.h. Sigh.
-      SET(PNG_INCLUDE_DIR ${PNG_PNG_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR} )
-      IF(NOT USE_QT_ZLIB_PNGLIB)
-        # libpng requires zlib unless we're linking to both in the form of Qt
-        SET(PNG_LIBRARIES ${PNG_LIBRARY} ${ZLIB_LIBRARY})
-      ENDIF(NOT USE_QT_ZLIB_PNGLIB)
-
-      IF (CYGWIN)
-        IF(BUILD_SHARED_LIBS)
-           # No need to define PNG_USE_DLL here, because it's default for Cygwin.
-        ELSE(BUILD_SHARED_LIBS)
-          SET (PNG_DEFINITIONS -DPNG_STATIC)
-        ENDIF(BUILD_SHARED_LIBS)
-      ENDIF (CYGWIN)
-
-  ENDIF (PNG_LIBRARY AND PNG_PNG_INCLUDE_DIR)
-
-ENDIF(ZLIB_FOUND)
-
-# handle the QUIETLY and REQUIRED arguments and set PNG_FOUND to TRUE if 
-# all listed variables are TRUE
-INCLUDE(ScribusFindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(PNG DEFAULT_MSG PNG_LIBRARY PNG_PNG_INCLUDE_DIR)
-
-MESSAGE("Using PNG Library: ${PNG_LIBRARY}")
-
-MARK_AS_ADVANCED(PNG_PNG_INCLUDE_DIR PNG_LIBRARY )
diff --git a/cmake/modules/old/FindTIFF.cmake b/cmake/modules/old/FindTIFF.cmake
deleted file mode 100644
index ce110964fb614217421162cb8c2543c209d62dce..0000000000000000000000000000000000000000
--- a/cmake/modules/old/FindTIFF.cmake
+++ /dev/null
@@ -1,28 +0,0 @@
-# - Find TIFF library
-# Find the native TIFF includes and library
-# This module defines
-#  TIFF_INCLUDE_DIR, where to find tiff.h, etc.
-#  TIFF_LIBRARIES, libraries to link against to use TIFF.
-#  TIFF_FOUND, If false, do not try to use TIFF.
-# also defined, but not for general use are
-#  TIFF_LIBRARY, where to find the TIFF library.
-
-FIND_PATH(TIFF_INCLUDE_DIR tiff.h)
-
-SET(TIFF_NAMES_RELEASE ${TIFF_NAMES_RELEASE} ${TIFF_NAMES} tiff libtiff)
-SET(TIFF_NAMES_DEBUG ${TIFF_NAMES_DEBUG} tiffd libtiffd)
-
-FIND_LIBRARY(TIFF_LIBRARY_RELEASE NAMES ${TIFF_NAMES_RELEASE} )
-FIND_LIBRARY(TIFF_LIBRARY_DEBUG NAMES ${TIFF_NAMES_DEBUG} )
-
-INCLUDE(LibraryDebugAndRelease)
-SET_LIBRARY_FROM_DEBUG_AND_RELEASE(TIFF)
-
-# handle the QUIETLY and REQUIRED arguments and set TIFF_FOUND to TRUE if 
-# all listed variables are TRUE
-INCLUDE(ScribusFindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(TIFF DEFAULT_MSG TIFF_LIBRARY TIFF_INCLUDE_DIR)
-
-IF(TIFF_FOUND)
-  SET( TIFF_LIBRARIES ${TIFF_LIBRARY} )
-ENDIF(TIFF_FOUND)
diff --git a/scribus/CMakeLists.txt b/scribus/CMakeLists.txt
index b19d3311224c8b477cd65cd57ebecc587e5d3823..85e76787205df30fc3e4e9fc8e862a129930dbfd 100644
--- a/scribus/CMakeLists.txt
+++ b/scribus/CMakeLists.txt
@@ -1286,7 +1286,6 @@ target_link_libraries(${EXE_NAME}
 	${FREETYPE_LIBRARIES}
 	${HARFBUZZ_LIBRARIES}
 	${ICU_LIBRARIES}
-	${FONTCONFIG_LIBRARIES}
 	${LIBXML2_LIBRARIES}
 	${TIFF_LIBRARIES}
 	${JPEG_LIBRARIES}
@@ -1295,6 +1294,12 @@ target_link_libraries(${EXE_NAME}
 	${GMAGICK_LIBRARIES}
 )
 
+if (TARGET Fontconfig::Fontconfig)
+    target_link_libraries(${EXE_NAME}
+        Fontconfig::Fontconfig
+    )
+endif()
+
 if (NOT WIN32 AND NOT HAIKU)
 	target_link_libraries(${EXE_NAME}
 		${CUPS_LIBRARIES}
diff --git a/scribus/plugins/import/pdf/importpdf.cpp b/scribus/plugins/import/pdf/importpdf.cpp
index 2ab38ac7584a2ec9287fe5c51a71f6167fcf9452..adb0cbf875cc863b9a1f5f6c5d61c1c92c9a54c0 100644
--- a/scribus/plugins/import/pdf/importpdf.cpp
+++ b/scribus/plugins/import/pdf/importpdf.cpp
@@ -18,15 +18,17 @@ for which a new license (GPL+exception) is in place.
 #include <QRegExp>
 #include <QStack>
 
-#include <poppler/ErrorCodes.h>
-#include <poppler/GlobalParams.h>
-#include <poppler/OptionalContent.h>
-#include <poppler/PageTransition.h>
-#include <poppler/ViewerPreferences.h>
-#include <poppler/poppler-config.h>
-#include <poppler/cpp/poppler-version.h>
-#include <poppler/SplashOutputDev.h>
-#include <poppler/splash/SplashBitmap.h>
+// <poppler>
+#include <ErrorCodes.h>
+#include <GlobalParams.h>
+#include <OptionalContent.h>
+#include <PageTransition.h>
+#include <ViewerPreferences.h>
+#include <poppler-config.h>
+#include <cpp/poppler-version.h>
+#include <SplashOutputDev.h>
+#include <splash/SplashBitmap.h>
+// </poppler>
 
 #include "importpdf.h"
 #include "importpdfconfig.h"
diff --git a/scribus/plugins/import/pdf/importpdfconfig.h b/scribus/plugins/import/pdf/importpdfconfig.h
index 9913ee382c3961001cc2301f37f8fd0760340371..585d8cec17787aa38c7831911c7f36e92699f97a 100644
--- a/scribus/plugins/import/pdf/importpdfconfig.h
+++ b/scribus/plugins/import/pdf/importpdfconfig.h
@@ -7,7 +7,9 @@ for which a new license (GPL+exception) is in place.
 #ifndef IMPORTPDFCONFIG_H
 #define IMPORTPDFCONFIG_H
 
-#include <poppler/cpp/poppler-version.h>
+// <poppler>
+#include <cpp/poppler-version.h>
+// </poppler>
 
 #define POPPLER_VERSION_ENCODE(major, minor, micro) (	\
 	  ((major) * 10000)				\
diff --git a/scribus/plugins/import/pdf/slaoutput.cpp b/scribus/plugins/import/pdf/slaoutput.cpp
index 5e4d32a5511baad9d358313994919e2fcaf6cbe5..052f7c52a99245169c0bb1d794087354c3f69bc8 100644
--- a/scribus/plugins/import/pdf/slaoutput.cpp
+++ b/scribus/plugins/import/pdf/slaoutput.cpp
@@ -7,10 +7,12 @@ for which a new license (GPL+exception) is in place.
 
 #include "slaoutput.h"
 
-#include <poppler/GlobalParams.h>
-#include <poppler/poppler-config.h>
-#include <poppler/FileSpec.h>
-#include <poppler/fofi/FoFiTrueType.h>
+// <poppler>
+#include <GlobalParams.h>
+#include <poppler-config.h>
+#include <FileSpec.h>
+#include <fofi/FoFiTrueType.h>
+// </poppler>
 #include <QApplication>
 #include <QFile>
 #include "commonstrings.h"
diff --git a/scribus/plugins/import/pdf/slaoutput.h b/scribus/plugins/import/pdf/slaoutput.h
index 60fb900618e472740e1f0689c0188841b7fd5490..0a0276814c524d6d6139706c3c751acaa9348441 100644
--- a/scribus/plugins/import/pdf/slaoutput.h
+++ b/scribus/plugins/import/pdf/slaoutput.h
@@ -28,30 +28,32 @@ for which a new license (GPL+exception) is in place.
 #include "selection.h"
 #include "vgradient.h"
 
+// <poppler>
 #if POPPLER_ENCODED_VERSION < POPPLER_VERSION_ENCODE(0, 73, 0)
-#include <poppler/goo/gtypes.h>
+#include <goo/gtypes.h>
 #endif
-#include <poppler/Object.h>
-#include <poppler/OutputDev.h>
-#include <poppler/Gfx.h>
-#include <poppler/GfxState.h>
-#include <poppler/Stream.h>
-#include <poppler/GfxFont.h>
-#include <poppler/Link.h>
-#include <poppler/PDFDoc.h>
-#include <poppler/Error.h>
-#include <poppler/Form.h>
-#include <poppler/Page.h>
-#include <poppler/Catalog.h>
-#include <poppler/CharCodeToUnicode.h>
-#include <poppler/FontEncodingTables.h>
-#include <poppler/splash/SplashFontFileID.h>
-#include <poppler/splash/SplashFontFile.h>
-#include <poppler/splash/SplashFontEngine.h>
-#include <poppler/splash/SplashFont.h>
-#include <poppler/splash/SplashMath.h>
-#include <poppler/splash/SplashPath.h>
-#include <poppler/splash/SplashGlyphBitmap.h>
+#include <Object.h>
+#include <OutputDev.h>
+#include <Gfx.h>
+#include <GfxState.h>
+#include <Stream.h>
+#include <GfxFont.h>
+#include <Link.h>
+#include <PDFDoc.h>
+#include <Error.h>
+#include <Form.h>
+#include <Page.h>
+#include <Catalog.h>
+#include <CharCodeToUnicode.h>
+#include <FontEncodingTables.h>
+#include <splash/SplashFontFileID.h>
+#include <splash/SplashFontFile.h>
+#include <splash/SplashFontEngine.h>
+#include <splash/SplashFont.h>
+#include <splash/SplashMath.h>
+#include <splash/SplashPath.h>
+#include <splash/SplashGlyphBitmap.h>
+// </poppler>
 
 //------------------------------------------------------------------------
 // LinkSubmitData
cmake-refactoring.diff (42,305 bytes)

cbradney

2019-12-08 21:45

administrator   ~0047216

I've committed much of this apart from podofo, poppler, fontconfig. For fontconfig, we could just bump the minimum cmake to 3.14

ale

2019-12-08 22:20

manager   ~0047220

thanks for the commit!

cmake 3.14 is probably too new.
the newest ubuntu and debian testing do not have it yet.

for podofo, the paths removed are searched by default.
but it's just a small cleanup anyway...

for poppler: the .h names used by the poppler projects are not the best ones. but we cannot change that
but from what i've been told by the cmake guys, the current includes seem to be wrong and only work because /usr/include is in the default path.
what's the reason for not accepting the changes?
do they fail on your computer?

cbradney

2019-12-09 22:40

administrator   ~0047233

Some more changes committed from the patch.

a project can choose whatever names they want, but using poppler/filename is therefore perfectly ok.

the fontconfig stuff doesnt work here..

ale

2019-12-10 10:14

manager   ~0047238

do you have some details about fontconfig?

it might be a mac specific thing (or i did not commit everything correctly).
it seems to work here and on gitlab's CI..

cbradney

2019-12-10 22:38

administrator   ~0047243

Pending current build is successful, I will commit. It might have been the podofo changes that broke it..

ale

2019-12-11 15:43

manager   ~0047249

hi @craig

these lines are missing from the main CMakeLists.txt:

if (TARGET Fontconfig::Fontconfig)
    target_link_libraries(${EXE_NAME}
        Fontconfig::Fontconfig
    )
endif()



https://gitlab.com/scribus/scribus/merge_requests/18/diffs#dc885ce634ee67872a738cd04be761e34dbf0ce3_1298_1297

cbradney

2019-12-11 23:08

administrator   ~0047250

Added those in now. Builds ok on OSX

ale

2019-12-12 07:28

manager   ~0047251

thanks!

ale

2019-12-14 08:20

manager   ~0047266

i think that we can close this... or are there further things to be committed?

Issue History

Date Modified Username Field Change
2019-12-01 21:26 ale New Issue
2019-12-01 21:28 ale Note Added: 0047184
2019-12-01 21:28 ale Note Edited: 0047184 View Revisions
2019-12-01 21:35 ale Note Edited: 0047184 View Revisions
2019-12-01 22:13 ale Note Added: 0047185
2019-12-02 09:30 ale Note Added: 0047187
2019-12-03 13:22 ale Note Edited: 0047187 View Revisions
2019-12-03 13:46 ale Note Added: 0047192
2019-12-03 13:54 ale Note Added: 0047193
2019-12-03 14:23 ale Summary clean up the cmake files => [PATCH] clean up the cmake files
2019-12-03 14:23 ale Patch No => Yes
2019-12-05 08:35 ale File Added: cmake-refactoring.diff
2019-12-05 08:35 ale Note Added: 0047200
2019-12-08 21:45 cbradney Note Added: 0047216
2019-12-08 22:20 ale Note Added: 0047220
2019-12-09 22:40 cbradney Note Added: 0047233
2019-12-10 10:14 ale Note Added: 0047238
2019-12-10 22:38 cbradney Note Added: 0047243
2019-12-11 15:43 ale Note Added: 0047249
2019-12-11 23:08 cbradney Note Added: 0047250
2019-12-12 07:28 ale Note Added: 0047251
2019-12-14 08:20 ale Note Added: 0047266