cmake-config.txt (xpdf-4.03) | : | cmake-config.txt (xpdf-4.04) | ||
---|---|---|---|---|
#======================================================================== | #======================================================================== | |||
# | # | |||
# cmake-config.txt | # cmake-config.txt | |||
# | # | |||
# CMake script to do misc cmake config and platform-specific config. | # CMake script to do misc cmake config and platform-specific config. | |||
# | # | |||
# Copyright 2015 Glyph & Cog, LLC | # Copyright 2021 Glyph & Cog, LLC | |||
# | # | |||
#======================================================================== | #======================================================================== | |||
if (POLICY CMP0074) | if (POLICY CMP0074) | |||
cmake_policy(SET CMP0074 NEW) | cmake_policy(SET CMP0074 NEW) | |||
endif () | endif () | |||
if (APPLE) | if (APPLE) | |||
if (POLICY CMP0042) | if (POLICY CMP0042) | |||
cmake_policy(SET CMP0042 NEW) | cmake_policy(SET CMP0042 NEW) | |||
endif () | endif () | |||
set(CMAKE_MACOSX_RPATH 1) | set(CMAKE_MACOSX_RPATH 1) | |||
endif () | endif () | |||
include(CheckFunctionExists) | include(CheckFunctionExists) | |||
include(CheckCXXSourceCompiles) | include(CheckCXXSourceCompiles) | |||
include(GNUInstallDirs) | include(GNUInstallDirs) | |||
enable_language(CXX) | enable_language(CXX) | |||
#--- set default C/C++ compiler flags for Unix | #--- add a 'Profiling' build mode | |||
# and add a 'Profiling' build mode | ||||
if (CMAKE_GENERATOR STREQUAL "Unix Makefiles") | if (CMAKE_GENERATOR STREQUAL "Unix Makefiles") | |||
if (CYGWIN) | set(CMAKE_C_FLAGS_PROFILING "-g -pg -O -Wall" | |||
set(PIC_FLAG "") | CACHE STRING "C compiler flags for profiling mode" | |||
elseif (CMAKE_HOST_SYSTEM_NAME MATCHES "AIX") | FORCE) | |||
set(PIC_FLAG "-qPIC") | set(CMAKE_CXX_FLAGS_PROFILING "-g -pg -O -Wall" | |||
else () | CACHE STRING "C++ compiler flags for profiling mode" | |||
set(PIC_FLAG "-fPIC") | FORCE) | |||
endif () | set(CMAKE_EXE_LINKER_FLAGS_PROFILING "-g -pg -O -Wall" | |||
set(CMAKE_C_FLAGS_DEBUG "-g -O -Wall ${PIC_FLAG}") | CACHE STRING "linker flags for profiling mode" | |||
set(CMAKE_CXX_FLAGS_DEBUG "-g -O -Wall ${PIC_FLAG}") | FORCE) | |||
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "-g -O -Wall ${PIC_FLAG}") | set(CMAKE_SHARED_LINKER_FLAGS_PROFILING "-g -pg -O -Wall" | |||
set(CMAKE_C_FLAGS_RELEASE "-O3 -Wall ${PIC_FLAG}") | CACHE STRING "shared linker flags for profiling mode" | |||
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -Wall ${PIC_FLAG}") | FORCE) | |||
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "-O2 -Wall ${PIC_FLAG}") | ||||
set(CMAKE_C_FLAGS_PROFILING "-g -pg -O -Wall ${PIC_FLAG}" | ||||
CACHE STRING "C compiler flags for profiling mode") | ||||
set(CMAKE_CXX_FLAGS_PROFILING "-g -pg -O -Wall ${PIC_FLAG}" | ||||
CACHE STRING "C++ compiler flags for profiling mode") | ||||
set(CMAKE_EXE_LINKER_FLAGS_PROFILING "-g -pg -O -Wall ${PIC_FLAG}" | ||||
CACHE STRING "linker flags for profiling mode") | ||||
mark_as_advanced( | mark_as_advanced( | |||
CMAKE_C_FLAGS_PROFILING | CMAKE_C_FLAGS_PROFILING | |||
CMAKE_CXX_FLAGS_PROFILING | CMAKE_CXX_FLAGS_PROFILING | |||
CMAKE_EXE_LINKER_FLAGS_PROFILING) | CMAKE_EXE_LINKER_FLAGS_PROFILING | |||
CMAKE_SHARED_LINKER_FLAGS_PROFILING) | ||||
set(CMAKE_BUILD_TYPE "${CMAKE_BUILD_TYPE}" CACHE STRING | set(CMAKE_BUILD_TYPE "${CMAKE_BUILD_TYPE}" CACHE STRING | |||
"Choose build mode - options are: None Debug Release RelWithDebInfo MinSiz | "Choose build mode - options are: None Debug Release RelWithDebInfo MinSiz | |||
eRel Profiling") | eRel Profiling" | |||
FORCE) | ||||
endif () | endif () | |||
#--- set default C/C++ compiler flags for Windows | #--- set default C/C++ compiler flags for Windows | |||
if (WIN32) | if (MSVC) | |||
option(USE_MT_IN_DEBUG "use /MT instead of /MTd in debug builds" OFF) | option(USE_MT_IN_DEBUG "use /MT instead of /MTd in debug builds" OFF) | |||
foreach (var CMAKE_C_FLAGS_DEBUG CMAKE_CXX_FLAGS_DEBUG | foreach (var CMAKE_C_FLAGS_DEBUG CMAKE_CXX_FLAGS_DEBUG | |||
CMAKE_C_FLAGS_RELEASE CMAKE_CXX_FLAGS_RELEASE | CMAKE_C_FLAGS_RELEASE CMAKE_CXX_FLAGS_RELEASE | |||
CMAKE_C_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_MINSIZEREL | CMAKE_C_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_MINSIZEREL | |||
CMAKE_C_FLAGS_RELWITHDEBINFO CMAKE_CXX_FLAGS_RELWITHDEBINFO) | CMAKE_C_FLAGS_RELWITHDEBINFO CMAKE_CXX_FLAGS_RELWITHDEBINFO) | |||
# note: this converts /MD to /MT and /MDd to /MTd | # note: this converts /MD to /MT and /MDd to /MTd | |||
string(REGEX REPLACE "/MD" "/MT" ${var} "${${var}}") | string(REGEX REPLACE "/MD" "/MT" ${var} "${${var}}") | |||
endforeach () | endforeach () | |||
if (USE_MT_IN_DEBUG) | if (USE_MT_IN_DEBUG) | |||
string(REPLACE "/MTd" "/MT" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}") | string(REPLACE "/MTd" "/MT" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}") | |||
skipping to change at line 111 | skipping to change at line 105 | |||
option(SYSTEM_XPDFRC "full path for system-wide xpdfrc file" "") | option(SYSTEM_XPDFRC "full path for system-wide xpdfrc file" "") | |||
if (SYSTEM_XPDFRC) | if (SYSTEM_XPDFRC) | |||
set(SYSTEM_XPDFRC_DEFINE "#define SYSTEM_XPDFRC \"${SYSTEM_XPDFRC}\"") | set(SYSTEM_XPDFRC_DEFINE "#define SYSTEM_XPDFRC \"${SYSTEM_XPDFRC}\"") | |||
else () | else () | |||
set(SYSTEM_XPDFRC_DEFINE "/* #undef SYSTEM_XPDFRC */") | set(SYSTEM_XPDFRC_DEFINE "/* #undef SYSTEM_XPDFRC */") | |||
endif () | endif () | |||
option(XPDFRC_DATADIR "directory to use for the DATADIR xpdfrc variable" "") | option(XPDFRC_DATADIR "directory to use for the DATADIR xpdfrc variable" "") | |||
if (XPDFRC_DATADIR) | if (XPDFRC_DATADIR) | |||
set(XPDFRC_DATADIR_DEFINE "#define XPDFRC_DATADIR \"${XPDFRC_DATADIR}\"") | set(XPDFRC_DATADIR_DEFINE "#define XPDFRC_DATADIR \"${XPDFRC_DATADIR}\"") | |||
else () | else () | |||
set(XPDFRC_DATADIR_DEFINE "/* #undef SYSTEM_XPDFRC */") | set(XPDFRC_DATADIR_DEFINE "/* #undef XPDFRC_DATADIR */") | |||
endif () | endif () | |||
if (WIN32) | if (WIN32) | |||
option(XPDFWIDGET_PRINTING "include printing support in XpdfWidget" OFF) | option(XPDFWIDGET_PRINTING "include printing support in XpdfWidget" OFF) | |||
else () | else () | |||
option(XPDFWIDGET_PRINTING "include printing support in XpdfWidget" ON) | option(XPDFWIDGET_PRINTING "include printing support in XpdfWidget" ON) | |||
endif () | endif () | |||
#--- check for various library functions | #--- check for various library functions | |||
check_function_exists(mkstemp HAVE_MKSTEMP) | check_function_exists(mkstemp HAVE_MKSTEMP) | |||
check_function_exists(mkstemps HAVE_MKSTEMPS) | check_function_exists(mkstemps HAVE_MKSTEMPS) | |||
skipping to change at line 210 | skipping to change at line 204 | |||
set(HAVE_SPLASH TRUE) | set(HAVE_SPLASH TRUE) | |||
endif () | endif () | |||
#--- look for zlib | #--- look for zlib | |||
find_package(ZLIB) | find_package(ZLIB) | |||
#--- look for libpng | #--- look for libpng | |||
find_package(PNG) | find_package(PNG) | |||
#--- look for Qt | #--- look for Qt | |||
find_package(Qt5Widgets QUIET) | find_package(Qt6Widgets QUIET) | |||
if (Qt5Widgets_FOUND) | if (Qt6Widgets_FOUND) | |||
find_package(Qt5Network) | find_package(Qt6Network) | |||
find_package(Qt5PrintSupport) | find_package(Qt6PrintSupport) | |||
else () | else () | |||
find_package(Qt4 COMPONENTS QtCore QtGui QtNetwork) | find_package(Qt5Widgets QUIET) | |||
if (Qt5Widgets_FOUND) | ||||
find_package(Qt5Network) | ||||
find_package(Qt5PrintSupport) | ||||
else () | ||||
find_package(Qt4 COMPONENTS QtCore QtGui QtNetwork) | ||||
endif () | ||||
endif () | endif () | |||
if(Qt5Widgets_FOUND) | if (Qt5Widgets_FOUND) | |||
message(STATUS "Qt5 found") | message(STATUS "Qt5 found") | |||
if (XPDFWIDGET_PRINTING) | if (XPDFWIDGET_PRINTING) | |||
set(QT_INCLUDES "${Qt5Widgets_INCLUDE_DIRS} ${Qt5Network_INCLUDE_DIRS} ${Qt5 PrintSupport_INCLUDE_DIRS}") | set(QT_INCLUDES "${Qt5Widgets_INCLUDE_DIRS} ${Qt5Network_INCLUDE_DIRS} ${Qt5 PrintSupport_INCLUDE_DIRS}") | |||
set(QT_DEFINITIONS "${Qt5Widgets_DEFINITIONS} ${Qt5Network_DEFINITIONS} ${Qt 5PrintSupport_DEFINITIONS}") | set(QT_DEFINITIONS "${Qt5Widgets_DEFINITIONS} ${Qt5Network_DEFINITIONS} ${Qt 5PrintSupport_DEFINITIONS}") | |||
set(QT_LIBRARIES Qt5::Widgets Qt5::Network Qt5::PrintSupport) | set(QT_LIBRARIES Qt5::Widgets Qt5::Network Qt5::PrintSupport) | |||
else () | else () | |||
set(QT_INCLUDES "${Qt5Widgets_INCLUDE_DIRS} ${Qt5Network_INCLUDE_DIRS}") | set(QT_INCLUDES "${Qt5Widgets_INCLUDE_DIRS} ${Qt5Network_INCLUDE_DIRS}") | |||
set(QT_DEFINITIONS "${Qt5Widgets_DEFINITIONS} ${Qt5Network_DEFINITIONS}") | set(QT_DEFINITIONS "${Qt5Widgets_DEFINITIONS} ${Qt5Network_DEFINITIONS}") | |||
set(QT_LIBRARIES Qt5::Widgets Qt5::Network) | set(QT_LIBRARIES Qt5::Widgets Qt5::Network) | |||
endif () | endif () | |||
skipping to change at line 244 | skipping to change at line 244 | |||
set(EXTRA_QT_LIBRARIES ${CUPS_LIBRARIES}) | set(EXTRA_QT_LIBRARIES ${CUPS_LIBRARIES}) | |||
else () | else () | |||
set (XPDFWIDGET_PRINTING OFF) | set (XPDFWIDGET_PRINTING OFF) | |||
endif () | endif () | |||
else () | else () | |||
set(EXTRA_QT_LIBRARIES "") | set(EXTRA_QT_LIBRARIES "") | |||
endif () | endif () | |||
endif () | endif () | |||
# remove "-fPIE" here because we added "-fPIC" above | # remove "-fPIE" here because we added "-fPIC" above | |||
string(REPLACE "-fPIE" "" QT_CFLAGS "${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}") | string(REPLACE "-fPIE" "" QT_CFLAGS "${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}") | |||
elseif(QT4_FOUND) | elseif (Qt6Widgets_FOUND) | |||
message(STATUS "Qt6 found") | ||||
if (XPDFWIDGET_PRINTING) | ||||
set(QT_INCLUDES "${Qt6Widgets_INCLUDE_DIRS} ${Qt6Network_INCLUDE_DIRS} ${Qt6 | ||||
PrintSupport_INCLUDE_DIRS}") | ||||
set(QT_DEFINITIONS "${Qt6Widgets_DEFINITIONS} ${Qt6Network_DEFINITIONS} ${Qt | ||||
6PrintSupport_DEFINITIONS}") | ||||
set(QT_LIBRARIES Qt6::Widgets Qt6::Network Qt6::PrintSupport) | ||||
else () | ||||
set(QT_INCLUDES "${Qt6Widgets_INCLUDE_DIRS} ${Qt6Network_INCLUDE_DIRS}") | ||||
set(QT_DEFINITIONS "${Qt6Widgets_DEFINITIONS} ${Qt6Network_DEFINITIONS}") | ||||
set(QT_LIBRARIES Qt6::Widgets Qt6::Network) | ||||
endif () | ||||
if (XPDFWIDGET_PRINTING) | ||||
if (APPLE) | ||||
set(EXTRA_QT_LIBRARIES "-framework ApplicationServices") | ||||
elseif (UNIX) | ||||
find_package(Cups) | ||||
if (CUPS_FOUND) | ||||
set(EXTRA_QT_LIBRARIES ${CUPS_LIBRARIES}) | ||||
else () | ||||
set (XPDFWIDGET_PRINTING OFF) | ||||
endif () | ||||
else () | ||||
set(EXTRA_QT_LIBRARIES "") | ||||
endif () | ||||
endif () | ||||
# remove "-fPIE" here because we added "-fPIC" above | ||||
string(REPLACE "-fPIE" "" QT_CFLAGS "${Qt6Widgets_EXECUTABLE_COMPILE_FLAGS}") | ||||
elseif (QT4_FOUND) | ||||
message(STATUS "Qt4 found") | message(STATUS "Qt4 found") | |||
if (XPDFWIDGET_PRINTING) | if (XPDFWIDGET_PRINTING) | |||
if (APPLE) | if (APPLE) | |||
set(EXTRA_QT_LIBRARIES "-framework ApplicationServices") | set(EXTRA_QT_LIBRARIES "-framework ApplicationServices") | |||
elseif (UNIX) | elseif (UNIX) | |||
find_package(Cups) | find_package(Cups) | |||
if (CUPS_FOUND) | if (CUPS_FOUND) | |||
set(EXTRA_QT_LIBRARIES ${CUPS_LIBRARIES}) | set(EXTRA_QT_LIBRARIES ${CUPS_LIBRARIES}) | |||
else () | else () | |||
set (XPDFWIDGET_PRINTING OFF) | set (XPDFWIDGET_PRINTING OFF) | |||
endif () | endif () | |||
else () | else () | |||
set(EXTRA_QT_LIBRARIES "") | set(EXTRA_QT_LIBRARIES "") | |||
endif () | endif () | |||
endif () | endif () | |||
else() | else () | |||
message(STATUS "No Qt library found") | message(STATUS "No Qt library found") | |||
endif() | endif () | |||
#--- look for libpaper | #--- look for libpaper | |||
find_library(PAPER_LIBRARY | find_library(PAPER_LIBRARY | |||
NAMES paper libpaper | NAMES paper libpaper | |||
PATH_SUFFIXES lib64 lib | PATH_SUFFIXES lib64 lib | |||
) | ) | |||
if (PAPER_LIBRARY) | if (PAPER_LIBRARY) | |||
set(HAVE_PAPER_H TRUE) | set(HAVE_PAPER_H TRUE) | |||
else () | else () | |||
set(HAVE_PAPER_H FALSE) | set(HAVE_PAPER_H FALSE) | |||
End of changes. 13 change blocks. | ||||
36 lines changed or deleted | 65 lines changed or added |