summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 01:24:41 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 01:24:41 +0000
commita9bcc81f821d7c66f623779fa5147e728eb3c388 (patch)
tree98676963bcdd537ae5908a067a8eb110b93486a6 /cmake
parentInitial commit. (diff)
downloadfreerdp3-a9bcc81f821d7c66f623779fa5147e728eb3c388.tar.xz
freerdp3-a9bcc81f821d7c66f623779fa5147e728eb3c388.zip
Adding upstream version 3.3.0+dfsg1.upstream/3.3.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/CheckCmakeCompat.cmake26
-rw-r--r--cmake/ClangDetectTool.cmake48
-rw-r--r--cmake/ClangFormat.cmake17
-rw-r--r--cmake/ClangTidy.cmake16
-rw-r--r--cmake/ClangToolchain.cmake17
-rw-r--r--cmake/CommonConfigOptions.cmake36
-rw-r--r--cmake/CompilerFlags.cmake58
-rw-r--r--cmake/ConfigOptions.cmake239
-rw-r--r--cmake/ConfigOptionsiOS.cmake25
-rw-r--r--cmake/ConfigureFreeRDP.cmake10
-rw-r--r--cmake/ConfigureRPATH.cmake18
-rw-r--r--cmake/DetectBSD.cmake18
-rw-r--r--cmake/EchoTarget.cmake178
-rw-r--r--cmake/FindCairo.cmake166
-rw-r--r--cmake/FindDocBookXSL.cmake52
-rw-r--r--cmake/FindFAAC.cmake13
-rw-r--r--cmake/FindFAAD2.cmake13
-rw-r--r--cmake/FindFFmpeg.cmake78
-rw-r--r--cmake/FindFeature.cmake64
-rw-r--r--cmake/FindGSM.cmake13
-rw-r--r--cmake/FindIPP.cmake397
-rw-r--r--cmake/FindKRB5.cmake221
-rw-r--r--cmake/FindLAME.cmake13
-rw-r--r--cmake/FindMbedTLS.cmake38
-rw-r--r--cmake/FindOSS.cmake44
-rw-r--r--cmake/FindOpenH264.cmake46
-rw-r--r--cmake/FindOpenSLES.cmake30
-rw-r--r--cmake/FindPAM.cmake40
-rw-r--r--cmake/FindPCSC.cmake28
-rw-r--r--cmake/FindPCSCWinPR.cmake15
-rw-r--r--cmake/FindPixman.cmake41
-rw-r--r--cmake/FindPkcs11.cmake29
-rw-r--r--cmake/FindSWScale.cmake14
-rw-r--r--cmake/FindWayland.cmake75
-rw-r--r--cmake/Findlibsystemd.cmake44
-rw-r--r--cmake/Findlibusb-1.0.cmake98
-rw-r--r--cmake/Findlodepng.cmake19
-rw-r--r--cmake/Findsoxr.cmake62
-rw-r--r--cmake/GNUInstallDirsWrapper.cmake21
-rw-r--r--cmake/GetGitRevisionDescription.cmake135
-rw-r--r--cmake/GetGitRevisionDescription.cmake.in38
-rw-r--r--cmake/InstallFreeRDPMan.cmake55
-rw-r--r--cmake/LibFindMacros.cmake116
-rw-r--r--cmake/MSVCRuntime.cmake47
-rw-r--r--cmake/MergeStaticLibs.cmake151
-rw-r--r--cmake/PreventInSourceBuilds.cmake55
-rw-r--r--cmake/SetFreeRDPCMakeInstallDir.cmake7
-rw-r--r--cmake/ShowCMakeVars.cmake15
-rw-r--r--cmake/WarnUnmaintained.cmake9
-rw-r--r--cmake/WindowsDLLVersion.rc.in35
-rw-r--r--cmake/pkg-config-install-prefix.cmake13
-rw-r--r--cmake/today.cmake11
52 files changed, 3067 insertions, 0 deletions
diff --git a/cmake/CheckCmakeCompat.cmake b/cmake/CheckCmakeCompat.cmake
new file mode 100644
index 0000000..460e59d
--- /dev/null
+++ b/cmake/CheckCmakeCompat.cmake
@@ -0,0 +1,26 @@
+# Central location to check for cmake (version) requirements
+#
+#=============================================================================
+# Copyright 2012 Bernhard Miklautz <bernhard.miklautz@thincast.com>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#=============================================================================
+
+macro(enable_cmake_compat CMVERSION)
+ if(${CMAKE_VERSION} VERSION_LESS ${CMVERSION})
+ LIST(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/compat_${CMVERSION}/")
+ endif()
+endmacro()
+
+# Compatibility includes - order does matter!
+enable_cmake_compat(3.7.0)
diff --git a/cmake/ClangDetectTool.cmake b/cmake/ClangDetectTool.cmake
new file mode 100644
index 0000000..a1ecd56
--- /dev/null
+++ b/cmake/ClangDetectTool.cmake
@@ -0,0 +1,48 @@
+function (clang_detect_tool VAR NAME OPTS)
+ set(NAMES "")
+ foreach(CNT RANGE 12 22)
+ list(APPEND NAMES "${NAME}-${CNT}")
+ endforeach()
+ list(REVERSE NAMES)
+ list(APPEND NAMES ${NAME})
+
+ find_program(${VAR}
+ NAMES ${NAMES}
+ ${OPTS}
+ )
+ if (NOT ${VAR})
+ message(WARNING "clang tool ${NAME} (${VAR}) not detected, skipping")
+ unset(${VAR})
+ return()
+ endif()
+
+ execute_process(
+ COMMAND ${${VAR}} "--version"
+ OUTPUT_VARIABLE _CLANG_TOOL_VERSION
+ RESULT_VARIABLE _CLANG_TOOL_VERSION_FAILED
+ )
+
+ if (_CLANG_TOOL_VERSION_FAILED)
+ message(WARNING "A problem was encounterd with ${${VAR}}")
+ message(WARNING "${_CLANG_TOOL_VERSION_FAILED}")
+ unset(${VAR})
+ return()
+ endif()
+
+ string(REGEX MATCH "([7-9]|[1-9][0-9])\\.[0-9]\\.[0-9]" CLANG_TOOL_VERSION
+ "${_CLANG_TOOL_VERSION}")
+
+ if (NOT CLANG_TOOL_VERSION)
+ message(WARNING "problem parsing ${NAME} version for ${${VAR}}")
+ unset(${VAR})
+ return()
+ endif()
+
+ set(_CLANG_TOOL_MINIMUM_VERSION "12.0.0")
+ if (${CLANG_TOOL_VERSION} VERSION_LESS ${_CLANG_TOOL_MINIMUM_VERSION})
+ message(WARNING "clang-format version ${CLANG_TOOL_VERSION} not supported")
+ message(WARNING "Minimum version required: ${_CLANG_TOOL_MINIMUM_VERSION}")
+ unset(${VAR})
+ return()
+ endif()
+endfunction()
diff --git a/cmake/ClangFormat.cmake b/cmake/ClangFormat.cmake
new file mode 100644
index 0000000..b815822
--- /dev/null
+++ b/cmake/ClangFormat.cmake
@@ -0,0 +1,17 @@
+# get all project files
+file(GLOB_RECURSE ALL_SOURCE_FILES *.cpp *.c *.h *.m *.java)
+
+include(ClangDetectTool)
+clang_detect_tool(CLANG_FORMAT clang-format "")
+
+if (NOT CLANG_FORMAT)
+ message(WARNING "clang-format not found in path! code format target not available.")
+else()
+ add_custom_target(
+ clangformat
+ COMMAND ${CLANG_FORMAT}
+ -style=file
+ -i
+ ${ALL_SOURCE_FILES}
+ )
+endif()
diff --git a/cmake/ClangTidy.cmake b/cmake/ClangTidy.cmake
new file mode 100644
index 0000000..b596f78
--- /dev/null
+++ b/cmake/ClangTidy.cmake
@@ -0,0 +1,16 @@
+option(BUILD_WITH_CLANG_TIDY "Build with clang-tidy for extra warnings" OFF)
+
+if (BUILD_WITH_CLANG_TIDY)
+ include(ClangDetectTool)
+ clang_detect_tool(CLANG_TIDY_EXE clang-tidy REQUIRED)
+
+ set(CLANG_TIDY_COMMAND "${CLANG_TIDY_EXE}" --config-file=${CMAKE_SOURCE_DIR}/.clang-tidy)
+
+ set(CMAKE_C_CLANG_TIDY "${CLANG_TIDY_COMMAND}" --extra-arg=-std=gnu11)
+ set(CMAKE_CXX_CLANG_TIDY "${CLANG_TIDY_COMMAND}" --extra-arg=-std=gnu++17)
+ set(CMAKE_OBJC_CLANG_TIDY "${CLANG_TIDY_COMMAND}")
+else()
+ unset(CMAKE_C_CLANG_TIDY)
+ unset(CMAKE_CXX_CLANG_TIDY)
+ unset(CMAKE_OBJC_CLANG_TIDY)
+endif()
diff --git a/cmake/ClangToolchain.cmake b/cmake/ClangToolchain.cmake
new file mode 100644
index 0000000..b5ae35a
--- /dev/null
+++ b/cmake/ClangToolchain.cmake
@@ -0,0 +1,17 @@
+if ($ENV{CLANG_VERSION})
+ SET (CLANG_VERSION "-$ENV{CLANG_VERSION}")
+endif()
+
+SET (CLANG_WARNINGS "-pedantic -Weverything -Wno-padded -Wno-covered-switch-default -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-cast-align")
+
+SET (CMAKE_C_COMPILER "/usr/bin/clang${CLANG_VERSION}" CACHE PATH "")
+SET (CMAKE_C_FLAGS ${CLANG_WARNINGS} CACHE STRING "")
+
+SET (CMAKE_CXX_COMPILER "/usr/bin/clang++${CLANG_VERSION}" CACHE PATH "")
+SET (CMAKE_CXX_FLAGS ${CLANG_WARNINGS} CACHE STRING "")
+
+SET (CMAKE_AR "/usr/bin/llvm-ar${CLANG_VERSION}" CACHE PATH "")
+SET (CMAKE_LINKER "/usr/bin/llvm-link${CLANG_VERSION}" CACHE PATH "")
+SET (CMAKE_NM "/usr/bin/llvm-nm${CLANG_VERSION}" CACHE PATH "")
+SET (CMAKE_OBJDUMP "/usr/bin/llvm-objdump${CLANG_VERSION}" CACHE PATH "")
+SET (CMAKE_RANLIB "/usr/bin/llvm-ranlib${CLANG_VERSION}" CACHE PATH "")
diff --git a/cmake/CommonConfigOptions.cmake b/cmake/CommonConfigOptions.cmake
new file mode 100644
index 0000000..8d7f485
--- /dev/null
+++ b/cmake/CommonConfigOptions.cmake
@@ -0,0 +1,36 @@
+option(CMAKE_COLOR_MAKEFILE "colorful CMake makefile" ON)
+option(CMAKE_VERBOSE_MAKEFILE "verbose CMake makefile" ON)
+option(CMAKE_POSITION_INDEPENDENT_CODE "build with position independent code (-fPIC or -fPIE)" ON)
+option(WITH_LIBRARY_VERSIONING "Use library version triplet" ON)
+option(WITH_BINARY_VERSIONING "Use binary versioning" OFF)
+option(BUILD_SHARED_LIBS "Build shared libraries" ON)
+
+# known issue on android, thus disabled until we support newer CMake
+# https://github.com/android/ndk/issues/1444
+if (NOT ANDROID)
+ if(POLICY CMP0069)
+ cmake_policy(SET CMP0069 NEW)
+ endif()
+ if(POLICY CMP0138)
+ cmake_policy(SET CMP0138 NEW)
+ endif()
+ include(CheckIPOSupported)
+ check_ipo_supported(RESULT supported OUTPUT error)
+ if (NOT supported)
+ message(WARNING "LTO not supported, got ${error}")
+ endif()
+
+ option(CMAKE_INTERPROCEDURAL_OPTIMIZATION "build with link time optimization" ${supported})
+endif()
+
+# Default to release build type
+if(NOT CMAKE_BUILD_TYPE)
+ set(CMAKE_BUILD_TYPE "Release" CACHE STRING "project default")
+endif()
+
+include(PreventInSourceBuilds)
+include(GNUInstallDirsWrapper)
+include(MSVCRuntime)
+include(ConfigureRPATH)
+include(ClangTidy)
+
diff --git a/cmake/CompilerFlags.cmake b/cmake/CompilerFlags.cmake
new file mode 100644
index 0000000..fe951bb
--- /dev/null
+++ b/cmake/CompilerFlags.cmake
@@ -0,0 +1,58 @@
+include(CheckCCompilerFlag)
+
+macro (checkCFlag FLAG)
+ CHECK_C_COMPILER_FLAG("${FLAG}" CFLAG${FLAG})
+ if(CFLAG${FLAG})
+ string(APPEND CMAKE_C_FLAGS " ${FLAG}")
+ else()
+ message(WARNING "compiler does not support ${FLAG}")
+ endif()
+endmacro()
+
+option(ENABLE_WARNING_VERBOSE "enable -Weveryting (and some exceptions) for compile" ON)
+option(ENABLE_WARNING_ERROR "enable -Werror for compile" OFF)
+
+if (ENABLE_WARNING_VERBOSE)
+ if (MSVC)
+ # Remove previous warning definitions,
+ # NMake is otherwise complaining.
+ foreach (flags_var_to_scrub
+ CMAKE_C_FLAGS
+ CMAKE_C_FLAGS_DEBUG
+ CMAKE_C_FLAGS_RELEASE
+ CMAKE_C_FLAGS_RELWITHDEBINFO
+ CMAKE_C_FLAGS_MINSIZEREL)
+ string (REGEX REPLACE "(^| )[/-]W[ ]*[1-9]" " "
+ "${flags_var_to_scrub}" "${${flags_var_to_scrub}}")
+ endforeach()
+
+ set(C_WARNING_FLAGS
+ /W4
+ /wo4324
+ )
+ else()
+ set(C_WARNING_FLAGS
+ -Weverything
+ -Wall
+ -Wpedantic
+ -Wno-padded
+ -Wno-cast-align
+ -Wno-declaration-after-statement
+ -Wno-unsafe-buffer-usage
+ -Wno-reserved-identifier
+ -Wno-covered-switch-default
+ )
+ endif()
+
+ foreach(FLAG ${C_WARNING_FLAGS})
+ CheckCFlag(${FLAG})
+ endforeach()
+endif()
+
+
+if (ENABLE_WARNING_ERROR)
+ CheckCFlag(-Werror)
+endif()
+
+set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} CACHE STRING "default CFLAGS")
+message("Using CFLAGS ${CMAKE_C_FLAGS}")
diff --git a/cmake/ConfigOptions.cmake b/cmake/ConfigOptions.cmake
new file mode 100644
index 0000000..ce451c6
--- /dev/null
+++ b/cmake/ConfigOptions.cmake
@@ -0,0 +1,239 @@
+include(CMakeDependentOption)
+
+if((CMAKE_SYSTEM_PROCESSOR MATCHES "i386|i686|x86|AMD64") AND (CMAKE_SIZEOF_VOID_P EQUAL 4))
+ set(TARGET_ARCH "x86")
+elseif((CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|AMD64") AND (CMAKE_SIZEOF_VOID_P EQUAL 8))
+ set(TARGET_ARCH "x64")
+elseif((CMAKE_SYSTEM_PROCESSOR MATCHES "i386") AND (CMAKE_SIZEOF_VOID_P EQUAL 8) AND (APPLE))
+ # Mac is weird like that.
+ set(TARGET_ARCH "x64")
+elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm*")
+ set(TARGET_ARCH "ARM")
+elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "sparc")
+ set(TARGET_ARCH "sparc")
+elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "e2k")
+ set(TARGET_ARCH "e2k")
+endif()
+
+if (NOT OPENBSD AND NOT WIN32)
+ set(MANPAGE_DEF ON)
+endif()
+option(WITH_MANPAGES "Generate manpages." ${MANPAGE_DEF})
+option(WITH_PROFILER "Compile profiler." OFF)
+option(WITH_GPROF "Compile with GProf profiler." OFF)
+
+option(WITH_SSE2 "Enable SSE2 optimization." OFF)
+option(WITH_NEON "Enable NEON optimization." OFF)
+option(WITH_IPP "Use Intel Performance Primitives." OFF)
+
+option(WITH_JPEG "Use JPEG decoding." OFF)
+
+if(CMAKE_C_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
+ set(CMAKE_COMPILER_IS_CLANG 1)
+endif()
+
+if(NOT WIN32)
+ CMAKE_DEPENDENT_OPTION(WITH_VALGRIND_MEMCHECK "Compile with valgrind helpers." OFF
+ "NOT WITH_SANITIZE_ADDRESS; NOT WITH_SANITIZE_MEMORY; NOT WITH_SANITIZE_THREAD" OFF)
+ CMAKE_DEPENDENT_OPTION(WITH_SANITIZE_ADDRESS "Compile with gcc/clang address sanitizer." OFF
+ "NOT WITH_VALGRIND_MEMCHECK; NOT WITH_SANITIZE_MEMORY; NOT WITH_SANITIZE_THREAD" OFF)
+ CMAKE_DEPENDENT_OPTION(WITH_SANITIZE_MEMORY "Compile with gcc/clang memory sanitizer." OFF
+ "NOT WITH_VALGRIND_MEMCHECK; NOT WITH_SANITIZE_ADDRESS; NOT WITH_SANITIZE_THREAD" OFF)
+ CMAKE_DEPENDENT_OPTION(WITH_SANITIZE_THREAD "Compile with gcc/clang thread sanitizer." OFF
+ "NOT WITH_VALGRIND_MEMCHECK; NOT WITH_SANITIZE_ADDRESS; NOT WITH_SANITIZE_MEMORY" OFF)
+else()
+ if(NOT UWP)
+ option(WITH_MEDIA_FOUNDATION "Enable H264 media foundation decoder." OFF)
+ endif()
+endif()
+
+if(WIN32 AND NOT UWP)
+ option(WITH_WINMM "Use Windows Multimedia" ON)
+ option(WITH_WIN8 "Use Windows 8 libraries" OFF)
+endif()
+
+option(BUILD_TESTING "Build unit tests" OFF)
+CMAKE_DEPENDENT_OPTION(TESTS_WTSAPI_EXTRA "Build extra WTSAPI tests (interactive)" OFF "BUILD_TESTING" OFF)
+CMAKE_DEPENDENT_OPTION(BUILD_COMM_TESTS "Build comm related tests (require comm port)" OFF "BUILD_TESTING" OFF)
+
+option(WITH_SAMPLE "Build sample code" ON)
+
+option(WITH_CLIENT_COMMON "Build client common library" ON)
+CMAKE_DEPENDENT_OPTION(WITH_CLIENT "Build client binaries" ON "WITH_CLIENT_COMMON" OFF)
+CMAKE_DEPENDENT_OPTION(WITH_CLIENT_SDL "[experimental] Build SDL client " ON "WITH_CLIENT" OFF)
+
+option(WITH_SERVER "Build server binaries" ON)
+
+option(WITH_CHANNELS "Build virtual channel plugins" ON)
+
+option(FREERDP_UNIFIED_BUILD "Build WinPR, uwac, RdTk and FreeRDP in one go" ON)
+
+CMAKE_DEPENDENT_OPTION(WITH_CLIENT_CHANNELS "Build virtual channel plugins" ON
+ "WITH_CLIENT_COMMON;WITH_CHANNELS" OFF)
+
+CMAKE_DEPENDENT_OPTION(WITH_MACAUDIO "Enable OSX sound backend" ON "APPLE;NOT IOS" OFF)
+
+if(WITH_SERVER AND WITH_CHANNELS)
+ option(WITH_SERVER_CHANNELS "Build virtual channel plugins" ON)
+endif()
+
+option(WITH_THIRD_PARTY "Build third-party components" OFF)
+
+option(WITH_CLIENT_INTERFACE "Build clients as a library with an interface" OFF)
+option(WITH_SERVER_INTERFACE "Build servers as a library with an interface" ON)
+
+option(WITH_DEBUG_ALL "Print all debug messages." OFF)
+
+if(WITH_DEBUG_ALL)
+ message(WARNING "WITH_DEBUG_ALL=ON, the build will be slow and might leak sensitive information, do not use with release builds!")
+ set(DEFAULT_DEBUG_OPTION ON CACHE INTERNAL "debug default")
+else()
+ set(DEFAULT_DEBUG_OPTION OFF CACHE INTERNAL "debug default")
+endif()
+
+option(WITH_DEBUG_CERTIFICATE "Print certificate related debug messages." ${DEFAULT_DEBUG_OPTION})
+if(WITH_DEBUG_CERTIFICATE)
+ message(WARNING "WITH_DEBUG_CERTIFICATE=ON, the build might leak sensitive information, do not use with release builds!")
+endif()
+option(WITH_DEBUG_CAPABILITIES "Print capability negotiation debug messages." ${DEFAULT_DEBUG_OPTION})
+option(WITH_DEBUG_CHANNELS "Print channel manager debug messages." ${DEFAULT_DEBUG_OPTION})
+option(WITH_DEBUG_CLIPRDR "Print clipboard redirection debug messages" ${DEFAULT_DEBUG_OPTION})
+option(WITH_DEBUG_CODECS "Print codec debug messages" ${DEFAULT_DEBUG_OPTION})
+option(WITH_DEBUG_RDPGFX "Print RDPGFX debug messages" ${DEFAULT_DEBUG_OPTION})
+option(WITH_DEBUG_DVC "Print dynamic virtual channel debug messages." ${DEFAULT_DEBUG_OPTION})
+CMAKE_DEPENDENT_OPTION(WITH_DEBUG_TSMF "Print TSMF virtual channel debug messages." ${DEFAULT_DEBUG_OPTION} "CHANNEL_TSMF" OFF)
+option(WITH_DEBUG_KBD "Print keyboard related debug messages." ${DEFAULT_DEBUG_OPTION})
+if(WITH_DEBUG_KBD)
+ message(WARNING "WITH_DEBUG_KBD=ON, the build might leak sensitive information, do not use with release builds!")
+endif()
+option(WITH_DEBUG_LICENSE "Print license debug messages." ${DEFAULT_DEBUG_OPTION})
+if(WITH_DEBUG_LICENSE)
+ message(WARNING "WITH_DEBUG_LICENSE=ON, the build might leak sensitive information, do not use with release builds!")
+endif()
+option(WITH_DEBUG_NEGO "Print negotiation related debug messages." ${DEFAULT_DEBUG_OPTION})
+if(WITH_DEBUG_NEGO)
+ message(WARNING "WITH_DEBUG_NEGO=ON, the build might leak sensitive information, do not use with release builds!")
+endif()
+option(WITH_DEBUG_NLA "Print authentication related debug messages." ${DEFAULT_DEBUG_OPTION})
+if(WITH_DEBUG_NLA)
+ message(WARNING "WITH_DEBUG_NLA=ON, the build might leak sensitive information, do not use with release builds!")
+endif()
+option(WITH_DEBUG_TSG "Print Terminal Server Gateway debug messages" ${DEFAULT_DEBUG_OPTION})
+option(WITH_DEBUG_RAIL "Print RemoteApp debug messages" ${DEFAULT_DEBUG_OPTION})
+option(WITH_DEBUG_RDP "Print RDP debug messages" ${DEFAULT_DEBUG_OPTION})
+option(WITH_DEBUG_RDPEI "Print input virtual channel debug messages" ${DEFAULT_DEBUG_OPTION})
+option(WITH_DEBUG_REDIR "Redirection debug messages" ${DEFAULT_DEBUG_OPTION})
+option(WITH_DEBUG_RDPDR "Rdpdr debug messages" ${DEFAULT_DEBUG_OPTION})
+option(WITH_DEBUG_RFX "Print RemoteFX debug messages." ${DEFAULT_DEBUG_OPTION})
+option(WITH_DEBUG_SCARD "Print smartcard debug messages" ${DEFAULT_DEBUG_OPTION})
+option(WITH_DEBUG_SND "Print rdpsnd debug messages" ${DEFAULT_DEBUG_OPTION})
+option(WITH_DEBUG_SVC "Print static virtual channel debug messages." ${DEFAULT_DEBUG_OPTION})
+option(WITH_DEBUG_TRANSPORT "Print transport debug messages." ${DEFAULT_DEBUG_OPTION})
+option(WITH_DEBUG_TIMEZONE "Print timezone debug messages." ${DEFAULT_DEBUG_OPTION})
+option(WITH_DEBUG_WND "Print window order debug messages" ${DEFAULT_DEBUG_OPTION})
+option(WITH_DEBUG_X11_LOCAL_MOVESIZE "Print X11 Client local movesize debug messages" ${DEFAULT_DEBUG_OPTION})
+option(WITH_DEBUG_X11 "Print X11 Client debug messages" ${DEFAULT_DEBUG_OPTION})
+option(WITH_DEBUG_XV "Print XVideo debug messages" ${DEFAULT_DEBUG_OPTION})
+option(WITH_DEBUG_RINGBUFFER "Enable Ringbuffer debug messages" ${DEFAULT_DEBUG_OPTION})
+
+option(WITH_DEBUG_SYMBOLS "Pack debug symbols to installer" OFF)
+option(WITH_CCACHE "Use ccache support if available" ON)
+option(WITH_CLANG_FORMAT "Detect clang-format. run 'cmake --build . --target clangformat' to format." ON)
+
+option(WITH_DSP_EXPERIMENTAL "Enable experimental sound encoder/decoder formats" OFF)
+
+option(WITH_FFMPEG "Enable FFMPEG for audio/video encoding/decoding" ON)
+CMAKE_DEPENDENT_OPTION(WITH_DSP_FFMPEG "Use FFMPEG for audio encoding/decoding" ON
+ "WITH_FFMPEG" OFF)
+CMAKE_DEPENDENT_OPTION(WITH_VIDEO_FFMPEG "Use FFMPEG for video encoding/decoding" ON
+ "WITH_FFMPEG" OFF)
+CMAKE_DEPENDENT_OPTION(WITH_VAAPI "Use FFMPEG VAAPI" OFF
+ "WITH_VIDEO_FFMPEG" OFF)
+
+option(USE_VERSION_FROM_GIT_TAG "Extract FreeRDP version from git tag." ON)
+
+option(WITH_CAIRO "Use CAIRO image library for screen resizing" OFF)
+option(WITH_SWSCALE "Use SWScale image library for screen resizing" ON)
+
+if (ANDROID)
+ include(ConfigOptionsAndroid)
+endif(ANDROID)
+
+if (IOS)
+ include(ConfigOptionsiOS)
+endif(IOS)
+
+if (UNIX AND NOT APPLE)
+ find_package(ALSA)
+ find_package(PulseAudio)
+ find_package(OSS)
+ option(WITH_ALSA "use alsa for sound" ${ALSA_FOUND})
+ option(WITH_PULSE "use alsa for sound" ${PULSE_FOUND})
+ option(WITH_OSS "use alsa for sound" ${OSS_FOUND})
+endif()
+
+if (OPENBSD)
+ find_package(SNDIO)
+ option(WITH_SNDIO "use SNDIO for sound" ${SNDIO_FOUND# OpenBSD
+endif()
+
+})
+endif()
+
+option(BUILD_FUZZERS "Use BUILD_FUZZERS to build fuzzing tests" OFF)
+
+if (BUILD_FUZZERS)
+ if (NOT OSS_FUZZ)
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=fuzzer-no-link")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=fuzzer-no-link")
+ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=fuzzer-no-link")
+ endif ()
+
+ if (OSS_FUZZ AND NOT DEFINED ENV{LIB_FUZZING_ENGINE})
+ message(SEND_ERROR
+ "OSS-Fuzz builds require the environment variable "
+ "LIB_FUZZING_ENGINE to be set. If you are seeing this "
+ "warning, it points to a deeper problem in the ossfuzz "
+ "build setup.")
+ endif ()
+
+ if (CMAKE_COMPILER_IS_GNUCC)
+ message(FATAL_ERROR
+ "\n"
+ "Fuzzing is unsupported with GCC compiler. Use Clang:\n"
+ " $ CC=clang CXX=clang++ cmake . <...> -DBUILD_FUZZERS=ON && make -j\n"
+ "\n")
+ endif ()
+
+ set(BUILD_TESTING ON)
+
+ if (BUILD_SHARED_LIBS STREQUAL "OFF")
+ set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
+ set(CMAKE_CXX_FLAGS "-static ${CMAKE_CXX_FLAGS}")
+ endif()
+
+ # A special target with fuzzer and sanitizer flags.
+ add_library(fuzzer_config INTERFACE)
+
+ target_compile_options(
+ fuzzer_config
+ INTERFACE
+ $<$<NOT:$<BOOL:${OSS_FUZZ}>>:
+ -fsanitize=fuzzer
+ >
+ $<$<BOOL:${OSS_FUZZ}>:
+ ${CXX}
+ ${CXXFLAGS}
+ >
+ )
+ target_link_libraries(
+ fuzzer_config
+ INTERFACE
+ $<$<NOT:$<BOOL:${OSS_FUZZ}>>:
+ -fsanitize=fuzzer
+ >
+ $<$<BOOL:${OSS_FUZZ}>:
+ $ENV{LIB_FUZZING_ENGINE}
+ >
+ )
+endif()
diff --git a/cmake/ConfigOptionsiOS.cmake b/cmake/ConfigOptionsiOS.cmake
new file mode 100644
index 0000000..16f6267
--- /dev/null
+++ b/cmake/ConfigOptionsiOS.cmake
@@ -0,0 +1,25 @@
+# FreeRDP cmake ios options
+#
+# Copyright 2013 Thincast Technologies GmbH
+# Copyright 2013 Martin Fleisz <martin.fleisz@thincast.com>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+if (NOT FREERDP_IOS_EXTERNAL_SSL_PATH)
+ set(FREERDP_IOS_EXTERNAL_SSL_PATH "${CMAKE_CURRENT_SOURCE_DIR}/external/openssl")
+endif()
+mark_as_advanced(FREERDP_IOS_EXTERNAL_SSL_PATH)
+
+if(NOT DEFINED IOS_TARGET_SDK)
+ set(IOS_TARGET_SDK 12.0 CACHE STRING "Application target iOS SDK")
+endif()
diff --git a/cmake/ConfigureFreeRDP.cmake b/cmake/ConfigureFreeRDP.cmake
new file mode 100644
index 0000000..6fe1e54
--- /dev/null
+++ b/cmake/ConfigureFreeRDP.cmake
@@ -0,0 +1,10 @@
+if (NOT FREERDP_UNIFIED_BUILD)
+ find_package(WinPR 3 REQUIRED)
+ include_directories(${WinPR_INCLUDE_DIR})
+
+ find_package(FreeRDP 3 REQUIRED)
+ include_directories(${FreeRDP_INCLUDE_DIR})
+
+ find_package(FreeRDP-Client 3 REQUIRED)
+ include_directories(${FreeRDP-Client_INCLUDE_DIR})
+endif()
diff --git a/cmake/ConfigureRPATH.cmake b/cmake/ConfigureRPATH.cmake
new file mode 100644
index 0000000..9af2af8
--- /dev/null
+++ b/cmake/ConfigureRPATH.cmake
@@ -0,0 +1,18 @@
+# RPATH configuration
+set(CMAKE_SKIP_BUILD_RPATH FALSE)
+set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
+set(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE)
+if (APPLE)
+ file(RELATIVE_PATH FRAMEWORK_PATH ${CMAKE_INSTALL_FULL_BINDIR} ${CMAKE_INSTALL_FULL_LIBDIR})
+ set(CMAKE_INSTALL_RPATH "@loader_path/${FRAMEWORK_PATH}")
+else (APPLE)
+ if (NOT FREEBSD)
+ set(CMAKE_INSTALL_RPATH "\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}:\$ORIGIN/..")
+ option(WITH_ADD_PLUGIN_TO_RPATH "Add extension and plugin path to RPATH" OFF)
+ if (WITH_ADD_PLUGIN_TO_RPATH)
+ set(CMAKE_INSTALL_RPATH "\$ORIGIN/../${FREERDP_EXTENSION_REL_PATH}:\$ORIGIN/../${FREERDP_PLUGIN_PATH}:${CMAKE_INSTALL_RPATH}")
+ endif()
+ endif()
+endif(APPLE)
+
+
diff --git a/cmake/DetectBSD.cmake b/cmake/DetectBSD.cmake
new file mode 100644
index 0000000..5c5b3b0
--- /dev/null
+++ b/cmake/DetectBSD.cmake
@@ -0,0 +1,18 @@
+# BSD
+if(${CMAKE_SYSTEM_NAME} MATCHES "BSD")
+ set(BSD TRUE CACHE INTERNAL "BSD detection")
+ if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
+ set(FREEBSD TRUE CACHE INTERNAL "BSD detection")
+ endif()
+ if(${CMAKE_SYSTEM_NAME} MATCHES "kFreeBSD")
+ set(KFREEBSD TRUE CACHE INTERNAL "BSD detection")
+ endif()
+ if(${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD")
+ set(OPENBSD TRUE CACHE INTERNAL "BSD detection")
+ endif()
+endif()
+
+if(${CMAKE_SYSTEM_NAME} MATCHES "DragonFly")
+ set(BSD TRUE CACHE INTERNAL "BSD detection")
+ set(FREEBSD TRUE CACHE INTERNAL "BSD detection")
+endif()
diff --git a/cmake/EchoTarget.cmake b/cmake/EchoTarget.cmake
new file mode 100644
index 0000000..1275925
--- /dev/null
+++ b/cmake/EchoTarget.cmake
@@ -0,0 +1,178 @@
+function(echo_target_property tgt prop)
+ # v for value, d for defined, s for set
+ get_property(v TARGET ${tgt} PROPERTY ${prop})
+ get_property(d TARGET ${tgt} PROPERTY ${prop} DEFINED)
+ get_property(s TARGET ${tgt} PROPERTY ${prop} SET)
+
+ # only produce output for values that are set
+ if(s)
+ message("tgt='${tgt}' prop='${prop}'")
+ message(" value='${v}'")
+ message(" defined='${d}'")
+ message(" set='${s}'")
+ message("")
+ endif()
+endfunction()
+
+function(echo_target tgt)
+ if(NOT TARGET ${tgt})
+ message("There is no target named '${tgt}'")
+ return()
+ endif()
+
+ set(props
+ DEBUG_OUTPUT_NAME
+ RELEASE_OUTPUT_NAME
+ DEBUG_POSTFIX
+ RELEASE_POSTFIX
+ ARCHIVE_OUTPUT_DIRECTORY
+ ARCHIVE_OUTPUT_DIRECTORY_DEBUG
+ ARCHIVE_OUTPUT_DIRECTORY_RELEASE
+ ARCHIVE_OUTPUT_NAME
+ ARCHIVE_OUTPUT_NAME_DEBUG
+ ARCHIVE_OUTPUT_NAME_RELEASE
+ AUTOMOC
+ AUTOMOC_MOC_OPTIONS
+ BUILD_WITH_INSTALL_RPATH
+ BUNDLE
+ BUNDLE_EXTENSION
+ COMPILE_DEFINITIONS
+ COMPILE_DEFINITIONS_DEBUG
+ COMPILE_DEFINITIONS_RELEASE
+ COMPILE_FLAGS
+ DEBUG_POSTFIX
+ DEFINE_SYMBOL
+ ENABLE_EXPORTS
+ EXCLUDE_FROM_ALL
+ EchoString
+ FOLDER
+ FRAMEWORK
+ Fortran_FORMAT
+ Fortran_MODULE_DIRECTORY
+ GENERATOR_FILE_NAME
+ GNUtoMS
+ HAS_CXX
+ IMPLICIT_DEPENDS_INCLUDE_TRANSFORM
+ IMPORTED
+ IMPORTED_CONFIGURATIONS
+ IMPORTED_IMPLIB
+ IMPORTED_IMPLIB_RELEASE
+ IMPORTED_IMPLIB_RELEASE
+ IMPORTED_LINK_DEPENDENT_LIBRARIES
+ IMPORTED_LINK_DEPENDENT_LIBRARIES_DEBUG
+ IMPORTED_LINK_DEPENDENT_LIBRARIES_RELEASE
+ IMPORTED_LINK_INTERFACE_LANGUAGES
+ IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG
+ IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE
+ IMPORTED_LINK_INTERFACE_LIBRARIES
+ IMPORTED_LINK_INTERFACE_LIBRARIES_DEBUG
+ IMPORTED_LINK_INTERFACE_LIBRARIES_RELEASE
+ IMPORTED_LINK_INTERFACE_MULTIPLICITY
+ IMPORTED_LINK_INTERFACE_MULTIPLICITY_DEBUG
+ IMPORTED_LINK_INTERFACE_MULTIPLICITY_RELEASE
+ IMPORTED_LOCATION
+ IMPORTED_LOCATION_DEBUG
+ IMPORTED_LOCATION_RELEASE
+ IMPORTED_NO_SONAME
+ IMPORTED_NO_SONAME_DEBUG
+ IMPORTED_NO_SONAME_RELEASE
+ IMPORTED_SONAME
+ IMPORTED_SONAME_DEBUG
+ IMPORTED_SONAME_RELEASE
+ IMPORT_PREFIX
+ IMPORT_SUFFIX
+ INCLUDE_DIRECTORIES
+ INSTALL_NAME_DIR
+ INSTALL_RPATH
+ INSTALL_RPATH_USE_LINK_PATH
+ INTERPROCEDURAL_OPTIMIZATION
+ INTERPROCEDURAL_OPTIMIZATION_DEBUG
+ INTERPROCEDURAL_OPTIMIZATION_RELEASE
+ LABELS
+ LIBRARY_OUTPUT_DIRECTORY
+ LIBRARY_OUTPUT_DIRECTORY_DEBUG
+ LIBRARY_OUTPUT_DIRECTORY_RELEASE
+ LIBRARY_OUTPUT_NAME
+ LIBRARY_OUTPUT_NAME_DEBUG
+ LIBRARY_OUTPUT_NAME_RELEASE
+ LINKER_LANGUAGE
+ LINK_DEPENDS
+ LINK_LIBRARIES
+ LINK_FLAGS
+ LINK_FLAGS_DEBUG
+ LINK_FLAGS_RELEASE
+ LINK_INTERFACE_LIBRARIES
+ LINK_INTERFACE_LIBRARIES_DEBUG
+ LINK_INTERFACE_LIBRARIES_RELEASE
+ LINK_INTERFACE_MULTIPLICITY
+ LINK_INTERFACE_MULTIPLICITY_DEBUG
+ LINK_INTERFACE_MULTIPLICITY_RELEASE
+ LINK_SEARCH_END_STATIC
+ LINK_SEARCH_START_STATIC
+ LOCATION
+ LOCATION_DEBUG
+ LOCATION_RELEASE
+ MACOSX_BUNDLE
+ MACOSX_BUNDLE_INFO_PLIST
+ MACOSX_FRAMEWORK_INFO_PLIST
+ MAP_IMPORTED_CONFIG_DEBUG
+ MAP_IMPORTED_CONFIG_RELEASE
+ OSX_ARCHITECTURES
+ OSX_ARCHITECTURES_DEBUG
+ OSX_ARCHITECTURES_RELEASE
+ OUTPUT_NAME
+ OUTPUT_NAME_DEBUG
+ OUTPUT_NAME_RELEASE
+ POST_INSTALL_SCRIPT
+ PREFIX
+ PRE_INSTALL_SCRIPT
+ PRIVATE_HEADER
+ PROJECT_LABEL
+ PUBLIC_HEADER
+ RESOURCE
+ RULE_LAUNCH_COMPILE
+ RULE_LAUNCH_CUSTOM
+ RULE_LAUNCH_LINK
+ RUNTIME_OUTPUT_DIRECTORY
+ RUNTIME_OUTPUT_DIRECTORY_DEBUG
+ RUNTIME_OUTPUT_DIRECTORY_RELEASE
+ RUNTIME_OUTPUT_NAME
+ RUNTIME_OUTPUT_NAME_DEBUG
+ RUNTIME_OUTPUT_NAME_RELEASE
+ SKIP_BUILD_RPATH
+ SOURCES
+ SOVERSION
+ STATIC_LIBRARY_FLAGS
+ STATIC_LIBRARY_FLAGS_DEBUG
+ STATIC_LIBRARY_FLAGS_RELEASE
+ SUFFIX
+ TYPE
+ VERSION
+ VS_DOTNET_REFERENCES
+ VS_GLOBAL_KEYWORD
+ VS_GLOBAL_PROJECT_TYPES
+ VS_KEYWORD
+ VS_SCC_AUXPATH
+ VS_SCC_LOCALPATH
+ VS_SCC_PROJECTNAME
+ VS_SCC_PROVIDER
+ VS_WINRT_EXTENSIONS
+ VS_WINRT_REFERENCES
+ WIN32_EXECUTABLE
+ )
+
+ message("======================== ${tgt} ========================")
+ foreach(p ${props})
+ echo_target_property("${tgt}" "${p}")
+ endforeach()
+ message("")
+
+endfunction()
+
+function(echo_targets)
+ set(tgts ${ARGV})
+ foreach(t ${tgts})
+ echo_target("${t}")
+ endforeach()
+endfunction()
+
diff --git a/cmake/FindCairo.cmake b/cmake/FindCairo.cmake
new file mode 100644
index 0000000..c5146f7
--- /dev/null
+++ b/cmake/FindCairo.cmake
@@ -0,0 +1,166 @@
+# - Try to find the CAIRO library
+# Once done this will define
+#
+# CAIRO_ROOT_DIR - Set this variable to the root installation of CAIRO
+#
+# Read-Only variables:
+# CAIRO_FOUND - system has the CAIRO library
+# CAIRO_INCLUDE_DIR - the CAIRO include directory
+# CAIRO_LIBRARIES - The libraries needed to use CAIRO
+# CAIRO_VERSION - This is set to $major.$minor.$revision (eg. 0.9.8)
+
+#=============================================================================
+# Copyright 2012 Dmitry Baryshnikov <polimax at mail dot ru>
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+find_package(PkgConfig)
+
+if(PKG_CONFIG_FOUND)
+ pkg_check_modules(_CAIRO cairo)
+endif (PKG_CONFIG_FOUND)
+
+SET(_CAIRO_ROOT_HINTS
+ $ENV{CAIRO}
+ ${CAIRO_ROOT_DIR}
+ )
+SET(_CAIRO_ROOT_PATHS
+ $ENV{CAIRO}/src
+ /usr
+ /usr/local
+ )
+SET(_CAIRO_ROOT_HINTS_AND_PATHS
+ HINTS ${_CAIRO_ROOT_HINTS}
+ PATHS ${_CAIRO_ROOT_PATHS}
+ )
+
+FIND_PATH(CAIRO_INCLUDE_DIR
+ NAMES
+ cairo.h
+ HINTS
+ ${_CAIRO_INCLUDEDIR}
+ ${_CAIRO_ROOT_HINTS_AND_PATHS}
+ PATH_SUFFIXES
+ include
+ "include/cairo"
+)
+
+IF(NOT PKGCONFIG_FOUND AND WIN32 AND NOT CYGWIN)
+ # MINGW should go here too
+ IF(MSVC)
+ # Implementation details:
+ # We are using the libraries located in the VC subdir instead of the parent directory eventhough :
+ FIND_LIBRARY(CAIRO_DEBUG
+ NAMES
+ cairod
+ ${_CAIRO_ROOT_HINTS_AND_PATHS}
+ PATH_SUFFIXES
+ "lib"
+ "VC"
+ "lib/VC"
+ )
+
+ FIND_LIBRARY(CAIRO_RELEASE
+ NAMES
+ cairo
+ ${_CAIRO_ROOT_HINTS_AND_PATHS}
+ PATH_SUFFIXES
+ "lib"
+ "VC"
+ "lib/VC"
+ )
+
+ if( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE )
+ if(NOT CAIRO_DEBUG)
+ set(CAIRO_DEBUG ${CAIRO_RELEASE})
+ endif(NOT CAIRO_DEBUG)
+ set( CAIRO_LIBRARIES
+ optimized ${CAIRO_RELEASE} debug ${CAIRO_DEBUG}
+ )
+ else()
+ set( CAIRO_LIBRARIES ${CAIRO_RELEASE})
+ endif()
+ MARK_AS_ADVANCED(CAIRO_DEBUG CAIRO_RELEASE)
+ ELSEIF(MINGW)
+ # same player, for MingW
+ FIND_LIBRARY(CAIRO
+ NAMES
+ cairo
+ ${_CAIRO_ROOT_HINTS_AND_PATHS}
+ PATH_SUFFIXES
+ "lib"
+ "lib/MinGW"
+ )
+
+ MARK_AS_ADVANCED(CAIRO)
+ set( CAIRO_LIBRARIES ${CAIRO})
+ ELSE(MSVC)
+ # Not sure what to pick for -say- intel, let's use the toplevel ones and hope someone report issues:
+ FIND_LIBRARY(CAIRO
+ NAMES
+ cairo
+ HINTS
+ ${_CAIRO_LIBDIR}
+ ${_CAIRO_ROOT_HINTS_AND_PATHS}
+ PATH_SUFFIXES
+ lib
+ )
+
+ MARK_AS_ADVANCED(CAIRO)
+ set( CAIRO_LIBRARIES ${CAIRO} )
+ ENDIF(MSVC)
+ELSE()
+
+ FIND_LIBRARY(CAIRO_LIBRARY
+ NAMES
+ cairo
+ HINTS
+ ${_CAIRO_LIBDIR}
+ ${_CAIRO_ROOT_HINTS_AND_PATHS}
+ PATH_SUFFIXES
+ "lib"
+ "local/lib"
+ )
+
+ MARK_AS_ADVANCED(CAIRO_LIBRARY)
+
+ # compat defines
+ SET(CAIRO_LIBRARIES ${CAIRO_LIBRARY})
+
+ENDIF()
+
+#message( STATUS "Cairo_FIND_VERSION=${Cairo_FIND_VERSION}.")
+#message( STATUS "CAIRO_INCLUDE_DIR=${CAIRO_INCLUDE_DIR}.")
+
+# Fetch version from cairo-version.h if a version was requested by find_package()
+if(CAIRO_INCLUDE_DIR AND Cairo_FIND_VERSION)
+ file(READ "${CAIRO_INCLUDE_DIR}/cairo-version.h" _CAIRO_VERSION_H_CONTENTS)
+ string(REGEX REPLACE "^(.*\n)?#define[ \t]+CAIRO_VERSION_MAJOR[ \t]+([0-9]+).*"
+ "\\2" CAIRO_VERSION_MAJOR ${_CAIRO_VERSION_H_CONTENTS})
+ string(REGEX REPLACE "^(.*\n)?#define[ \t]+CAIRO_VERSION_MINOR[ \t]+([0-9]+).*"
+ "\\2" CAIRO_VERSION_MINOR ${_CAIRO_VERSION_H_CONTENTS})
+ string(REGEX REPLACE "^(.*\n)?#define[ \t]+CAIRO_VERSION_MICRO[ \t]+([0-9]+).*"
+ "\\2" CAIRO_VERSION_MICRO ${_CAIRO_VERSION_H_CONTENTS})
+ set(CAIRO_VERSION ${CAIRO_VERSION_MAJOR}.${CAIRO_VERSION_MINOR}.${CAIRO_VERSION_MICRO}
+ CACHE INTERNAL "The version number for Cairo libraries")
+endif()
+
+include(FindPackageHandleStandardArgs)
+
+find_package_handle_standard_args(Cairo
+ REQUIRED_VARS
+ CAIRO_LIBRARIES
+ CAIRO_INCLUDE_DIR
+ VERSION_VAR
+ CAIRO_VERSION
+)
+
+MARK_AS_ADVANCED(CAIRO_INCLUDE_DIR CAIRO_LIBRARIES)
diff --git a/cmake/FindDocBookXSL.cmake b/cmake/FindDocBookXSL.cmake
new file mode 100644
index 0000000..fb905d6
--- /dev/null
+++ b/cmake/FindDocBookXSL.cmake
@@ -0,0 +1,52 @@
+# Try to find DocBook XSL stylesheet
+# Once done, it will define:
+#
+# DOCBOOKXSL_FOUND - system has the required DocBook XML DTDs
+# DOCBOOKXSL_DIR - the directory containing the stylesheets
+# used to process DocBook XML
+
+# Copyright (c) 2010, Luigi Toscano, <luigi.toscano@tiscali.it>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+set (STYLESHEET_PATH_LIST
+ share/xml/docbook/stylesheet/docbook-xsl
+ share/xml/docbook/xsl-stylesheets
+ share/sgml/docbook/xsl-stylesheets
+ share/xml/docbook/stylesheet/nwalsh/current
+ share/xml/docbook/stylesheet/nwalsh
+ share/xsl/docbook
+ share/xsl/docbook-xsl
+)
+
+find_path (DOCBOOKXSL_DIR lib/lib.xsl
+ PATHS ${CMAKE_SYSTEM_PREFIX_PATH}
+ PATH_SUFFIXES ${STYLESHEET_PATH_LIST}
+)
+
+if (NOT DOCBOOKXSL_DIR)
+ # hacks for systems that put the version in the stylesheet dirs
+ set (STYLESHEET_PATH_LIST)
+ foreach (STYLESHEET_PREFIX_ITER ${CMAKE_SYSTEM_PREFIX_PATH})
+ file(GLOB STYLESHEET_SUFFIX_ITER RELATIVE ${STYLESHEET_PREFIX_ITER}
+ ${STYLESHEET_PREFIX_ITER}/share/xml/docbook/xsl-stylesheets-*-nons
+ )
+ if (STYLESHEET_SUFFIX_ITER)
+ list (APPEND STYLESHEET_PATH_LIST ${STYLESHEET_SUFFIX_ITER})
+ endif ()
+ endforeach ()
+
+ find_path (DOCBOOKXSL_DIR VERSION
+ PATHS ${CMAKE_SYSTEM_PREFIX_PATH}
+ PATH_SUFFIXES ${STYLESHEET_PATH_LIST}
+ )
+endif (NOT DOCBOOKXSL_DIR)
+
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args (DocBookXSL
+ "Could NOT find DocBook XSL stylesheets"
+ DOCBOOKXSL_DIR)
+
+mark_as_advanced (DOCBOOKXSL_DIR)
diff --git a/cmake/FindFAAC.cmake b/cmake/FindFAAC.cmake
new file mode 100644
index 0000000..61e0d27
--- /dev/null
+++ b/cmake/FindFAAC.cmake
@@ -0,0 +1,13 @@
+
+find_path(FAAC_INCLUDE_DIR faac.h)
+
+find_library(FAAC_LIBRARY faac)
+
+find_package_handle_standard_args(FAAC DEFAULT_MSG FAAC_INCLUDE_DIR FAAC_LIBRARY)
+
+if(FAAC_FOUND)
+ set(FAAC_LIBRARIES ${FAAC_LIBRARY})
+ set(FAAC_INCLUDE_DIRS ${FAAC_INCLUDE_DIR})
+endif()
+
+mark_as_advanced(FAAC_INCLUDE_DIR FAAC_LIBRARY)
diff --git a/cmake/FindFAAD2.cmake b/cmake/FindFAAD2.cmake
new file mode 100644
index 0000000..d9387de
--- /dev/null
+++ b/cmake/FindFAAD2.cmake
@@ -0,0 +1,13 @@
+
+find_path(FAAD2_INCLUDE_DIR faad.h)
+
+find_library(FAAD2_LIBRARY faad)
+
+find_package_handle_standard_args(FAAD2 DEFAULT_MSG FAAD2_INCLUDE_DIR FAAD2_LIBRARY)
+
+if(FAAD2_FOUND)
+ set(FAAD2_LIBRARIES ${FAAD2_LIBRARY})
+ set(FAAD2_INCLUDE_DIRS ${FAAD2_INCLUDE_DIR})
+endif()
+
+mark_as_advanced(FAAD2_INCLUDE_DIR FAAD2_LIBRARY)
diff --git a/cmake/FindFFmpeg.cmake b/cmake/FindFFmpeg.cmake
new file mode 100644
index 0000000..ef65af4
--- /dev/null
+++ b/cmake/FindFFmpeg.cmake
@@ -0,0 +1,78 @@
+# - Try to find FFmpeg
+# Using Pkg-config if available for path
+#
+# FFMPEG_FOUND - all required ffmpeg components found on system
+# FFMPEG_INCLUDE_DIRS - combined include directories
+# FFMPEG_LIBRARIES - combined libraries to link
+
+set(REQUIRED_AVCODEC_VERSION 0.8)
+set(REQUIRED_AVCODEC_API_VERSION 53.25.0)
+
+find_package(PkgConfig)
+
+if (PKG_CONFIG_FOUND)
+ pkg_check_modules(AVCODEC libavcodec)
+ pkg_check_modules(AVUTIL libavutil)
+ pkg_check_modules(AVRESAMPLE libavresample)
+ pkg_check_modules(SWRESAMPLE libswresample)
+endif(PKG_CONFIG_FOUND)
+
+# avcodec
+find_path(AVCODEC_INCLUDE_DIR libavcodec/avcodec.h PATHS ${AVCODEC_INCLUDE_DIRS})
+find_library(AVCODEC_LIBRARY avcodec PATHS ${AVCODEC_LIBRARY_DIRS})
+
+# avutil
+find_path(AVUTIL_INCLUDE_DIR libavutil/avutil.h PATHS ${AVUTIL_INCLUDE_DIRS})
+find_library(AVUTIL_LIBRARY avutil PATHS ${AVUTIL_LIBRARY_DIRS})
+
+# swresample
+find_path(SWRESAMPLE_INCLUDE_DIR libswresample/swresample.h PATHS ${SWRESAMPLE_INCLUDE_DIRS})
+find_library(SWRESAMPLE_LIBRARY NAMES swresample swresample-3 PATHS ${SWRESAMPLE_LIBRARY_DIRS})
+
+if (SWRESAMPLE_INCLUDE_DIR AND SWRESAMPLE_LIBRARY)
+ set(SWRESAMPLE_FOUND ON)
+endif()
+
+# avresample
+find_path(AVRESAMPLE_INCLUDE_DIR libavresample/avresample.h PATHS ${AVRESAMPLE_INCLUDE_DIRS})
+find_library(AVRESAMPLE_LIBRARY avresample PATHS ${AVRESAMPLE_LIBRARY_DIRS})
+
+if (AVRESAMPLE_INCLUDE_DIR AND AVRESAMPLE_LIBRARY)
+ set(AVRESAMPLE_FOUND ON)
+endif()
+
+if (AVCODEC_INCLUDE_DIR AND AVCODEC_LIBRARY)
+ set(AVCODEC_FOUND TRUE)
+endif(AVCODEC_INCLUDE_DIR AND AVCODEC_LIBRARY)
+
+if (AVUTIL_INCLUDE_DIR AND AVUTIL_LIBRARY)
+ set(AVUTIL_FOUND TRUE)
+endif(AVUTIL_INCLUDE_DIR AND AVUTIL_LIBRARY)
+
+include(FindPackageHandleStandardArgs)
+if (SWRESAMPLE_FOUND)
+ FIND_PACKAGE_HANDLE_STANDARD_ARGS(FFmpeg DEFAULT_MSG AVUTIL_FOUND AVCODEC_FOUND SWRESAMPLE_FOUND)
+else()
+ FIND_PACKAGE_HANDLE_STANDARD_ARGS(FFmpeg DEFAULT_MSG AVUTIL_FOUND AVCODEC_FOUND AVRESAMPLE_FOUND)
+endif()
+
+if (AVCODEC_VERSION)
+ if (${AVCODEC_VERSION} VERSION_LESS ${REQUIRED_AVCODEC_API_VERSION})
+ message(FATAL_ERROR
+ "libavcodec version >= ${REQUIRED_AVCODEC_VERSION} (API >= ${REQUIRED_AVCODEC_API_VERSION}) is required")
+ endif()
+else(AVCODEC_VERSION)
+ message("Note: To build libavcodec version >= ${REQUIRED_AVCODEC_VERSION} (API >= ${REQUIRED_AVCODEC_API_VERSION}) is required")
+endif(AVCODEC_VERSION)
+
+if (FFMPEG_FOUND)
+ if (SWRESAMPLE_FOUND)
+ set(FFMPEG_INCLUDE_DIRS ${AVCODEC_INCLUDE_DIR} ${AVUTIL_INCLUDE_DIR} ${SWRESAMPLE_INCLUDE_DIR})
+ set(FFMPEG_LIBRARIES ${AVCODEC_LIBRARY} ${AVUTIL_LIBRARY} ${SWRESAMPLE_LIBRARY})
+ elseif (AVRESAMPLE_FOUND)
+ set(FFMPEG_INCLUDE_DIRS ${AVCODEC_INCLUDE_DIR} ${AVUTIL_INCLUDE_DIR} ${AVRESAMPLE_INCLUDE_DIR})
+ set(FFMPEG_LIBRARIES ${AVCODEC_LIBRARY} ${AVUTIL_LIBRARY} ${AVRESAMPLE_LIBRARY})
+ endif()
+endif(FFMPEG_FOUND)
+
+mark_as_advanced(FFMPEG_INCLUDE_DIRS FFMPEG_LIBRARIES)
diff --git a/cmake/FindFeature.cmake b/cmake/FindFeature.cmake
new file mode 100644
index 0000000..63c4b6f
--- /dev/null
+++ b/cmake/FindFeature.cmake
@@ -0,0 +1,64 @@
+include(FeatureSummary)
+
+# types: DISABLED < RUNTIME < OPTIONAL < RECOMMENDED < REQUIRED
+
+macro(find_feature _feature _type _purpose _description)
+
+ string(TOUPPER ${_feature} _feature_upper)
+ string(TOLOWER ${_type} _type_lower)
+
+ if(${_type} STREQUAL "DISABLED")
+ set(_feature_default "OFF")
+ message(STATUS "Skipping ${_type_lower} feature ${_feature} for ${_purpose} (${_description})")
+ else()
+ if(${_type} STREQUAL "REQUIRED")
+ set(_feature_default "ON")
+ message(STATUS "Finding ${_type_lower} feature ${_feature} for ${_purpose} (${_description})")
+ find_package(${_feature} REQUIRED)
+ elseif(${_type} STREQUAL "RECOMMENDED")
+ if(NOT ${WITH_${_feature_upper}})
+ set(_feature_default "OFF")
+ message(STATUS "Skipping ${_type_lower} feature ${_feature} for ${_purpose} (${_description})")
+ else()
+ set(_feature_default "ON")
+ message(STATUS "Finding ${_type_lower} feature ${_feature} for ${_purpose} (${_description})")
+ message(STATUS " Disable feature ${_feature} using \"-DWITH_${_feature_upper}=OFF\"")
+ find_package(${_feature})
+ if (NOT ${_feature}_FOUND)
+ set(_feature_default "OFF")
+ message(STATUS "Not detected ${_type_lower} feature ${_feature} for ${_purpose} (${_description}), feature disabled")
+ endif()
+ endif()
+ elseif(${_type} STREQUAL "OPTIONAL")
+ if(${WITH_${_feature_upper}})
+ set(_feature_default "ON")
+ message(STATUS "Finding ${_type_lower} feature ${_feature} for ${_purpose} (${_description})")
+ find_package(${_feature} REQUIRED)
+ else()
+ set(_feature_default "OFF")
+ message(STATUS "Skipping ${_type_lower} feature ${_feature} for ${_purpose} (${_description})")
+ message(STATUS " Enable feature ${_feature} using \"-DWITH_${_feature_upper}=ON\"")
+ endif()
+ else()
+ set(_feature_default "ON")
+ message(STATUS "Finding ${_type_lower} feature ${_feature} for ${_purpose} (${_description})")
+ find_package(${_feature})
+ endif()
+
+
+ if(NOT ${${_feature}_FOUND})
+ if(${_feature_default})
+ message(WARNING " feature ${_feature} was requested but could not be found! ${_feature_default} / ${${_feature}_FOUND}")
+ endif()
+ set(_feature_default "OFF")
+ endif()
+
+ option(WITH_${_feature_upper} "Enable feature ${_feature} for ${_purpose}" ${_feature_default})
+
+ set_package_properties(${_feature} PROPERTIES
+ TYPE ${_type}
+ PURPOSE "${_purpose}"
+ DESCRIPTION "${_description}")
+ endif()
+endmacro(find_feature)
+
diff --git a/cmake/FindGSM.cmake b/cmake/FindGSM.cmake
new file mode 100644
index 0000000..366fd67
--- /dev/null
+++ b/cmake/FindGSM.cmake
@@ -0,0 +1,13 @@
+
+find_path(GSM_INCLUDE_DIR gsm/gsm.h)
+
+find_library(GSM_LIBRARY gsm)
+
+find_package_handle_standard_args(GSM DEFAULT_MSG GSM_INCLUDE_DIR GSM_LIBRARY)
+
+if(GSM_FOUND)
+ set(GSM_LIBRARIES ${GSM_LIBRARY})
+ set(GSM_INCLUDE_DIRS ${GSM_INCLUDE_DIR})
+endif()
+
+mark_as_advanced(GSM_INCLUDE_DIR GSM_LIBRARY)
diff --git a/cmake/FindIPP.cmake b/cmake/FindIPP.cmake
new file mode 100644
index 0000000..1e06762
--- /dev/null
+++ b/cmake/FindIPP.cmake
@@ -0,0 +1,397 @@
+# This cmake script is taken from the OpenCV project (BSD license)
+
+#
+# The script to detect Intel(R) Integrated Performance Primitives (IPP)
+# installation/package
+#
+# This will try to find Intel IPP libraries, and include path by automatic
+# search through typical install locations and if failed it will
+# examine IPPROOT environment variable.
+# Note, IPPROOT is not set by IPP installer, it should be set manually.
+#
+# On return this will define:
+#
+# IPP_FOUND - True if Intel IPP found
+# IPP_ROOT_DIR - root of IPP installation
+# IPP_INCLUDE_DIRS - IPP include folder
+# IPP_LIBRARY_DIRS - IPP libraries folder
+# IPP_LIBRARIES - IPP libraries names that are used by OpenCV
+# IPP_LATEST_VERSION_STR - string with the newest detected IPP version
+# IPP_LATEST_VERSION_MAJOR - numbers of IPP version (MAJOR.MINOR.BUILD)
+# IPP_LATEST_VERSION_MINOR
+# IPP_LATEST_VERSION_BUILD
+#
+# Created: 30 Dec 2010 by Vladimir Dudnik (vladimir.dudnik@intel.com)
+#
+
+set(IPP_FOUND)
+set(IPP_VERSION_STR "5.3.0.0") # will not detect earlier versions
+set(IPP_VERSION_MAJOR 0)
+set(IPP_VERSION_MINOR 0)
+set(IPP_VERSION_BUILD 0)
+set(IPP_ROOT_DIR)
+set(IPP_INCLUDE_DIRS)
+set(IPP_LIBRARY_DIRS)
+set(IPP_LIBRARIES)
+set(IPP_LIB_PREFIX ${CMAKE_STATIC_LIBRARY_PREFIX})
+set(IPP_LIB_SUFFIX ${CMAKE_STATIC_LIBRARY_SUFFIX})
+set(IPP_PREFIX "ipp")
+set(IPP_SUFFIX "_l")
+set(IPPCORE "core") # core functionality
+set(IPPS "s") # signal processing
+set(IPPI "i") # image processing
+set(IPPCC "cc") # color conversion
+set(IPPCV "cv") # computer vision
+set(IPPVM "vm") # vector math
+
+
+set(IPP_X64 0)
+if (CMAKE_SIZEOF_VOID_P EQUAL 8)
+ set(IPP_X64 1)
+endif()
+if (CMAKE_CL_64)
+ set(IPP_X64 1)
+endif()
+
+# ------------------------------------------------------------------------
+# This function detect IPP version by analyzing ippversion.h file
+# Note, ippversion.h file was inroduced since IPP 5.3
+# ------------------------------------------------------------------------
+function(get_ipp_version _ROOT_DIR)
+ set(_VERSION_STR)
+ set(_MAJOR)
+ set(_MINOR)
+ set(_BUILD)
+
+ # read IPP version info from file
+ file(STRINGS ${_ROOT_DIR}/include/ippversion.h STR1 REGEX "IPP_VERSION_MAJOR")
+ file(STRINGS ${_ROOT_DIR}/include/ippversion.h STR2 REGEX "IPP_VERSION_MINOR")
+ file(STRINGS ${_ROOT_DIR}/include/ippversion.h STR3 REGEX "IPP_VERSION_BUILD")
+
+ if(NOT STR3)
+ file(STRINGS ${_ROOT_DIR}/include/ippversion.h STR3 REGEX "IPP_VERSION_UPDATE")
+ endif()
+
+ file(STRINGS ${_ROOT_DIR}/include/ippversion.h STR4 REGEX "IPP_VERSION_STR")
+
+ # extract info and assign to variables
+ string(REGEX MATCHALL "[0-9]+" _MAJOR ${STR1})
+ string(REGEX MATCHALL "[0-9]+" _MINOR ${STR2})
+ string(REGEX MATCHALL "[0-9]+" _BUILD ${STR3})
+ string(REGEX MATCHALL "[0-9]+[.]+[0-9]+[^\"]+|[0-9]+[.]+[0-9]+" _VERSION_STR ${STR4})
+
+ # export info to parent scope
+ set(IPP_VERSION_STR ${_VERSION_STR} PARENT_SCOPE)
+ set(IPP_VERSION_MAJOR ${_MAJOR} PARENT_SCOPE)
+ set(IPP_VERSION_MINOR ${_MINOR} PARENT_SCOPE)
+ set(IPP_VERSION_BUILD ${_BUILD} PARENT_SCOPE)
+
+ message(STATUS "found IPP: ${_MAJOR}.${_MINOR}.${_BUILD} [${_VERSION_STR}]")
+ message(STATUS "at: ${_ROOT_DIR}")
+
+ return()
+
+endfunction()
+
+
+# ------------------------------------------------------------------------
+# This is auxiliary function called from set_ipp_variables()
+# to set IPP_LIBRARIES variable in IPP 6.x style (IPP 5.3 should also work)
+# ------------------------------------------------------------------------
+function(set_ipp_old_libraries)
+ set(IPP_PREFIX "ipp")
+ set(IPP_SUFFIX) # old style static core libs suffix
+ set(IPP_ARCH) # architecture suffix
+ set(IPP_DISP "emerged") # old style dipatcher and cpu-specific
+ set(IPP_MRGD "merged") # static libraries
+ set(IPPCORE "core") # core functionality
+ set(IPPSP "s") # signal processing
+ set(IPPIP "i") # image processing
+ set(IPPCC "cc") # color conversion
+ set(IPPCV "cv") # computer vision
+ set(IPPVM "vm") # vector math
+
+ if (IPP_X64)
+ set(IPP_ARCH "em64t")
+ endif()
+
+ if(WIN32)
+ set(IPP_SUFFIX "l")
+ endif()
+
+ set(IPP_LIBRARIES
+ ${IPP_LIB_PREFIX}${IPP_PREFIX}${IPPVM}${IPP_MRGD}${IPP_ARCH}${IPP_LIB_SUFFIX}
+ ${IPP_LIB_PREFIX}${IPP_PREFIX}${IPPVM}${IPP_DISP}${IPP_ARCH}${IPP_LIB_SUFFIX}
+ ${IPP_LIB_PREFIX}${IPP_PREFIX}${IPPCC}${IPP_MRGD}${IPP_ARCH}${IPP_LIB_SUFFIX}
+ ${IPP_LIB_PREFIX}${IPP_PREFIX}${IPPCC}${IPP_DISP}${IPP_ARCH}${IPP_LIB_SUFFIX}
+ ${IPP_LIB_PREFIX}${IPP_PREFIX}${IPPCV}${IPP_MRGD}${IPP_ARCH}${IPP_LIB_SUFFIX}
+ ${IPP_LIB_PREFIX}${IPP_PREFIX}${IPPCV}${IPP_DISP}${IPP_ARCH}${IPP_LIB_SUFFIX}
+ ${IPP_LIB_PREFIX}${IPP_PREFIX}${IPPIP}${IPP_MRGD}${IPP_ARCH}${IPP_LIB_SUFFIX}
+ ${IPP_LIB_PREFIX}${IPP_PREFIX}${IPPIP}${IPP_DISP}${IPP_ARCH}${IPP_LIB_SUFFIX}
+ ${IPP_LIB_PREFIX}${IPP_PREFIX}${IPPSP}${IPP_MRGD}${IPP_ARCH}${IPP_LIB_SUFFIX}
+ ${IPP_LIB_PREFIX}${IPP_PREFIX}${IPPSP}${IPP_DISP}${IPP_ARCH}${IPP_LIB_SUFFIX}
+ ${IPP_LIB_PREFIX}${IPP_PREFIX}${IPPCORE}${IPP_ARCH}${IPP_SUFFIX}${IPP_LIB_SUFFIX}
+ PARENT_SCOPE)
+
+ return()
+
+endfunction()
+
+
+# ------------------------------------------------------------------------
+# This is auxiliary function called from set_ipp_variables()
+# to set IPP_LIBRARIES variable in IPP 7.x style
+# ------------------------------------------------------------------------
+function(set_ipp_new_libraries)
+ set(IPP_PREFIX "ipp")
+ set(IPP_SUFFIX "_l") # static not threaded libs suffix
+ set(IPP_THRD "_t") # static threaded libs suffix
+ set(IPPCORE "core") # core functionality
+ set(IPPSP "s") # signal processing
+ set(IPPIP "i") # image processing
+ set(IPPCC "cc") # color conversion
+ set(IPPCV "cv") # computer vision
+ set(IPPVM "vm") # vector math
+
+ set(IPP_LIBRARIES
+ ${IPP_LIB_PREFIX}${IPP_PREFIX}${IPPVM}${IPP_SUFFIX}${IPP_LIB_SUFFIX}
+ ${IPP_LIB_PREFIX}${IPP_PREFIX}${IPPCC}${IPP_SUFFIX}${IPP_LIB_SUFFIX}
+ ${IPP_LIB_PREFIX}${IPP_PREFIX}${IPPCV}${IPP_SUFFIX}${IPP_LIB_SUFFIX}
+ ${IPP_LIB_PREFIX}${IPP_PREFIX}${IPPI}${IPP_SUFFIX}${IPP_LIB_SUFFIX}
+ ${IPP_LIB_PREFIX}${IPP_PREFIX}${IPPS}${IPP_SUFFIX}${IPP_LIB_SUFFIX}
+ ${IPP_LIB_PREFIX}${IPP_PREFIX}${IPPCORE}${IPP_SUFFIX}${IPP_LIB_SUFFIX}
+ PARENT_SCOPE)
+
+ return()
+
+endfunction()
+
+
+# ------------------------------------------------------------------------
+# This function will set
+# IPP_INCLUDE_DIRS, IPP_LIBRARY_DIRS and IPP_LIBRARIES variables depending
+# on IPP version parameter.
+# Since IPP 7.0 version library names and install folder structure
+# was changed
+# ------------------------------------------------------------------------
+function(set_ipp_variables _LATEST_VERSION)
+ if(${_LATEST_VERSION} VERSION_LESS "7.0")
+# message(STATUS "old")
+
+ # set INCLUDE and LIB folders
+ set(IPP_INCLUDE_DIRS ${IPP_ROOT_DIR}/include PARENT_SCOPE)
+ set(IPP_LIBRARY_DIRS ${IPP_ROOT_DIR}/lib PARENT_SCOPE)
+
+ if (IPP_X64)
+ if(NOT EXISTS ${IPP_ROOT_DIR}/../em64t)
+ message(SEND_ERROR "IPP EM64T libraries not found")
+ endif()
+ else()
+ if(NOT EXISTS ${IPP_ROOT_DIR}/../ia32)
+ message(SEND_ERROR "IPP IA32 libraries not found")
+ endif()
+ endif()
+
+ # set IPP_LIBRARIES variable (6.x lib names)
+ set_ipp_old_libraries()
+ set(IPP_LIBRARIES ${IPP_LIBRARIES} PARENT_SCOPE)
+ message(STATUS "IPP libs: ${IPP_LIBRARIES}")
+
+ else()
+# message(STATUS "new")
+
+ # set INCLUDE and LIB folders
+ set(IPP_INCLUDE_DIRS ${IPP_ROOT_DIR}/include PARENT_SCOPE)
+
+ if(APPLE)
+ set(IPP_LIBRARY_DIRS ${IPP_ROOT_DIR}/lib PARENT_SCOPE)
+ else()
+ if(IPP_X64)
+ if(NOT EXISTS ${IPP_ROOT_DIR}/lib/intel64)
+ message(SEND_ERROR "IPP EM64T libraries not found")
+ endif()
+ set(IPP_LIBRARY_DIRS ${IPP_ROOT_DIR}/lib/intel64 PARENT_SCOPE)
+ else()
+ if(NOT EXISTS ${IPP_ROOT_DIR}/lib/ia32)
+ message(SEND_ERROR "IPP IA32 libraries not found")
+ endif()
+ set(IPP_LIBRARY_DIRS ${IPP_ROOT_DIR}/lib/ia32 PARENT_SCOPE)
+ endif()
+ endif()
+
+ # set IPP_LIBRARIES variable (7.x lib names)
+ set_ipp_new_libraries()
+ set(IPP_LIBRARIES ${IPP_LIBRARIES} PARENT_SCOPE)
+ message(STATUS "IPP libs: ${IPP_LIBRARIES}")
+
+ endif()
+
+ return()
+
+endfunction()
+
+
+# ------------------------------------------------------------------------
+# This section will look for IPP through IPPROOT env variable
+# Note, IPPROOT is not set by IPP installer, you may need to set it manually
+# ------------------------------------------------------------------------
+find_path(
+ IPP_H_PATH
+ NAMES ippversion.h
+ PATHS $ENV{IPPROOT}
+ PATH_SUFFIXES include
+ DOC "The path to Intel(R) IPP header files"
+ NO_DEFAULT_PATH
+ NO_CMAKE_PATH)
+
+if(IPP_H_PATH)
+ set(IPP_FOUND 1)
+
+ # traverse up to IPPROOT level
+ get_filename_component(IPP_ROOT_DIR ${IPP_H_PATH} PATH)
+
+ # extract IPP version info
+ get_ipp_version(${IPP_ROOT_DIR})
+
+ # keep info in the same vars for auto search and search by IPPROOT
+ set(IPP_LATEST_VERSION_STR ${IPP_VERSION_STR})
+ set(IPP_LATEST_VERSION_MAJOR ${IPP_VERSION_MAJOR})
+ set(IPP_LATEST_VERSION_MINOR ${IPP_VERSION_MINOR})
+ set(IPP_LATEST_VERSION_BUILD ${IPP_VERSION_BUILD})
+
+ # set IPP INCLUDE, LIB dirs and library names
+ set_ipp_variables(${IPP_LATEST_VERSION_STR})
+endif()
+
+
+if(NOT IPP_FOUND)
+ # reset var from previous search
+ set(IPP_H_PATH)
+
+
+ # ------------------------------------------------------------------------
+ # This section will look for IPP through system program folders
+ # Note, if several IPP installations found the newest version will be
+ # selected
+ # ------------------------------------------------------------------------
+ foreach(curdir ${CMAKE_SYSTEM_PREFIX_PATH} /opt)
+ set(curdir ${curdir}/intel)
+ file(TO_CMAKE_PATH ${curdir} CURDIR)
+
+ if(EXISTS ${curdir})
+ file(GLOB_RECURSE IPP_H_DIR ${curdir}/ippversion.h)
+
+ if(IPP_H_DIR)
+ set(IPP_FOUND 1)
+ endif()
+
+ # init IPP_LATEST_VERSION version with oldest detectable version (5.3.0.0)
+ # IPP prior 5.3 did not have ippversion.h file
+ set(IPP_LATEST_VERSION_STR ${IPP_VERSION_STR})
+
+ # look through all dirs where ippversion.h was found
+ foreach(item ${IPP_H_DIR})
+
+ # traverse up to IPPROOT level
+ get_filename_component(_FILE_PATH ${item} PATH)
+ get_filename_component(_ROOT_DIR ${_FILE_PATH} PATH)
+
+ # extract IPP version info
+ get_ipp_version(${_ROOT_DIR})
+
+ # remember the latest version (if many found)
+ if(${IPP_LATEST_VERSION_STR} VERSION_LESS ${IPP_VERSION_STR})
+ set(IPP_LATEST_VERSION_STR ${IPP_VERSION_STR})
+ set(IPP_LATEST_VERSION_MAJOR ${IPP_VERSION_MAJOR})
+ set(IPP_LATEST_VERSION_MINOR ${IPP_VERSION_MINOR})
+ set(IPP_LATEST_VERSION_BUILD ${IPP_VERSION_BUILD})
+ set(IPP_ROOT_DIR ${_ROOT_DIR})
+ endif()
+ endforeach()
+ endif()
+ endforeach()
+endif()
+
+if(IPP_FOUND)
+ # set IPP INCLUDE, LIB dirs and library names
+ set_ipp_variables(${IPP_LATEST_VERSION_STR})
+
+ # set CACHE variable IPP_H_PATH,
+ # path to IPP header files for the latest version
+ find_path(
+ IPP_H_PATH
+ NAMES ippversion.h
+ PATHS ${IPP_ROOT_DIR}
+ PATH_SUFFIXES include
+ DOC "The path to Intel(R) IPP header files"
+ NO_DEFAULT_PATH
+ NO_CMAKE_PATH)
+endif()
+
+if(WIN32 AND MINGW AND NOT IPP_LATEST_VERSION_MAJOR LESS 7)
+ # Since IPP built with Microsoft compiler and /GS option
+ # ======================================================
+ # From Windows SDK 7.1
+ # (usually in "C:\Program Files\Microsoft Visual Studio 10.0\VC\lib"),
+ # to avoid undefined reference to __security_cookie and _chkstk:
+ set(MSV_RUNTMCHK "RunTmChk")
+ set(IPP_LIBRARIES ${IPP_LIBRARIES} ${MSV_RUNTMCHK}${IPP_LIB_SUFFIX})
+
+ # To avoid undefined reference to _alldiv and _chkstk
+ # ===================================================
+ # NB: it may require a recompilation of w32api (after having modified
+ # the file ntdll.def) to export the required functions
+ # See http://code.opencv.org/issues/1906 for additional details
+ set(MSV_NTDLL "ntdll")
+ set(IPP_LIBRARIES ${IPP_LIBRARIES} ${MSV_NTDLL}${IPP_LIB_SUFFIX})
+endif()
+
+# ------------------------------------------------------------------------
+# This section will look for the IPP "compiler" dependent library
+# libiomp5.
+# ------------------------------------------------------------------------
+foreach(curdir ${CMAKE_SYSTEM_PREFIX_PATH} /opt)
+ set(curdir ${curdir}/intel)
+
+ if(EXISTS ${curdir})
+ file(GLOB_RECURSE liblist FOLLOW_SYMLINKS ${curdir}/libiomp5.*)
+ foreach(lib ${liblist})
+ get_filename_component(libdir ${lib} REALPATH)
+ get_filename_component(libdir ${libdir} PATH)
+
+ if(${IPP_VERSION_MAJOR} VERSION_LESS "7")
+ set(IPP_COMPILER_LIBRARY_DIRS ${libdir})
+ set(IPP_COMPILER_LIBRARIES iomp5)
+ else()
+ if(APPLE)
+ set(IPP_COMPILER_LIBRARY_DIRS ${libdir})
+ set(IPP_COMPILER_LIBRARIES iomp5)
+ else()
+ if(IPP_X64)
+ if(("${libdir}" MATCHES "intel64"))
+ set(IPP_COMPILER_LIBRARY_DIRS ${libdir})
+ set(IPP_COMPILER_LIBRARIES iomp5)
+ endif()
+ else()
+ set(IPP_COMPILER_LIBRARY_DIRS ${libdir})
+ set(IPP_COMPILER_LIBRARIES iomp5)
+ endif()
+ endif()
+ endif()
+ endforeach(lib)
+ endif()
+endforeach(curdir)
+
+# ------------------------------------------------------------------------
+# Build fullpath library list.
+# ------------------------------------------------------------------------
+find_library(LIB_IPPI ippi PATHS ${IPP_LIBRARY_DIRS})
+set(IPP_LIBRARY_LIST ${IPP_LIBRARY_LIST} ${LIB_IPPI})
+find_library(LIB_IPPS ipps PATHS ${IPP_LIBRARY_DIRS})
+set(IPP_LIBRARY_LIST ${IPP_LIBRARY_LIST} ${LIB_IPPS})
+find_library(LIB_IPPCORE ippcore PATHS ${IPP_LIBRARY_DIRS})
+set(IPP_LIBRARY_LIST ${IPP_LIBRARY_LIST} ${LIB_IPPCORE})
+find_library(LIB_IOMP5 iomp5 PATHS ${IPP_COMPILER_LIBRARY_DIRS})
+set(IPP_LIBRARY_LIST ${IPP_LIBRARY_LIST} ${LIB_IOMP5})
+
+
diff --git a/cmake/FindKRB5.cmake b/cmake/FindKRB5.cmake
new file mode 100644
index 0000000..9792704
--- /dev/null
+++ b/cmake/FindKRB5.cmake
@@ -0,0 +1,221 @@
+# - Try to find the Kerberos libraries
+# Once done this will define
+#
+# KRB5_ROOT_CONFIG - Set this variable to the full path of krb5-config of Kerberos
+# KRB5_ROOT_FLAVOUR - Set this variable to the flavour of Kerberos installation (MIT or Heimdal)
+#
+# Read-Only variables:
+# KRB5_FOUND - system has the Heimdal library
+# KRB5_FLAVOUR - "MIT" or "Heimdal" if anything found.
+# KRB5_INCLUDE_DIRS - the Heimdal include directory
+# KRB5_LIBRARIES - The libraries needed to use Kerberos
+# KRB5_LIBRARY_DIRS - Directories to add to linker search path
+# KRB5_LDFLAGS - Additional linker flags
+# KRB5_CFLAGS - Additional compiler flags
+# KRB5_VERSION - This is set to version advertised by pkg-config or read from manifest.
+# In case the library is found but no version info availabe it'll be set to "unknown"
+
+include(CheckIncludeFile)
+include(CheckIncludeFiles)
+include(CheckTypeSize)
+
+set(_KRB5_REQUIRED_VARS
+ KRB5_FOUND
+ KRB5_VERSION
+ KRB5_FLAVOUR
+ KRB5_INCLUDE_DIRS
+ KRB5_LIBRARIES)
+
+macro(PROVIDES_KRB5)
+ set(PREFIX "MACRO_KRB5")
+
+ cmake_parse_arguments(
+ "${PREFIX}"
+ ""
+ "NAME"
+ ""
+ ${ARGN})
+
+ set(KRB5_FLAVOUR ${MACRO_KRB5_NAME})
+ string(TOUPPER "${MACRO_KRB5_NAME}" MACRO_KRB5_NAME)
+
+ # This is a list of all variables that pkg_check_modules exports.
+ set(VARIABLES "CFLAGS;CFLAGS_I;CFLAGS_OTHER;FOUND;INCLUDEDIR;INCLUDE_DIRS;LDFLAGS;LDFLAGS_OTHER;LIBDIR;LIBRARIES;LIBRARY_DIRS;LIBS;LIBS_L;LIBS_OTHER;LIBS_PATHS;LINK_LIBRARIS;MODULE_NAME;PREFIX;VERSION;STATIC_CFLAGS;STATIC_CFLAGS_I;STATIC_CFLAGS_OTHER;STATIC_INCLUDE_DIRS;STATIC_LDFLAGS;STATIC_LDFLAGS_OTHER;STATIC_LIBDIR;STATIC_LIBRARIES;STATIC_LIBRARY_DIRS;STATIC_LIBS;STATIC_LIBS_L;STATIC_LIBS_OTHER;STATIC_LIBS_PATHS")
+ foreach(VAR ${VARIABLES})
+ set(KRB5_${VAR} ${KRB5_${MACRO_KRB5_NAME}_${VAR}})
+ endforeach()
+
+ # Bugfix for older installations:
+ # KRB5_INCLUDE_DIRS might not be set, fall back to KRB5_INCLUDEDIR
+ if (NOT KRB5_INCLUDE_DIRS)
+ set(KRB5_INCLUDE_DIRS ${KRB5_INCLUDEDIR})
+ endif()
+endmacro()
+
+function(GET_KRB5_CONFIG KRB5_CONFIG COMMAND RESULT)
+ execute_process(
+ COMMAND ${KRB5_CONFIG} ${COMMAND}
+ OUTPUT_VARIABLE _KRB5_RESULT
+ RESULT_VARIABLE _KRB5_CONFIGURE_FAILED
+ )
+ if (_KRB5_CONFIGURE_FAILED)
+ message(FATAL_ERROR "Failed to detect krb5-config [${COMMAND}]")
+ endif()
+
+ string(REGEX REPLACE "[\r\n]" "" _KRB5_RESULT ${_KRB5_RESULT})
+ set(${RESULT} "${_KRB5_RESULT}" PARENT_SCOPE)
+endfunction()
+
+function(string_starts_with str search RES)
+ string(FIND "${str}" "${search}" out)
+ if("${out}" EQUAL 0)
+ set(${RES} ON PARENT_SCOPE)
+ else()
+ set(${RES} OFF PARENT_SCOPE)
+ endif()
+endfunction()
+
+function(GET_KRB5_BY_CONFIG KRB5_CONFIG)
+ if (NOT KRB5_CONFIG)
+ find_file(KRB5_CONFIG
+ NAMES
+ "krb5-config"
+ "krb5-config.mit"
+ "krb5-config.heimdal"
+ PATH_SUFFIXES
+ bin
+ NO_CMAKE_PATH
+ NO_CMAKE_ENVIRONMENT_PATH
+ REQUIRED
+ )
+ message("autodetected krb5-config at ${KRB5_CONFIG}")
+ else()
+ message("using krb5-config ${KRB5_CONFIG} provided by KRB5_ROOT_CONFIG")
+ endif()
+
+ GET_KRB5_CONFIG("${KRB5_CONFIG}" "--vendor" _KRB5_VENDOR)
+
+ if ("${_KRB5_VENDOR}" STREQUAL "Apple MITKerberosShim")
+ message(FATAL_ERROR "Apple MITKerberosShim is deprecated and not supported")
+ elseif ("${_KRB5_VENDOR}" STREQUAL "Massachusetts Institute of Technology")
+ set(KRB5_FLAVOUR "MIT")
+ else()
+ set(KRB5_FLAVOUR "${_KRB5_VENDOR}")
+ endif()
+
+ GET_KRB5_CONFIG("${KRB5_CONFIG}" "--cflags" KRB5_CFLAGS)
+ GET_KRB5_CONFIG("${KRB5_CONFIG}" "--version" KRB5_VERSION_RAW)
+
+ string(REGEX REPLACE "[ ]" ";" KRB5_VERSION_LIST "${KRB5_VERSION_RAW}")
+ list(LENGTH KRB5_VERSION_LIST KRB5_VERSION_LIST_LEN)
+ math(EXPR KRB5_VERSION_LIST_LAST "${KRB5_VERSION_LIST_LEN} - 1")
+ list(GET KRB5_VERSION_LIST ${KRB5_VERSION_LIST_LAST} KRB5_VERSION)
+
+ if (KRB5_FLAVOUR STREQUAL "MIT")
+ if (KRB5_VERSION VERSION_LESS "1.14")
+ message(FATAL_ERROR "MIT kerberos ${KRB5_VERSION} < 1.14 is not supported, upgrade the library!")
+ endif()
+ endif()
+
+ GET_KRB5_CONFIG("${KRB5_CONFIG}" "--libs" KRB5_LDFLAGS)
+
+ string(REGEX REPLACE "[ ]" ";" KRB5_CFLAG_LIST "${KRB5_CFLAGS}")
+ foreach(FLAG ${KRB5_CFLAG_LIST})
+ string_starts_with("${FLAG}" "-I" RES)
+ if (RES)
+ string(SUBSTRING "${FLAG}" 2 -1 FLAG)
+ endif()
+
+ if (IS_DIRECTORY "${FLAG}")
+ list(APPEND KRB5_INCLUDEDIR ${FLAG})
+ endif()
+ endforeach()
+ if (NOT KRB5_INCLUDEDIR)
+ find_file(KRB5_INCLUDEDIR_HEADER
+ NAMES krb5.h
+ REQUIRED
+ )
+ get_filename_component(KRB5_INCLUDEDIR "${KRB5_INCLUDEDIR_HEADER}" DIRECTORY)
+ endif()
+
+ string(REGEX REPLACE "[ ]" ";" KRB5_LDFLAG_LIST "${KRB5_LDFLAGS}")
+ foreach(FLAG ${KRB5_LDFLAG_LIST})
+ string_starts_with("${FLAG}" "-L" RES)
+ if (RES)
+ string(SUBSTRING "${FLAG}" 2 -1 SUBFLAG)
+ list(APPEND KRB5_LIBRARY_DIRS ${SUBFLAG})
+ endif()
+ string_starts_with("${FLAG}" "-l" RES)
+ if (RES)
+ string(SUBSTRING "${FLAG}" 2 -1 SUBFLAG)
+ list(APPEND KRB5_LIBRARIES ${SUBFLAG})
+ endif()
+ endforeach()
+
+ set(KRB5_FOUND ON PARENT_SCOPE)
+ set(KRB5_VERSION ${KRB5_VERSION} PARENT_SCOPE)
+ set(KRB5_FLAVOUR ${KRB5_FLAVOUR} PARENT_SCOPE)
+ set(KRB5_CFLAGS ${KRB5_CFLAGS} PARENT_SCOPE)
+ set(KRB5_LDFLAGS ${KRB5_LDFLAGS} PARENT_SCOPE)
+ set(KRB5_INCLUDEDIR ${KRB5_INCLUDEDIR} PARENT_SCOPE)
+ set(KRB5_INCLUDE_DIRS ${KRB5_INCLUDEDIR} PARENT_SCOPE)
+ set(KRB5_LIBRARIES ${KRB5_LIBRARIES} PARENT_SCOPE)
+ set(KRB5_LIBRARY_DIRS ${KRB5_LIBRARY_DIRS} PARENT_SCOPE)
+endfunction()
+
+# try to find kerberos to compile against.
+#
+# * First search with pkg-config (prefer MIT over Heimdal)
+# * Then try to find krb5-config (generic, krb5-config.mit and last krb5-config.heimdal)
+find_package(PkgConfig REQUIRED)
+
+if (KRB5_ROOT_CONFIG)
+
+elseif (KRB5_ROOT_FLAVOUR)
+ if (KRB5_ROOT_FLAVOUR STREQUAL "Heimdal")
+ pkg_check_modules(KRB5_HEIMDAL heimdal-krb5)
+ elseif (KRB5_ROOT_FLAVOUR STREQUAL "MIT")
+ pkg_check_modules(KRB5_HEIMDAL mit-krb5)
+ else()
+ message(FATAL_ERROR "Invalid KRB5_ROOT_FLAVOUR=${KRB5_ROOT_FLAVOUR}, only 'MIT' or 'Heimdal' are supported")
+ endif()
+else()
+ pkg_check_modules(KRB5_MIT mit-krb5)
+ pkg_check_modules(KRB5_HEIMDAL heimdal-krb5)
+endif()
+
+if (KRB5_MIT_FOUND)
+ PROVIDES_KRB5(NAME "MIT")
+ if (KRB5_VERSION VERSION_LESS "1.14")
+ message(FATAL_ERROR "MIT kerberos < 1.14 is not supported, upgrade the library!")
+ endif()
+elseif(KRB5_HEIMDAL_FOUND)
+ PROVIDES_KRB5(NAME "Heimdal")
+elseif(KRB5_ANY_FOUND)
+ GET_KRB5_VENDOR(ANY_VENDOR)
+ PROVIDES_KRB5(NAME "${ANY_VENDOR}")
+else()
+ GET_KRB5_BY_CONFIG(${KRB5_ROOT_CONFIG})
+endif()
+
+#message("using KRB5_FOUND ${KRB5_FOUND} ")
+#message("using KRB5_VERSION ${KRB5_VERSION} ")
+#message("using KRB5_FLAVOUR ${KRB5_FLAVOUR} ")
+#message("using KRB5_CFLAGS ${KRB5_CFLAGS} ")
+#message("using KRB5_LDFLAGS ${KRB5_LDFLAGS} ")
+#message("using KRB5_INCLUDEDIR ${KRB5_INCLUDEDIR} ")
+#message("using KRB5_INCLUDE_DIRS ${KRB5_INCLUDEDIR} ")
+#message("using KRB5_LIBRARIES ${KRB5_LIBRARIES} ")
+
+include(FindPackageHandleStandardArgs)
+
+find_package_handle_standard_args(KRB5
+ REQUIRED_VARS
+ ${_KRB5_REQUIRED_VARS}
+ VERSION_VAR
+ KRB5_VERSION
+ FAIL_MESSAGE
+ "Could NOT find Kerberos, try to set the CMake variable KRB5_ROOT_CONFIG to the full path of krb5-config"
+)
+
+mark_as_advanced(${_KRB5_REQUIRED_VARS})
diff --git a/cmake/FindLAME.cmake b/cmake/FindLAME.cmake
new file mode 100644
index 0000000..0fec8e8
--- /dev/null
+++ b/cmake/FindLAME.cmake
@@ -0,0 +1,13 @@
+
+find_path(LAME_INCLUDE_DIR lame/lame.h)
+
+find_library(LAME_LIBRARY NAMES lame mp3lame)
+
+find_package_handle_standard_args(LAME DEFAULT_MSG LAME_INCLUDE_DIR LAME_LIBRARY)
+
+if (LAME_FOUND)
+ set(LAME_LIBRARIES ${LAME_LIBRARY})
+ set(LAME_INCLUDE_DIRS ${LAME_INCLUDE_DIR})
+endif()
+
+mark_as_advanced(LAME_INCLUDE_DIR LAME_LIBRARY)
diff --git a/cmake/FindMbedTLS.cmake b/cmake/FindMbedTLS.cmake
new file mode 100644
index 0000000..ceb6cfb
--- /dev/null
+++ b/cmake/FindMbedTLS.cmake
@@ -0,0 +1,38 @@
+
+find_path(MBEDTLS_INCLUDE_DIR
+ NAMES mbedtls/ssl.h
+ PATH_SUFFIXES include
+ HINTS ${MBEDTLS_ROOT})
+
+find_library(MBEDTLS_LIBRARY
+ NAMES mbedtls
+ PATH_SUFFIXES lib
+ HINTS ${MBEDTLS_ROOT})
+
+find_library(MBEDCRYPTO_LIBRARY
+ NAMES mbedcrypto
+ PATH_SUFFIXES lib
+ HINTS ${MBEDTLS_ROOT})
+
+find_library(MBEDX509_LIBRARY
+ NAMES mbedx509
+ PATH_SUFFIXES lib
+ HINTS ${MBEDTLS_ROOT})
+
+if(MBEDTLS_INCLUDE_DIR AND MBEDTLS_LIBRARY)
+ set(MBEDTLS_FOUND TRUE)
+ set(MBEDTLS_LIBRARIES ${MBEDTLS_LIBRARY} ${MBEDCRYPTO_LIBRARY} ${MBEDX509_LIBRARY})
+endif()
+
+if(MBEDTLS_FOUND)
+ if(NOT MBEDTLS_FIND_QUIETLY)
+ message(STATUS "Found mbed TLS: ${MBEDTLS_LIBRARIES}")
+ endif()
+else()
+ if(MBEDTLS_FIND_REQUIRED)
+ message(FATAL_ERROR "mbed TLS was not found")
+ endif()
+endif()
+
+mark_as_advanced(MBEDTLS_INCLUDE_DIR MBEDTLS_LIBRARY)
+
diff --git a/cmake/FindOSS.cmake b/cmake/FindOSS.cmake
new file mode 100644
index 0000000..811e052
--- /dev/null
+++ b/cmake/FindOSS.cmake
@@ -0,0 +1,44 @@
+#
+# Find OSS include header for Unix platforms.
+# used by FQTerm to detect the availability of OSS.
+
+IF(UNIX)
+ IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
+ SET(OSS_HDR_NAME "linux/soundcard.h")
+ ELSE(CMAKE_SYSTEM_NAME MATCHES "Linux")
+ IF(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
+ SET(OSS_HDR_NAME "sys/soundcard.h")
+ ELSE(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
+ IF(CMAKE_SYSTEM_NAME MATCHES "OpenBSD")
+ SET(OSS_HDR_NAME "soundcard.h")
+ ELSE(CMAKE_SYSTEM_NAME MATCHES "OpenBSD")
+ SET(OSS_HDR_NAME "machine/soundcard.h")
+ ENDIF(CMAKE_SYSTEM_NAME MATCHES "OpenBSD")
+ ENDIF(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
+ ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux")
+ENDIF(UNIX)
+
+FIND_PATH(OSS_INCLUDE_DIR "${OSS_HDR_NAME}"
+ "/usr/include" "/usr/local/include"
+)
+
+IF(OSS_INCLUDE_DIR)
+ SET(OSS_FOUND TRUE)
+ELSE(OSS_INCLUDE_DIR)
+ SET(OSS_FOUND)
+ENDIF(OSS_INCLUDE_DIR)
+
+IF(OSS_FOUND)
+ MESSAGE(STATUS "Found OSS Audio")
+ELSE(OSS_FOUND)
+ IF(OSS_FIND_REQUIRED)
+ MESSAGE(FATAL_ERROR "FAILED to found Audio - REQUIRED")
+ ELSE(OSS_FIND_REQUIRED)
+ MESSAGE(STATUS "Audio Disabled")
+ ENDIF(OSS_FIND_REQUIRED)
+ENDIF(OSS_FOUND)
+
+MARK_AS_ADVANCED (
+ OSS_FOUND
+ OSS_INCLUDE_DIR
+)
diff --git a/cmake/FindOpenH264.cmake b/cmake/FindOpenH264.cmake
new file mode 100644
index 0000000..2efe2cd
--- /dev/null
+++ b/cmake/FindOpenH264.cmake
@@ -0,0 +1,46 @@
+# - Try to find the OpenH264 library
+# Once done this will define
+#
+# OPENH264_ROOT - A list of search hints
+#
+# OPENH264_FOUND - system has OpenH264
+# OPENH264_INCLUDE_DIR - the OpenH264 include directory
+# OPENH264_LIBRARIES - libopenh264 library
+
+if (UNIX AND NOT ANDROID)
+ find_package(PkgConfig QUIET)
+ pkg_check_modules(PC_OPENH264 QUIET openh264)
+endif (UNIX AND NOT ANDROID)
+
+if (OPENH264_INCLUDE_DIR AND OPENH264_LIBRARY)
+ set(OPENH264_FIND_QUIETLY TRUE)
+endif (OPENH264_INCLUDE_DIR AND OPENH264_LIBRARY)
+
+find_path(OPENH264_INCLUDE_DIR NAMES wels/codec_api.h wels/codec_app_def.h wels/codec_def.h
+ PATH_SUFFIXES include
+ HINTS ${OPENH264_ROOT} ${PC_OPENH264_INCLUDE_DIRS})
+find_library(OPENH264_LIBRARY
+ NAMES openh264_dll openh264 welsdec
+ PATH_SUFFIXES lib
+ HINTS ${OPENH264_ROOT} ${PC_OPENH264_LIBRARY_DIRS})
+
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenH264 DEFAULT_MSG OPENH264_LIBRARY OPENH264_INCLUDE_DIR)
+
+if (OPENH264_INCLUDE_DIR AND OPENH264_LIBRARY)
+ set(OPENH264_FOUND TRUE)
+ set(OPENH264_LIBRARIES ${OPENH264_LIBRARY})
+endif (OPENH264_INCLUDE_DIR AND OPENH264_LIBRARY)
+
+if (OPENH264_FOUND)
+ if (NOT OPENH264_FIND_QUIETLY)
+ message(STATUS "Found OpenH264: ${OPENH264_LIBRARIES}")
+ endif (NOT OPENH264_FIND_QUIETLY)
+else (OPENH264_FOUND)
+ if (OPENH264_FIND_REQUIRED)
+ message(FATAL_ERROR "OpenH264 was not found")
+ endif(OPENH264_FIND_REQUIRED)
+endif (OPENH264_FOUND)
+
+mark_as_advanced(OPENH264_INCLUDE_DIR OPENH264_LIBRARY)
+
diff --git a/cmake/FindOpenSLES.cmake b/cmake/FindOpenSLES.cmake
new file mode 100644
index 0000000..033b274
--- /dev/null
+++ b/cmake/FindOpenSLES.cmake
@@ -0,0 +1,30 @@
+# - Find OpenSLES
+# Find the OpenSLES includes and libraries
+#
+# OpenSLES_INCLUDE_DIR - where to find dsound.h
+# OpenSLES_LIBRARIES - List of libraries when using dsound.
+# OpenSLES_FOUND - True if dsound found.
+
+get_property(_FIND_LIBRARY_USE_LIB64_PATHS GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS)
+set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS 1)
+
+find_path(OpenSLES_INCLUDE_DIR SLES/OpenSLES.h)
+
+find_library(OpenSLES_LIBRARY NAMES OpenSLES)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(OpenSLES DEFAULT_MSG
+ OpenSLES_INCLUDE_DIR OpenSLES_LIBRARY)
+
+if(OpenSLES_FOUND)
+ set(OpenSLES_INCLUDE_DIRS ${OpenSLES_INCLUDE_DIR})
+ set(OpenSLES_LIBRARIES ${OpenSLES_LIBRARY})
+else(OpenSLES_FOUND)
+ if (OpenSLES_FIND_REQUIRED)
+ message(FATAL_ERROR "Could NOT find OpenSLES")
+ endif()
+endif(OpenSLES_FOUND)
+
+mark_as_advanced(OpenSLES_INCLUDE_DIR OpenSLES_LIBRARY)
+
+set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS ${_FIND_LIBRARY_USE_LIB64_PATHS})
diff --git a/cmake/FindPAM.cmake b/cmake/FindPAM.cmake
new file mode 100644
index 0000000..1fdaa6c
--- /dev/null
+++ b/cmake/FindPAM.cmake
@@ -0,0 +1,40 @@
+# - Try to find the PAM libraries
+# Once done this will define
+#
+# PAM_FOUND - system has pam
+# PAM_INCLUDE_DIR - the pam include directory
+# PAM_LIBRARIES - libpam library
+
+if (PAM_INCLUDE_DIR AND PAM_LIBRARY)
+ set(PAM_FIND_QUIETLY TRUE)
+endif (PAM_INCLUDE_DIR AND PAM_LIBRARY)
+
+find_path(PAM_INCLUDE_DIR NAMES security/pam_appl.h pam/pam_appl.h)
+find_library(PAM_LIBRARY pam)
+find_library(DL_LIBRARY dl)
+
+if (PAM_INCLUDE_DIR AND PAM_LIBRARY)
+ set(PAM_FOUND TRUE)
+ if (DL_LIBRARY)
+ set(PAM_LIBRARIES ${PAM_LIBRARY} ${DL_LIBRARY})
+ else (DL_LIBRARY)
+ set(PAM_LIBRARIES ${PAM_LIBRARY})
+ endif (DL_LIBRARY)
+
+ if (EXISTS ${PAM_INCLUDE_DIR}/pam/pam_appl.h)
+ set(HAVE_PAM_PAM_APPL_H 1)
+ endif (EXISTS ${PAM_INCLUDE_DIR}/pam/pam_appl.h)
+endif (PAM_INCLUDE_DIR AND PAM_LIBRARY)
+
+if (PAM_FOUND)
+ if (NOT PAM_FIND_QUIETLY)
+ message(STATUS "Found PAM: ${PAM_LIBRARIES}")
+ endif (NOT PAM_FIND_QUIETLY)
+else (PAM_FOUND)
+ if (PAM_FIND_REQUIRED)
+ message(FATAL_ERROR "PAM was not found")
+ endif(PAM_FIND_REQUIRED)
+endif (PAM_FOUND)
+
+mark_as_advanced(PAM_INCLUDE_DIR PAM_LIBRARY DL_LIBRARY)
+
diff --git a/cmake/FindPCSC.cmake b/cmake/FindPCSC.cmake
new file mode 100644
index 0000000..e027242
--- /dev/null
+++ b/cmake/FindPCSC.cmake
@@ -0,0 +1,28 @@
+# - Try to find PCSC
+# Once done this will define
+# PCSC_FOUND - pcsc was found
+# PCSC_INCLUDE_DIRS - pcsc include directories
+# PCSC_LIBRARIES - libraries needed for linking
+
+find_package(PkgConfig)
+
+if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_PCSC QUIET libpcsclite)
+endif()
+
+find_path(PCSC_INCLUDE_DIR pcsclite.h WinSCard.h
+ HINTS ${PC_PCSC_INCLUDEDIR} ${PC_PCSC_INCLUDE_DIRS}
+ PATH_SUFFIXES PCSC)
+
+find_library(PCSC_LIBRARY NAMES PCSC WinSCard pcsclite
+ HINTS ${PC_PCSC_LIBDIR} ${PC_PCSC_LIBRARY_DIRS})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(PCSC DEFAULT_MSG PCSC_LIBRARY PCSC_INCLUDE_DIR)
+
+set(PCSC_LIBRARIES ${PCSC_LIBRARY})
+set(PCSC_INCLUDE_DIRS ${PCSC_INCLUDE_DIR})
+
+mark_as_advanced(PCSC_INCLUDE_DIR PCSC_LIBRARY)
+
+
diff --git a/cmake/FindPCSCWinPR.cmake b/cmake/FindPCSCWinPR.cmake
new file mode 100644
index 0000000..70a53d1
--- /dev/null
+++ b/cmake/FindPCSCWinPR.cmake
@@ -0,0 +1,15 @@
+
+find_library(PCSC_WINPR_LIBRARY
+ NAMES libpcsc-winpr.a
+ PATHS
+ /opt/lib
+ /usr/lib
+ /usr/local/lib
+ )
+
+if(NOT ${PCSC_WINPR_LIBRARY} MATCHES ".*-NOTFOUND")
+ set(PCSC_WINPR_FOUND 1)
+ message(STATUS "Found PCSC-WinPR: ${PCSC_WINPR_LIBRARY}")
+endif()
+
+mark_as_advanced(PCSC_WINPR_LIBRARY)
diff --git a/cmake/FindPixman.cmake b/cmake/FindPixman.cmake
new file mode 100644
index 0000000..a19a684
--- /dev/null
+++ b/cmake/FindPixman.cmake
@@ -0,0 +1,41 @@
+# - Find Pixman
+# Find the Pixman libraries
+#
+# This module defines the following variables:
+# PIXMAN_FOUND - true if PIXMAN_INCLUDE_DIR & PIXMAN_LIBRARY are found
+# PIXMAN_LIBRARIES - Set when PIXMAN_LIBRARY is found
+# PIXMAN_INCLUDE_DIRS - Set when PIXMAN_INCLUDE_DIR is found
+#
+# PIXMAN_INCLUDE_DIR - where to find pixman.h, etc.
+# PIXMAN_LIBRARY - the Pixman library
+#
+
+#=============================================================================
+# Copyright 2013 Marc-Andre Moreau <marcandre.moreau@gmail.com>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#=============================================================================
+
+find_path(PIXMAN_INCLUDE_DIR NAMES pixman.h PATH_SUFFIXES pixman-1)
+
+find_library(PIXMAN_LIBRARY NAMES pixman-1)
+
+find_package_handle_standard_args(Pixman DEFAULT_MSG PIXMAN_LIBRARY PIXMAN_INCLUDE_DIR)
+
+if(Pixman_FOUND)
+ set(PIXMAN_FOUND ON)
+ set(PIXMAN_LIBRARIES ${PIXMAN_LIBRARY})
+ set(PIXMAN_INCLUDE_DIRS ${PIXMAN_INCLUDE_DIR})
+endif()
+
+mark_as_advanced(PIXMAN_INCLUDE_DIR PIXMAN_LIBRARY)
diff --git a/cmake/FindPkcs11.cmake b/cmake/FindPkcs11.cmake
new file mode 100644
index 0000000..bcfb206
--- /dev/null
+++ b/cmake/FindPkcs11.cmake
@@ -0,0 +1,29 @@
+# - Try to find Pkcs11-helper
+# Using Pkg-config if available for path
+#
+# PKCS11_FOUND - all required ffmpeg components found on system
+# PKCS11_INCLUDE_DIRS - combined include directories
+# PKCS11_LIBRARIES - combined libraries to link
+
+find_package(PkgConfig)
+
+if (PKG_CONFIG_FOUND)
+ pkg_check_modules(PKCS11 libpkcs11-helper-1)
+endif()
+
+find_path(PKCS11_INCLUDE_DIR pkcs11-helper-1.0/pkcs11.h PATHS ${PKCS11_INCLUDE_DIRS})
+find_library(PKCS11_LIBRARY pkcs11-helper PATHS ${PKCS11_LIBRARY_DIRS})
+
+if (PKCS11_INCLUDE_DIR AND PKCS11_LIBRARY)
+ set(PKCS11_FOUND TRUE)
+endif()
+
+set(Pkcs11_FOUND ${PKCS11_FOUND})
+set(Pkcs11_INCLUDE_DIR ${PKCS11_INCLUDE_DIR})
+set(Pkcs11_INCLUDE_DIRS ${PKCS11_INCLUDE_DIR})
+set(Pkcs11_LIBRARY ${PKCS11_LIBRARY})
+
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(Pkcs11 DEFAULT_MSG Pkcs11_FOUND)
+
+
diff --git a/cmake/FindSWScale.cmake b/cmake/FindSWScale.cmake
new file mode 100644
index 0000000..8ee9cc6
--- /dev/null
+++ b/cmake/FindSWScale.cmake
@@ -0,0 +1,14 @@
+
+find_package(PkgConfig)
+
+if (PKG_CONFIG_FOUND)
+ pkg_check_modules(SWScale libswscale)
+endif()
+
+find_path(SWScale_INCLUDE_DIR libswscale/swscale.h PATHS ${SWScale_INCLUDE_DIRS})
+find_library(SWScale_LIBRARY swscale PATHS ${SWScale_LIBRARY_DIRS})
+
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(SWScale DEFAULT_MSG SWScale_INCLUDE_DIR SWScale_LIBRARY)
+
+mark_as_advanced(SWScale_INCLUDE_DIR SWScale_LIBRARY)
+
diff --git a/cmake/FindWayland.cmake b/cmake/FindWayland.cmake
new file mode 100644
index 0000000..c95ccc9
--- /dev/null
+++ b/cmake/FindWayland.cmake
@@ -0,0 +1,75 @@
+# - Finds Wayland
+# Find the Wayland libraries that are needed for UWAC
+#
+# This module defines the following variables:
+# WAYLAND_FOUND - true if UWAC has been found
+# WAYLAND_LIBS - Set to the full path to wayland client libraries
+# WAYLAND_INCLUDE_DIR - Set to the include directories for wayland
+# XKBCOMMON_LIBS - Set to the full path to xkbcommon libraries
+# XKBCOMMON_INCLUDE_DIR - Set to the include directories for xkbcommon
+#
+
+#=============================================================================
+# Copyright 2015 David Fort <contact@hardening-consulting.com>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#=============================================================================
+
+find_package(PkgConfig)
+
+if(PKG_CONFIG_FOUND)
+ pkg_check_modules(WAYLAND_SCANNER_PC wayland-scanner)
+ pkg_check_modules(WAYLAND_CLIENT_PC wayland-client)
+ pkg_check_modules(WAYLAND_CURSOR_PC wayland-cursor)
+ pkg_check_modules(XKBCOMMON_PC xkbcommon)
+endif()
+
+find_program(WAYLAND_SCANNER wayland-scanner
+ HINTS "${WAYLAND_SCANNER_PC_PREFIX}/bin"
+)
+
+find_path(WAYLAND_INCLUDE_DIR wayland-client.h
+ HINTS ${WAYLAND_CLIENT_PC_INCLUDE_DIRS}
+)
+
+find_library(WAYLAND_CLIENT_LIB
+ NAMES "wayland-client"
+ HINTS "${WAYLAND_CLIENT_PC_LIBRARY_DIRS}"
+)
+
+find_library(WAYLAND_CURSOR_LIB
+ NAMES "wayland-cursor"
+ HINTS "${WAYLAND_CURSOR_PC_LIBRARY_DIRS}"
+)
+
+if (WAYLAND_CLIENT_LIB AND WAYLAND_CURSOR_LIB)
+ list(APPEND WAYLAND_LIBS ${WAYLAND_CLIENT_LIB} ${WAYLAND_CURSOR_LIB})
+endif (WAYLAND_CLIENT_LIB AND WAYLAND_CURSOR_LIB)
+
+find_path(XKBCOMMON_INCLUDE_DIR xkbcommon/xkbcommon.h
+ HINTS ${XKBCOMMON_PC_INCLUDE_DIRS}
+)
+
+find_library(XKBCOMMON_LIBS
+ NAMES xkbcommon
+ HINTS "${XKBCOMMON_PC_LIBRARY_DIRS}"
+)
+
+set(Wayland_SCANNER ${WAYLAND_SCANNER})
+set(Wayland_INCLUDE_DIR ${WAYLAND_INCLUDE_DIR})
+set(Wayland_LIBS ${WAYLAND_LIBS})
+
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(Wayland DEFAULT_MSG Wayland_SCANNER Wayland_INCLUDE_DIR Wayland_LIBS XKBCOMMON_INCLUDE_DIR XKBCOMMON_LIBS)
+
+set(WAYLAND_FOUND ${Wayland_FOUND})
diff --git a/cmake/Findlibsystemd.cmake b/cmake/Findlibsystemd.cmake
new file mode 100644
index 0000000..ee00c78
--- /dev/null
+++ b/cmake/Findlibsystemd.cmake
@@ -0,0 +1,44 @@
+# Module defines
+# LIBSYSTEMD_FOUND - libsystemd libraries and includes found
+# LIBSYSTEMD_INCLUDE_DIRS - the libsystemd include directories
+# LIBSYSTEMD_LIBRARIES - the libsystemd libraries
+#
+# Cache entries:
+# LIBSYSTEMD_LIBRARY - detected libsystemd library
+# LIBSYSTEMD_INCLUDE_DIR - detected libsystemd include dir(s)
+#
+
+if(LIBSYSTEMD_INCLUDE_DIR AND LIBSYSTEMD_LIBRARY)
+ # in cache already
+ set(LIBSYSTEMD_FOUND TRUE)
+ set(LIBSYSTEMD_LIBRARIES ${LIBSYSTEMD_LIBRARY})
+ set(LIBSYSTEMD_INCLUDE_DIRS ${LIBSYSTEMD_INCLUDE_DIR})
+else()
+
+ find_package(PkgConfig)
+ if(PKG_CONFIG_FOUND)
+ pkg_check_modules(_LIBSYSTEMD_PC QUIET "libsystemd")
+ endif(PKG_CONFIG_FOUND)
+
+ find_path(LIBSYSTEMD_INCLUDE_DIR systemd/sd-journal.h
+ ${_LIBSYSTEMD_PC_INCLUDE_DIRS}
+ /usr/include
+ /usr/local/include
+ )
+ mark_as_advanced(LIBSYSTEMD_INCLUDE_DIR)
+
+ find_library (LIBSYSTEMD_LIBRARY NAMES systemd
+ PATHS
+ ${_LIBSYSTEMD_PC_LIBDIR}
+ )
+ mark_as_advanced(LIBSYSTEMD_LIBRARY)
+
+ include(FindPackageHandleStandardArgs)
+ FIND_PACKAGE_HANDLE_STANDARD_ARGS(libsystemd DEFAULT_MSG LIBSYSTEMD_LIBRARY LIBSYSTEMD_INCLUDE_DIR)
+
+ if(libsystemd_FOUND)
+ set(LIBSYSTEMD_LIBRARIES ${LIBSYSTEMD_LIBRARY})
+ set(LIBSYSTEMD_INCLUDE_DIRS ${LIBSYSTEMD_INCLUDE_DIR})
+ endif()
+
+endif()
diff --git a/cmake/Findlibusb-1.0.cmake b/cmake/Findlibusb-1.0.cmake
new file mode 100644
index 0000000..c7f046d
--- /dev/null
+++ b/cmake/Findlibusb-1.0.cmake
@@ -0,0 +1,98 @@
+# - Try to find libusb-1.0
+# Once done this will define
+#
+# LIBUSB_1_FOUND - system has libusb
+# LIBUSB_1_INCLUDE_DIRS - the libusb include directory
+# LIBUSB_1_LIBRARIES - Link these to use libusb
+# LIBUSB_1_DEFINITIONS - Compiler switches required for using libusb
+#
+# Adapted from cmake-modules Google Code project
+#
+# Copyright (c) 2006 Andreas Schneider <mail@cynapses.org>
+#
+# (Changes for libusb) Copyright (c) 2008 Kyle Machulis <kyle@nonpolynomial.com>
+#
+# Redistribution and use is allowed according to the terms of the New BSD license.
+#
+# CMake-Modules Project New BSD License
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# * Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# * Neither the name of the CMake-Modules Project nor the names of its
+# contributors may be used to endorse or promote products derived from this
+# software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+
+if (LIBUSB_1_LIBRARIES AND LIBUSB_1_INCLUDE_DIRS)
+ # in cache already
+ set(LIBUSB_FOUND TRUE)
+else (LIBUSB_1_LIBRARIES AND LIBUSB_1_INCLUDE_DIRS)
+ find_path(LIBUSB_1_INCLUDE_DIR
+ NAMES
+ libusb.h
+ PATHS
+ /usr/include
+ /usr/local/include
+ /sw/include
+ PATH_SUFFIXES
+ libusb-1.0
+ )
+
+ find_library(LIBUSB_1_LIBRARY
+ NAMES
+ libusb-1.0
+ usb-1.0
+ usb
+ PATHS
+ /usr/lib
+ /usr/local/lib
+ /sw/lib
+ )
+
+ set(LIBUSB_1_INCLUDE_DIRS
+ ${LIBUSB_1_INCLUDE_DIR}
+ )
+ set(LIBUSB_1_LIBRARIES
+ ${LIBUSB_1_LIBRARY}
+)
+
+ if (LIBUSB_1_INCLUDE_DIRS AND LIBUSB_1_LIBRARIES)
+ set(LIBUSB_1_FOUND TRUE)
+ endif (LIBUSB_1_INCLUDE_DIRS AND LIBUSB_1_LIBRARIES)
+
+ if (LIBUSB_1_FOUND)
+ if (NOT libusb_1_FIND_QUIETLY)
+ message(STATUS "Found libusb-1.0:")
+ message(STATUS " - Includes: ${LIBUSB_1_INCLUDE_DIRS}")
+ message(STATUS " - Libraries: ${LIBUSB_1_LIBRARIES}")
+ endif (NOT libusb_1_FIND_QUIETLY)
+ else (LIBUSB_1_FOUND)
+ if (libusb_1_FIND_REQUIRED)
+ message(FATAL_ERROR "Could not find libusb")
+ endif (libusb_1_FIND_REQUIRED)
+ endif (LIBUSB_1_FOUND)
+
+ # show the LIBUSB_1_INCLUDE_DIRS and LIBUSB_1_LIBRARIES variables only in the advanced view
+ mark_as_advanced(LIBUSB_1_INCLUDE_DIRS LIBUSB_1_LIBRARIES)
+
+endif (LIBUSB_1_LIBRARIES AND LIBUSB_1_INCLUDE_DIRS)
diff --git a/cmake/Findlodepng.cmake b/cmake/Findlodepng.cmake
new file mode 100644
index 0000000..0d3e925
--- /dev/null
+++ b/cmake/Findlodepng.cmake
@@ -0,0 +1,19 @@
+# - Try to find lodepng
+# Once done this will define
+# lodepng_FOUND - cJSON was found
+# lodepng_INCLUDE_DIRS - cJSON include directories
+# lodepng_LIBRARIES - cJSON libraries for linking
+
+find_path(lodepng_INCLUDE_DIR
+ NAMES lodepng.h)
+
+find_library(lodepng_LIBRARY
+ NAMES lodepng)
+
+if (lodepng_INCLUDE_DIR AND lodepng_LIBRARY)
+ set(lodepng_FOUND ON)
+ set(lodepng_INCLUDE_DIRS ${lodepng_INCLUDE_DIR})
+ set(lodepng_LIBRARIES ${lodepng_LIBRARY})
+endif()
+
+mark_as_advanced(lodepng_INCLUDE_DIRS lodepng_LIBRARIES)
diff --git a/cmake/Findsoxr.cmake b/cmake/Findsoxr.cmake
new file mode 100644
index 0000000..8a19946
--- /dev/null
+++ b/cmake/Findsoxr.cmake
@@ -0,0 +1,62 @@
+# Try to find the soxr library
+#
+# Copyright 2018 Thincast Technologies GmbH
+# Copyright 2018 Armin Novak <armin.novak@thincast.com>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+#
+# Once done this will define
+#
+# SOXR_ROOT - A list of search hints
+#
+# SOXR_FOUND - system has soxr
+# SOXR_INCLUDE_DIR - the soxr include directory
+# SOXR_LIBRARIES - libsoxr library
+
+if (UNIX AND NOT ANDROID)
+ find_package(PkgConfig QUIET)
+ pkg_check_modules(PC_SOXR QUIET soxr)
+endif (UNIX AND NOT ANDROID)
+
+if (SOXR_INCLUDE_DIR AND SOXR_LIBRARY)
+ set(SOXR_FIND_QUIETLY TRUE)
+endif (SOXR_INCLUDE_DIR AND SOXR_LIBRARY)
+
+find_path(SOXR_INCLUDE_DIR NAMES soxr.h
+ PATH_SUFFIXES include
+ HINTS ${SOXR_ROOT} ${PC_SOXR_INCLUDE_DIRS})
+find_library(SOXR_LIBRARY
+ NAMES soxr
+ PATH_SUFFIXES lib
+ HINTS ${SOXR_ROOT} ${PC_SOXR_LIBRARY_DIRS})
+
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(soxr DEFAULT_MSG SOXR_LIBRARY SOXR_INCLUDE_DIR)
+
+if (SOXR_INCLUDE_DIR AND SOXR_LIBRARY)
+ set(SOXR_FOUND TRUE)
+ set(SOXR_INCLUDE_DIRS ${SOXR_INCLUDE_DIR})
+ set(SOXR_LIBRARIES ${SOXR_LIBRARY})
+endif (SOXR_INCLUDE_DIR AND SOXR_LIBRARY)
+
+if (SOXR_FOUND)
+ if (NOT SOXR_FIND_QUIETLY)
+ message(STATUS "Found soxr: ${SOXR_LIBRARIES}")
+ endif (NOT SOXR_FIND_QUIETLY)
+else (SOXR_FOUND)
+ if (SOXR_FIND_REQUIRED)
+ message(FATAL_ERROR "soxr was not found")
+ endif(SOXR_FIND_REQUIRED)
+endif (SOXR_FOUND)
+
+mark_as_advanced(SOXR_INCLUDE_DIR SOXR_LIBRARY)
+
diff --git a/cmake/GNUInstallDirsWrapper.cmake b/cmake/GNUInstallDirsWrapper.cmake
new file mode 100644
index 0000000..53e9fc9
--- /dev/null
+++ b/cmake/GNUInstallDirsWrapper.cmake
@@ -0,0 +1,21 @@
+# GNUInstallDirs is a relatively new cmake module, so wrap it to avoid errors
+include(GNUInstallDirs OPTIONAL RESULT_VARIABLE GID_PATH)
+if(GID_PATH STREQUAL "NOTFOUND")
+ if(NOT DEFINED CMAKE_INSTALL_BINDIR)
+ set(CMAKE_INSTALL_BINDIR "bin" CACHE PATH "user executables (bin)")
+ endif()
+
+ if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
+ set(CMAKE_INSTALL_LIBDIR "lib${LIB_SUFFIX}" CACHE PATH "object code libraries (lib)")
+ endif()
+
+ foreach(dir BINDIR LIBDIR)
+ if(NOT IS_ABSOLUTE ${CMAKE_INSTALL_${dir}})
+ set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_${dir}}")
+ else()
+ set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_${dir}}")
+ endif()
+ endforeach()
+
+ mark_as_advanced(CMAKE_INSTALL_BINDIR CMAKE_INSTALL_LIBDIR)
+endif()
diff --git a/cmake/GetGitRevisionDescription.cmake b/cmake/GetGitRevisionDescription.cmake
new file mode 100644
index 0000000..237f9df
--- /dev/null
+++ b/cmake/GetGitRevisionDescription.cmake
@@ -0,0 +1,135 @@
+# - Returns a version string from Git
+#
+# These functions force a re-configure on each git commit so that you can
+# trust the values of the variables in your build system.
+#
+# get_git_head_revision(<refspecvar> <hashvar> [<additional arguments to git describe> ...])
+#
+# Returns the refspec and sha hash of the current head revision
+#
+# git_describe(<var> [<additional arguments to git describe> ...])
+#
+# Returns the results of git describe on the source tree, and adjusting
+# the output so that it tests false if an error occurs.
+#
+# git_get_exact_tag(<var> [<additional arguments to git describe> ...])
+#
+# Returns the results of git describe --exact-match on the source tree,
+# and adjusting the output so that it tests false if there was no exact
+# matching tag.
+#
+# Requires CMake 2.6 or newer (uses the 'function' command)
+#
+# Original Author:
+# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
+# http://academic.cleardefinition.com
+# Iowa State University HCI Graduate Program/VRAC
+#
+# Copyright Iowa State University 2009-2010.
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt)
+
+if(__get_git_revision_description)
+ return()
+endif()
+set(__get_git_revision_description YES)
+
+# We must run the following at "include" time, not at function call time,
+# to find the path to this module rather than the path to a calling list file
+get_filename_component(_gitdescmoddir ${CMAKE_CURRENT_LIST_FILE} PATH)
+
+function(get_git_head_revision _refspecvar _hashvar)
+
+ set(GIT_PARENT_DIR "${PROJECT_SOURCE_DIR}")
+ set(GIT_DIR "${GIT_PARENT_DIR}/.git")
+ while(NOT EXISTS "${GIT_DIR}") # .git dir not found, search parent directories
+ set(GIT_PREVIOUS_PARENT "${GIT_PARENT_DIR}")
+ get_filename_component(GIT_PARENT_DIR ${GIT_PARENT_DIR} PATH)
+ if(GIT_PARENT_DIR STREQUAL GIT_PREVIOUS_PARENT)
+ # We have reached the root directory, we are not in git
+ set(${_refspecvar} "GITDIR-NOTFOUND" PARENT_SCOPE)
+ set(${_hashvar} "GITDIR-NOTFOUND" PARENT_SCOPE)
+ return()
+ endif()
+ set(GIT_DIR "${GIT_PARENT_DIR}/.git")
+ endwhile()
+ set(GIT_DATA "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/git-data")
+ if(NOT EXISTS "${GIT_DATA}")
+ file(MAKE_DIRECTORY "${GIT_DATA}")
+ endif()
+
+ if(NOT EXISTS "${GIT_DIR}/HEAD")
+ return()
+ endif()
+ set(HEAD_FILE "${GIT_DATA}/HEAD")
+ configure_file("${GIT_DIR}/HEAD" "${HEAD_FILE}" COPYONLY)
+
+ configure_file("${_gitdescmoddir}/GetGitRevisionDescription.cmake.in"
+ "${GIT_DATA}/grabRef.cmake"
+ @ONLY)
+ include("${GIT_DATA}/grabRef.cmake")
+
+ set(${_refspecvar} "${HEAD_REF}" PARENT_SCOPE)
+ set(${_hashvar} "${HEAD_HASH}" PARENT_SCOPE)
+endfunction()
+
+function(git_rev_parse _var)
+ if(NOT GIT_FOUND)
+ find_package(Git QUIET)
+ endif()
+ if(NOT GIT_FOUND)
+ set(${_var} "n/a" PARENT_SCOPE)
+ return()
+ endif()
+ get_git_head_revision(refspec hash)
+ if(NOT hash)
+ set(${_var} "n/a" PARENT_SCOPE)
+ return()
+ endif()
+
+ execute_process(COMMAND "${GIT_EXECUTABLE}" rev-parse ${ARGN} ${hash}
+ WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
+ RESULT_VARIABLE res
+ OUTPUT_VARIABLE out
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ if(NOT res EQUAL 0)
+ set(out "n/a")
+ endif()
+
+ set(${_var} "${out}" PARENT_SCOPE)
+endfunction()
+
+
+function(git_describe _var)
+ if(NOT GIT_FOUND)
+ find_package(Git QUIET)
+ endif()
+ if(NOT GIT_FOUND)
+ set(${_var} "n/a" PARENT_SCOPE)
+ return()
+ endif()
+ get_git_head_revision(refspec hash)
+ if(NOT hash)
+ set(${_var} "n/a" PARENT_SCOPE)
+ return()
+ endif()
+
+ execute_process(COMMAND "${GIT_EXECUTABLE}" describe ${hash} ${ARGN}
+ WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
+ RESULT_VARIABLE res
+ OUTPUT_VARIABLE out
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ if(NOT res EQUAL 0)
+ set(out "n/a")
+ endif()
+
+ set(${_var} "${out}" PARENT_SCOPE)
+endfunction()
+
+function(git_get_exact_tag _var)
+ git_describe(out --exact-match ${ARGN})
+ set(${_var} "${out}" PARENT_SCOPE)
+endfunction()
diff --git a/cmake/GetGitRevisionDescription.cmake.in b/cmake/GetGitRevisionDescription.cmake.in
new file mode 100644
index 0000000..888ce13
--- /dev/null
+++ b/cmake/GetGitRevisionDescription.cmake.in
@@ -0,0 +1,38 @@
+#
+# Internal file for GetGitRevisionDescription.cmake
+#
+# Requires CMake 2.6 or newer (uses the 'function' command)
+#
+# Original Author:
+# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
+# http://academic.cleardefinition.com
+# Iowa State University HCI Graduate Program/VRAC
+#
+# Copyright Iowa State University 2009-2010.
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt)
+
+set(HEAD_HASH)
+
+file(READ "@HEAD_FILE@" HEAD_CONTENTS LIMIT 1024)
+
+string(STRIP "${HEAD_CONTENTS}" HEAD_CONTENTS)
+if(HEAD_CONTENTS MATCHES "ref")
+ # named branch
+ string(REPLACE "ref: " "" HEAD_REF "${HEAD_CONTENTS}")
+ if(EXISTS "@GIT_DIR@/${HEAD_REF}")
+ configure_file("@GIT_DIR@/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY)
+ elseif(EXISTS "@GIT_DIR@/logs/${HEAD_REF}")
+ configure_file("@GIT_DIR@/logs/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY)
+ set(HEAD_HASH "${HEAD_REF}")
+ endif()
+else()
+ # detached HEAD
+ configure_file("@GIT_DIR@/HEAD" "@GIT_DATA@/head-ref" COPYONLY)
+endif()
+
+if(NOT HEAD_HASH)
+ file(READ "@GIT_DATA@/head-ref" HEAD_HASH LIMIT 1024)
+ string(STRIP "${HEAD_HASH}" HEAD_HASH)
+endif()
diff --git a/cmake/InstallFreeRDPMan.cmake b/cmake/InstallFreeRDPMan.cmake
new file mode 100644
index 0000000..ba0d8a8
--- /dev/null
+++ b/cmake/InstallFreeRDPMan.cmake
@@ -0,0 +1,55 @@
+include(GNUInstallDirs)
+include(FindDocBookXSL)
+
+function(install_freerdp_man manpage section)
+ if(WITH_MANPAGES)
+ install(FILES ${manpage} DESTINATION ${CMAKE_INSTALL_MANDIR}/man${section})
+ endif()
+endfunction()
+
+function(generate_and_install_freerdp_man_from_xml template manpage dependencies)
+ if(WITH_MANPAGES)
+ find_program(XSLTPROC_EXECUTABLE NAMES xsltproc REQUIRED)
+ if (NOT DOCBOOKXSL_FOUND)
+ message(FATAL_ERROR "docbook xsl not found but required for manpage generation")
+ endif()
+
+ # We need the variable ${MAN_TODAY} to contain the current date in ISO
+ # format to replace it in the configure_file step.
+ include(today)
+
+ TODAY(MAN_TODAY)
+
+ configure_file(${template}.xml.in ${manpage}.xml @ONLY IMMEDIATE)
+
+ foreach(DEP IN LISTS dependencies)
+ set(SRC ${CMAKE_CURRENT_SOURCE_DIR}/${DEP}.in)
+ set(DST ${CMAKE_CURRENT_BINARY_DIR}/${DEP})
+
+ if (EXISTS ${SRC})
+ message("generating ${DST} from ${SRC}")
+ configure_file(${SRC} ${DST} @ONLY IMMEDIATE)
+ else()
+ message("using ${DST} from ${SRC}")
+ endif()
+ endforeach()
+
+ add_custom_command(
+ OUTPUT ${manpage}
+ COMMAND ${CMAKE_BINARY_DIR}/client/common/man/generate_argument_docbook
+ COMMAND ${XSLTPROC_EXECUTABLE} --path "${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}" ${DOCBOOKXSL_DIR}/manpages/docbook.xsl ${manpage}.xml
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ DEPENDS
+ ${CMAKE_CURRENT_BINARY_DIR}/${manpage}.xml
+ generate_argument_docbook
+ ${template}.xml.in
+ )
+
+ add_custom_target(
+ ${manpage}.manpage ALL
+ DEPENDS
+ ${manpage}
+ )
+ install_freerdp_man(${CMAKE_CURRENT_BINARY_DIR}/${manpage} 1)
+ endif()
+endfunction()
diff --git a/cmake/LibFindMacros.cmake b/cmake/LibFindMacros.cmake
new file mode 100644
index 0000000..0e47404
--- /dev/null
+++ b/cmake/LibFindMacros.cmake
@@ -0,0 +1,116 @@
+# Works the same as find_package, but forwards the "REQUIRED" and "QUIET" arguments
+# used for the current package. For this to work, the first parameter must be the
+# prefix of the current package, then the prefix of the new package etc, which are
+# passed to find_package.
+macro(libfind_package PREFIX)
+ set(LIBFIND_PACKAGE_ARGS $ {ARGN})
+ if($ {PREFIX} _FIND_QUIETLY)
+ set(LIBFIND_PACKAGE_ARGS $ {LIBFIND_PACKAGE_ARGS} QUIET)
+ endif($ {PREFIX} _FIND_QUIETLY)
+ if($ {PREFIX} _FIND_REQUIRED)
+ set(LIBFIND_PACKAGE_ARGS $ {LIBFIND_PACKAGE_ARGS} REQUIRED)
+ endif($ {PREFIX} _FIND_REQUIRED)
+ find_package($ {LIBFIND_PACKAGE_ARGS})
+endmacro(libfind_package)
+
+# CMake developers made the UsePkgConfig system deprecated in the same release (2.6)
+# where they added pkg_check_modules. Consequently I need to support both in my scripts
+# to avoid those deprecated warnings. Here's a helper that does just that.
+# Works identically to pkg_check_modules, except that no checks are needed prior to use.
+macro (libfind_pkg_check_modules PREFIX PKGNAME)
+ if (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
+ include(UsePkgConfig)
+ pkgconfig(${PKGNAME} ${PREFIX}_INCLUDE_DIRS ${PREFIX}_LIBRARY_DIRS ${PREFIX}_LDFLAGS ${PREFIX}_CFLAGS)
+ else (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
+ find_package(PkgConfig)
+ if (PKG_CONFIG_FOUND)
+ pkg_check_modules(${PREFIX} ${PKGNAME})
+ endif (PKG_CONFIG_FOUND)
+ endif (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
+endmacro (libfind_pkg_check_modules)
+
+# Do the final processing once the paths have been detected.
+# If include dirs are needed, ${PREFIX}_PROCESS_INCLUDES should be set to contain
+# all the variables, each of which contain one include directory.
+# Ditto for ${PREFIX}_PROCESS_LIBS and library files.
+# Will set ${PREFIX}_FOUND, ${PREFIX}_INCLUDE_DIRS and ${PREFIX}_LIBRARIES.
+# Also handles errors in case library detection was required, etc.
+macro (libfind_process PREFIX)
+# Skip processing if already processed during this run
+ if (NOT ${PREFIX}_FOUND)
+# Start with the assumption that the library was found
+ set (${PREFIX}_FOUND TRUE)
+
+# Process all includes and set _FOUND to false if any are missing
+ foreach (i ${${PREFIX}_PROCESS_INCLUDES})
+ if (${i})
+ set (${PREFIX}_INCLUDE_DIRS ${${PREFIX}_INCLUDE_DIRS} ${${i}})
+ mark_as_advanced(${i})
+ else (${i})
+ set (${PREFIX}_FOUND FALSE)
+ endif (${i})
+ endforeach (i)
+
+# Process all libraries and set _FOUND to false if any are missing
+ foreach (i ${${PREFIX}_PROCESS_LIBS})
+ if (${i})
+ set (${PREFIX}_LIBRARIES ${${PREFIX}_LIBRARIES} ${${i}})
+ mark_as_advanced(${i})
+ else (${i})
+ set (${PREFIX}_FOUND FALSE)
+ endif (${i})
+ endforeach (i)
+
+# Print message and/or exit on fatal error
+ if (${PREFIX}_FOUND)
+ if (NOT ${PREFIX}_FIND_QUIETLY)
+ message (STATUS "Found ${PREFIX} ${${PREFIX}_VERSION}")
+ endif (NOT ${PREFIX}_FIND_QUIETLY)
+ else (${PREFIX}_FOUND)
+ if (${PREFIX}_FIND_REQUIRED)
+ foreach (i ${${PREFIX}_PROCESS_INCLUDES} ${${PREFIX}_PROCESS_LIBS})
+ message("${i}=${${i}}")
+ endforeach (i)
+ message (FATAL_ERROR "Required library ${PREFIX} NOT FOUND.\nInstall the library (dev version) and try again. If the library is already installed, use ccmake to set the missing variables manually.")
+ endif (${PREFIX}_FIND_REQUIRED)
+ endif (${PREFIX}_FOUND)
+ endif (NOT ${PREFIX}_FOUND)
+endmacro (libfind_process)
+
+macro(libfind_library PREFIX basename)
+ set(TMP "")
+ if(MSVC80)
+ set(TMP -vc80)
+ endif(MSVC80)
+ if(MSVC90)
+ set(TMP -vc90)
+ endif(MSVC90)
+ set(${PREFIX}_LIBNAMES ${basename}${TMP})
+ if(${ARGC} GREATER 2)
+ set(${PREFIX}_LIBNAMES ${basename}${TMP}-${ARGV2})
+ string(REGEX REPLACE "\\." "_" TMP ${${PREFIX}_LIBNAMES})
+ set(${PREFIX}_LIBNAMES ${${PREFIX}_LIBNAMES} ${TMP})
+ endif(${ARGC} GREATER 2)
+ find_library(${PREFIX}_LIBRARY
+ NAMES ${${PREFIX}_LIBNAMES}
+ PATHS ${${PREFIX}_PKGCONF_LIBRARY_DIRS})
+endmacro(libfind_library)
+
+SET(THREE_PART_VERSION_REGEX "[0-9]+\\.[0-9]+\\.[0-9]+")
+# Breaks up a string in the form n1.n2.n3 into three parts and stores
+# them in major, minor, and patch. version should be a value, not a
+# variable, while major, minor and patch should be variables.
+MACRO(THREE_PART_VERSION_TO_VARS version major minor patch)
+ IF(${version} MATCHES ${THREE_PART_VERSION_REGEX})
+ STRING(REPLACE "." " " version_list ${version})
+ SEPARATE_ARGUMENTS(version_list)
+ LIST(GET version_list 0 ${major})
+ LIST(GET version_list 1 ${minor})
+ LIST(GET version_list 2 ${patch})
+ ELSE(${version} MATCHES ${THREE_PART_VERSION_REGEX})
+ MESSAGE("MACRO(THREE_PART_VERSION_TO_VARS ${version} ${major} ${minor} ${patch}")
+ MESSAGE(FATAL_ERROR "Problem parsing version string, I can't parse it properly.")
+ ENDIF(${version} MATCHES ${THREE_PART_VERSION_REGEX})
+ENDMACRO(THREE_PART_VERSION_TO_VARS)
+
+
diff --git a/cmake/MSVCRuntime.cmake b/cmake/MSVCRuntime.cmake
new file mode 100644
index 0000000..f3fb97b
--- /dev/null
+++ b/cmake/MSVCRuntime.cmake
@@ -0,0 +1,47 @@
+if (WIN32)
+ if (CMAKE_VERSION VERSION_LESS 3.15.0)
+ message(FATAL_ERROR "windows builds require CMake >= 3.15")
+ endif()
+ if(NOT DEFINED CMAKE_MSVC_RUNTIME_LIBRARY)
+ if (MSVC_RUNTIME STREQUAL "dynamic")
+ set(MSVC_DEFAULT_RUNTIME "MultiThreadedDLL")
+ elseif(MSVC_RUNTIME STREQUAL "static")
+ set(MSVC_DEFAULT_RUNTIME "MultiThreaded")
+ else()
+ message(WARNING "invalid MSVC_RUNTIME (deprecated) value '${MSVC_RUNTIME}', ignoring")
+ endif()
+
+ if(MSVC_DEFAULT_RUNTIME)
+ message("Using CMAKE_MSVC_RUNTIME_LIBRARY=${MSVC_DEFAULT_RUNTIME} (derived from MSVC_RUNTIME (deprecated) value '${MSVC_RUNTIME}')" )
+ else()
+ set(MSVC_DEFAULT_RUNTIME "MultiThreaded")
+
+ if (CMAKE_BUILD_TYPE STREQUAL "Debug")
+ string(APPEND MSVC_DEFAULT_RUNTIME "Debug")
+ endif()
+
+ if (BUILD_SHARED_LIBS)
+ string(APPEND MSVC_DEFAULT_RUNTIME "DLL")
+ endif()
+ message("Using CMAKE_MSVC_RUNTIME_LIBRARY=${MSVC_DEFAULT_RUNTIME}" )
+ endif()
+
+ set(CMAKE_MSVC_RUNTIME_LIBRARY ${MSVC_DEFAULT_RUNTIME} CACHE STRING "MSVC runtime")
+ endif()
+
+ message("build is using MSVC runtime ${CMAKE_MSVC_RUNTIME_LIBRARY}")
+
+ string(FIND ${CMAKE_MSVC_RUNTIME_LIBRARY} "DLL" IS_SHARED)
+ if(IS_SHARED STREQUAL "-1")
+ if(BUILD_SHARED_LIBS)
+ message(FATAL_ERROR "Static CRT is only supported in a fully static build")
+ endif()
+ message(STATUS "Use the MSVC static runtime option carefully!")
+ message(STATUS "OpenSSL uses /MD by default, and is very picky")
+ message(STATUS "Random freeing errors are a common sign of runtime issues")
+ endif()
+
+ if(NOT DEFINED CMAKE_SUPPRESS_REGENERATION)
+ set(CMAKE_SUPPRESS_REGENERATION ON)
+ endif()
+endif()
diff --git a/cmake/MergeStaticLibs.cmake b/cmake/MergeStaticLibs.cmake
new file mode 100644
index 0000000..4fa5dad
--- /dev/null
+++ b/cmake/MergeStaticLibs.cmake
@@ -0,0 +1,151 @@
+
+# Copyright (C) 2012 Modelon AB
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the BSD style license.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# FMILIB_License.txt file for more details.
+
+# You should have received a copy of the FMILIB_License.txt file
+# along with this program. If not, contact Modelon AB <http://www.modelon.com>.
+
+# Merge_static_libs(output_library lib1 lib2 ... libn) merges a number of static
+# libs into a single static library
+function(merge_static_libs output_library)
+ set(output_target "${output_library}")
+ string(REGEX REPLACE "-" "_" output_library ${output_library})
+ set(libs ${ARGV})
+ list(REMOVE_AT libs 0)
+
+ # Create a dummy file that the target will depend on
+ set(dummyfile ${CMAKE_CURRENT_BINARY_DIR}/${output_library}_dummy.c)
+ file(WRITE ${dummyfile} "const char * dummy = \"${dummyfile}\";")
+
+ add_library(${output_target} STATIC ${dummyfile})
+
+ if("${CMAKE_CFG_INTDIR}" STREQUAL ".")
+ set(multiconfig FALSE)
+ else()
+ set(multiconfig TRUE)
+ endif()
+
+ # First get the file names of the libraries to be merged
+ foreach(lib ${libs})
+ get_target_property(libtype ${lib} TYPE)
+ if(NOT libtype STREQUAL "STATIC_LIBRARY")
+ message(FATAL_ERROR "Merge_static_libs can only process static libraries")
+ endif()
+ if(multiconfig)
+ foreach(CONFIG_TYPE ${CMAKE_CONFIGURATION_TYPES})
+ get_target_property("libfile_${CONFIG_TYPE}" ${lib} "LOCATION_${CONFIG_TYPE}")
+ list(APPEND libfiles_${CONFIG_TYPE} ${libfile_${CONFIG_TYPE}})
+ endforeach()
+ else()
+ get_target_property(libfile ${lib} LOCATION)
+ list(APPEND libfiles "${libfile}")
+ endif(multiconfig)
+ endforeach()
+
+ # Just to be sure: cleanup from duplicates
+ if(multiconfig)
+ foreach(CONFIG_TYPE ${CMAKE_CONFIGURATION_TYPES})
+ list(REMOVE_DUPLICATES libfiles_${CONFIG_TYPE})
+ set(libfiles ${libfiles} ${libfiles_${CONFIG_TYPE}})
+ endforeach()
+ endif()
+ list(REMOVE_DUPLICATES libfiles)
+
+ # Now the easy part for MSVC and for MAC
+ if(MSVC)
+ # lib.exe does the merging of libraries just need to conver the list into string
+ foreach(CONFIG_TYPE ${CMAKE_CONFIGURATION_TYPES})
+ set(flags "")
+ foreach(lib ${libfiles_${CONFIG_TYPE}})
+ set(flags "${flags} ${lib}")
+ endforeach()
+ string(TOUPPER "STATIC_LIBRARY_FLAGS_${CONFIG_TYPE}" PROPNAME)
+ set_target_properties(${output_target} PROPERTIES ${PROPNAME} "${flags}")
+ endforeach()
+
+ elseif(APPLE)
+ # Use OSX's libtool to merge archives
+ if(multiconfig)
+ message(FATAL_ERROR "Multiple configurations are not supported")
+ endif()
+ get_target_property(outfile ${output_target} LOCATION)
+ add_custom_command(TARGET ${output_target} POST_BUILD
+ COMMAND rm ${outfile}
+ COMMAND /usr/bin/libtool -static -o ${outfile}
+ ${libfiles}
+ )
+ else()
+ # general UNIX - need to "ar -x" and then "ar -ru"
+ if(multiconfig)
+ message(FATAL_ERROR "Multiple configurations are not supported")
+ endif()
+ get_target_property(outfile ${output_target} LOCATION)
+ message(STATUS "output file location is ${outfile}")
+ foreach(lib ${libfiles})
+ # objlistfile will contain the list of object files for the library
+ set(objlistfile ${lib}.objlist)
+ set(objdir ${lib}.objdir)
+ set(objlistcmake ${objlistfile}.cmake)
+ get_filename_component(libname ${lib} NAME_WE)
+
+ if(${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/cmake.check_cache IS_NEWER_THAN ${objlistcmake})
+
+ file(WRITE ${objlistcmake} "
+ # delete previous object files
+ message(STATUS \"Removing previous object files from ${lib}\")
+ EXECUTE_PROCESS(COMMAND ls .
+ WORKING_DIRECTORY ${objdir}
+ COMMAND xargs -I {} rm {}
+ WORKING_DIRECTORY ${objdir})
+ # Extract object files from the library
+ message(STATUS \"Extracting object files from ${lib}\")
+ EXECUTE_PROCESS(COMMAND ${CMAKE_AR} -x ${lib}
+ WORKING_DIRECTORY ${objdir})
+ # Prefixing object files to avoid conflicts
+ message(STATUS \"Prefixing object files to avoid conflicts\")
+ EXECUTE_PROCESS(COMMAND ls .
+ WORKING_DIRECTORY ${objdir}
+ COMMAND xargs -I {} mv {} ${libname}_{}
+ WORKING_DIRECTORY ${objdir})
+ # save the list of object files
+ EXECUTE_PROCESS(COMMAND ls .
+ OUTPUT_FILE ${objlistfile}
+ WORKING_DIRECTORY ${objdir})
+ ")
+
+ file(MAKE_DIRECTORY ${objdir})
+
+ add_custom_command(
+ OUTPUT ${objlistfile}
+ COMMAND ${CMAKE_COMMAND} -P ${objlistcmake}
+ DEPENDS ${lib})
+
+ endif()
+
+ list(APPEND extrafiles "${objlistfile}")
+ # relative path is needed by ar under MSYS
+ file(RELATIVE_PATH objlistfilerpath ${objdir} ${objlistfile})
+ add_custom_command(TARGET ${output_target} POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E echo "Running: ${CMAKE_AR} ru ${outfile} @${objlistfilerpath}"
+ COMMAND ${CMAKE_AR} ru "${outfile}" @"${objlistfilerpath}"
+ #COMMAND ld -r -static -o "${outfile}" --whole-archive @"${objlistfilerpath}"
+ WORKING_DIRECTORY ${objdir})
+ endforeach()
+ add_custom_command(TARGET ${output_target} POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E echo "Running: ${CMAKE_RANLIB} ${outfile}"
+ COMMAND ${CMAKE_RANLIB} ${outfile})
+ endif()
+ file(WRITE ${dummyfile}.base "const char* ${output_library}_sublibs=\"${libs}\";")
+ add_custom_command(
+ OUTPUT ${dummyfile}
+ COMMAND ${CMAKE_COMMAND} -E copy ${dummyfile}.base ${dummyfile}
+ DEPENDS ${libs} ${extrafiles})
+
+endfunction()
diff --git a/cmake/PreventInSourceBuilds.cmake b/cmake/PreventInSourceBuilds.cmake
new file mode 100644
index 0000000..6488ced
--- /dev/null
+++ b/cmake/PreventInSourceBuilds.cmake
@@ -0,0 +1,55 @@
+# PreventInSourceBuilds
+# ---------------------
+#
+# Prevent in-source builds
+#
+# It is generally acknowledged that it is preferable to run CMake out of source,
+# in a dedicated build directory. To prevent users from accidentally running
+# CMake in the source directory, just include this module.
+
+option(ALLOW_IN_SOURCE_BUILD "[deprecated] Allow building in source tree" OFF)
+
+if (ALLOW_IN_SOURCE_BUILD)
+ set(CMAKE_DISABLE_SOURCE_CHANGES OFF CACHE INTERNAL "policy")
+ set(CMAKE_DISABLE_IN_SOURCE_BUILD OFF CACHE INTERNAL "policy")
+ if("${srcdir}" STREQUAL "${bindir}")
+ message(WARNING "Running in-source-tree build [ALLOW_IN_SOURCE_BUILD=ON]")
+ endif()
+else()
+ set(CMAKE_DISABLE_SOURCE_CHANGES ON CACHE INTERNAL "policy")
+ set(CMAKE_DISABLE_IN_SOURCE_BUILD ON CACHE INTERNAL "policy")
+
+ # make sure the user doesn't play dirty with symlinks
+ get_filename_component(srcdir "${CMAKE_SOURCE_DIR}" REALPATH)
+ get_filename_component(bindir "${CMAKE_BINARY_DIR}" REALPATH)
+
+ # disallow in-source builds
+ if("${srcdir}" STREQUAL "${bindir}")
+ message(FATAL_ERROR "\
+
+CMake must not to be run in the source directory. \
+Rather create a dedicated build directory and run CMake there. \
+CMake now already created some files, to clean up after this aborted in-source compilation:
+ rm -r CMakeCache.txt CMakeFiles
+or
+ git clean -xdf
+
+If you happen to require in-source-tree builds for some reason rerun with -DALLOW_IN_SOURCE_BUILD=ON
+")
+ endif()
+
+# Check for remnants of in source builds
+ if(EXISTS "${CMAKE_SOURCE_DIR}/CMakeCache.txt" OR EXISTS "${CMAKE_SOURCE_DIR}/CMakeFiles")
+ message(FATAL_ERROR " \
+
+Remnants of in source CMake run detected, aborting!
+
+To clean up after this aborted in-source compilation:
+ rm -r CMakeCache.txt CMakeFiles
+or
+ git clean -xdf
+
+If you happen to require in-source-tree builds for some reason rerun with -DALLOW_IN_SOURCE_BUILD=ON
+")
+ endif()
+endif()
diff --git a/cmake/SetFreeRDPCMakeInstallDir.cmake b/cmake/SetFreeRDPCMakeInstallDir.cmake
new file mode 100644
index 0000000..125e2f4
--- /dev/null
+++ b/cmake/SetFreeRDPCMakeInstallDir.cmake
@@ -0,0 +1,7 @@
+function(SetFreeRDPCMakeInstallDir SETVAR subdir)
+ if(FREEBSD)
+ set(${SETVAR} "${CMAKE_INSTALL_DATAROOTDIR}/cmake/Modules/${subdir}" PARENT_SCOPE)
+ else()
+ set(${SETVAR} "${CMAKE_INSTALL_LIBDIR}/cmake/${subdir}" PARENT_SCOPE)
+ endif()
+endfunction()
diff --git a/cmake/ShowCMakeVars.cmake b/cmake/ShowCMakeVars.cmake
new file mode 100644
index 0000000..de9e2df
--- /dev/null
+++ b/cmake/ShowCMakeVars.cmake
@@ -0,0 +1,15 @@
+function(ShowCMakeVars)
+ get_cmake_property(_variableNames VARIABLES)
+ list (SORT _variableNames)
+ foreach (_variableName ${_variableNames})
+ if (ARGV0)
+ unset(MATCHED)
+ string(REGEX MATCH ${ARGV0} MATCHED ${_variableName})
+ if (NOT MATCHED)
+ continue()
+ endif()
+ endif()
+ message(STATUS "${_variableName}=${${_variableName}}")
+ endforeach()
+endfunction()
+
diff --git a/cmake/WarnUnmaintained.cmake b/cmake/WarnUnmaintained.cmake
new file mode 100644
index 0000000..de470e1
--- /dev/null
+++ b/cmake/WarnUnmaintained.cmake
@@ -0,0 +1,9 @@
+
+macro(warn_unmaintained name)
+ message(WARNING "[unmaintained] ${name} is unmaintained!")
+ message(WARNING "[unmaintained] use at your own risk!")
+ message(WARNING "[unmaintained] If problems occur please check https://github.com/FreeRDP/FreeRDP/issues for known issues, but be prepared to fix them on your own!")
+ message(WARNING "[unmaintained] Developers hang out in https://matrix.to/#/#FreeRDP:matrix.org?via=matrix.org")
+ message(WARNING "[unmaintained] - dont hesitate to ask some questions. (replies might take some time depending on your timezone)")
+ message(WARNING "[unmaintained] - if you intend using this component write us a message")
+endmacro()
diff --git a/cmake/WindowsDLLVersion.rc.in b/cmake/WindowsDLLVersion.rc.in
new file mode 100644
index 0000000..5a0da5e
--- /dev/null
+++ b/cmake/WindowsDLLVersion.rc.in
@@ -0,0 +1,35 @@
+#include <winresrc.h>
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION @RC_VERSION_MAJOR@,@RC_VERSION_MINOR@,@RC_VERSION_BUILD@,@RC_VERSION_PATCH@
+ PRODUCTVERSION @RC_VERSION_MAJOR@,@RC_VERSION_MINOR@,@RC_VERSION_BUILD@,@RC_VERSION_PATCH@
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x40004L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "CompanyName", "@RC_VERSION_VENDOR@"
+ VALUE "FileDescription", "@RC_VERSION_DESCRIPTION@"
+ VALUE "FileVersion", "@RC_VERSION_MAJOR@,@RC_VERSION_MINOR@,@RC_VERSION_PATCH@,@RC_VERSION_BUILD@"
+ VALUE "InternalName", "@RC_VERSION_FILE@"
+ VALUE "LegalCopyright", "Copyright (C) 2011-@RC_VERSION_YEAR@"
+ VALUE "OriginalFilename", "@RC_VERSION_FILE@"
+ VALUE "ProductName", "@RC_VERSION_PRODUCT@"
+ VALUE "ProductVersion", "@RC_VERSION_MAJOR@,@RC_VERSION_MINOR@,@RC_VERSION_BUILD@,@RC_VERSION_PATCH@"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
+
diff --git a/cmake/pkg-config-install-prefix.cmake b/cmake/pkg-config-install-prefix.cmake
new file mode 100644
index 0000000..600b2f7
--- /dev/null
+++ b/cmake/pkg-config-install-prefix.cmake
@@ -0,0 +1,13 @@
+option(PKG_CONFIG_RELOCATABLE "Generate relocatable pkg-config files" ON)
+if (PKG_CONFIG_RELOCATABLE)
+ file(RELATIVE_PATH PKG_CONFIG_INSTALL_REL ${CMAKE_INSTALL_FULL_LIBDIR}/pkgconfig ${CMAKE_INSTALL_PREFIX})
+ if (PKG_CONFIG_INSTALL_REL MATCHES "/$")
+ string(LENGTH ${PKG_CONFIG_INSTALL_REL} PKG_CONFIG_INSTALL_REL_LEN)
+ math(EXPR PKG_CONFIG_INSTALL_REL_LEN "${PKG_CONFIG_INSTALL_REL_LEN} - 1")
+ string(SUBSTRING ${PKG_CONFIG_INSTALL_REL} 0 ${PKG_CONFIG_INSTALL_REL_LEN} PKG_CONFIG_INSTALL_REL)
+ endif()
+ set(PKG_CONFIG_INSTALL_PREFIX "\${pcfiledir}/${PKG_CONFIG_INSTALL_REL}")
+else()
+ set(PKG_CONFIG_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
+endif()
+set(PKG_CONFIG_PC_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
diff --git a/cmake/today.cmake b/cmake/today.cmake
new file mode 100644
index 0000000..9e88801
--- /dev/null
+++ b/cmake/today.cmake
@@ -0,0 +1,11 @@
+# This script returns the current date in ISO format
+#
+# YYYY-MM-DD
+#
+MACRO (TODAY RESULT)
+ if (DEFINED ENV{SOURCE_DATE_EPOCH} AND NOT WIN32)
+ EXECUTE_PROCESS(COMMAND "date" "-u" "-d" "@$ENV{SOURCE_DATE_EPOCH}" "+%Y-%m-%d"
+ OUTPUT_VARIABLE ${RESULT} OUTPUT_STRIP_TRAILING_WHITESPACE)
+ STRING(TIMESTAMP ${RESULT} "%Y-%m-%d" UTC)
+ endif()
+ENDMACRO (TODAY)