From ec684b78851c5edbc67d14ad47ecba16ca04303e Mon Sep 17 00:00:00 2001 From: akallabeth Date: Wed, 27 Nov 2024 13:14:37 +0100 Subject: [PATCH 1/3] [cmake,format] add formatter script --- scripts/cmake-format.sh | 35 ++++++ scripts/cmake-format.yml | 245 +++++++++++++++++++++++++++++++++++++++ scripts/mingw64.cmake | 92 +++++++++++---- 3 files changed, 349 insertions(+), 23 deletions(-) create mode 100755 scripts/cmake-format.sh create mode 100644 scripts/cmake-format.yml diff --git a/scripts/cmake-format.sh b/scripts/cmake-format.sh new file mode 100755 index 000000000..1a0d62cba --- /dev/null +++ b/scripts/cmake-format.sh @@ -0,0 +1,35 @@ +#!/bin/bash -e + +SCRIPT_PATH=$(dirname "${BASH_SOURCE[0]}") +SCRIPT_PATH=$(realpath "$SCRIPT_PATH") +SRC_PATH="${SCRIPT_PATH}/.." + +FORMAT_ARG="--check" +if [ $# -ne 0 ] +then + if [ "$1" = "--help" ] || [ "$1" = "-h" ]; + then + echo "usage: $0" + echo "\t--check.-c ... run format check only, no files changed (default)" + echo "\t--format,-f ... format files in place" + echo "\t--help,-h ... print this help" + + exit 1 + fi + + if [ "$1" = "--check" ] || [ "$1" = "-c" ]; + then + FORMAT_ARG="--check" + fi + if [ "$1" = "--format" ] || [ "$1" = "-f" ]; + then + FORMAT_ARG="-i" + fi +fi + +CMAKE_FILES=$(find ${SRC_PATH} -name "*.cmake" -o -name "CMakeLists.txt") +for FILE in $CMAKE_FILES; +do + echo "processing file $FILE..." + cmake-format -c "$SCRIPT_PATH/cmake-format.yml" $FORMAT_ARG $FILE +done diff --git a/scripts/cmake-format.yml b/scripts/cmake-format.yml new file mode 100644 index 000000000..10b19ece9 --- /dev/null +++ b/scripts/cmake-format.yml @@ -0,0 +1,245 @@ +_help_parse: Options affecting listfile parsing +parse: + _help_additional_commands: + - Specify structure for custom cmake functions + additional_commands: + foo: + flags: + - BAR + - BAZ + kwargs: + HEADERS: '*' + SOURCES: '*' + DEPENDS: '*' + _help_override_spec: + - Override configurations per-command where available + override_spec: {} + _help_vartags: + - Specify variable tags. + vartags: [] + _help_proptags: + - Specify property tags. + proptags: [] +_help_format: Options affecting formatting. +format: + _help_disable: + - Disable formatting entirely, making cmake-format a no-op + disable: false + _help_line_width: + - How wide to allow formatted cmake files + line_width: 120 + _help_tab_size: + - How many spaces to tab for indent + tab_size: 2 + _help_use_tabchars: + - If true, lines are indented using tab characters (utf-8 + - 0x09) instead of space characters (utf-8 0x20). + - In cases where the layout would require a fractional tab + - character, the behavior of the fractional indentation is + - governed by + use_tabchars: false + _help_fractional_tab_policy: + - If is True, then the value of this variable + - indicates how fractional indentions are handled during + - whitespace replacement. If set to 'use-space', fractional + - indentation is left as spaces (utf-8 0x20). If set to + - '`round-up` fractional indentation is replaced with a single' + - tab character (utf-8 0x09) effectively shifting the column + - to the next tabstop + fractional_tab_policy: use-space + _help_max_subgroups_hwrap: + - If an argument group contains more than this many sub-groups + - (parg or kwarg groups) then force it to a vertical layout. + max_subgroups_hwrap: 16 + _help_max_pargs_hwrap: + - If a positional argument group contains more than this many + - arguments, then force it to a vertical layout. + max_pargs_hwrap: 6 + _help_max_rows_cmdline: + - If a cmdline positional group consumes more than this many + - lines without nesting, then invalidate the layout (and nest) + max_rows_cmdline: 2 + _help_separate_ctrl_name_with_space: + - If true, separate flow control names from their parentheses + - with a space + separate_ctrl_name_with_space: false + _help_separate_fn_name_with_space: + - If true, separate function names from parentheses with a + - space + separate_fn_name_with_space: false + _help_dangle_parens: + - If a statement is wrapped to more than one line, than dangle + - the closing parenthesis on its own line. + dangle_parens: true + _help_dangle_align: + - If the trailing parenthesis must be 'dangled' on its on + - 'line, then align it to this reference: `prefix`: the start' + - 'of the statement, `prefix-indent`: the start of the' + - 'statement, plus one indentation level, `child`: align to' + - the column of the arguments + dangle_align: prefix + _help_min_prefix_chars: + - If the statement spelling length (including space and + - parenthesis) is smaller than this amount, then force reject + - nested layouts. + min_prefix_chars: 4 + _help_max_prefix_chars: + - If the statement spelling length (including space and + - parenthesis) is larger than the tab width by more than this + - amount, then force reject un-nested layouts. + max_prefix_chars: 10 + _help_max_lines_hwrap: + - If a candidate layout is wrapped horizontally but it exceeds + - this many lines, then reject the layout. + max_lines_hwrap: 6 + _help_line_ending: + - What style line endings to use in the output. + line_ending: unix + _help_command_case: + - Format command names consistently as 'lower' or 'upper' case + command_case: canonical + _help_keyword_case: + - Format keywords consistently as 'lower' or 'upper' case + keyword_case: unchanged + _help_always_wrap: + - A list of command names which should always be wrapped + always_wrap: [] + _help_enable_sort: + - If true, the argument lists which are known to be sortable + - will be sorted lexicographicall + enable_sort: true + _help_autosort: + - If true, the parsers may infer whether or not an argument + - list is sortable (without annotation). + autosort: false + _help_require_valid_layout: + - By default, if cmake-format cannot successfully fit + - everything into the desired linewidth it will apply the + - last, most aggressive attempt that it made. If this flag is + - True, however, cmake-format will print error, exit with non- + - zero status code, and write-out nothing + require_valid_layout: false + _help_layout_passes: + - A dictionary mapping layout nodes to a list of wrap + - decisions. See the documentation for more information. + layout_passes: {} +_help_markup: Options affecting comment reflow and formatting. +markup: + _help_bullet_char: + - What character to use for bulleted lists + bullet_char: '*' + _help_enum_char: + - What character to use as punctuation after numerals in an + - enumerated list + enum_char: . + _help_first_comment_is_literal: + - If comment markup is enabled, don't reflow the first comment + - block in each listfile. Use this to preserve formatting of + - your copyright/license statements. + first_comment_is_literal: false + _help_literal_comment_pattern: + - If comment markup is enabled, don't reflow any comment block + - which matches this (regex) pattern. Default is `None` + - (disabled). + literal_comment_pattern: null + _help_fence_pattern: + - Regular expression to match preformat fences in comments + - default= ``r'^\s*([`~]{3}[`~]*)(.*)$'`` + fence_pattern: ^\s*([`~]{3}[`~]*)(.*)$ + _help_ruler_pattern: + - Regular expression to match rulers in comments default= + - '``r''^\s*[^\w\s]{3}.*[^\w\s]{3}$''``' + ruler_pattern: ^\s*[^\w\s]{3}.*[^\w\s]{3}$ + _help_explicit_trailing_pattern: + - If a comment line matches starts with this pattern then it + - is explicitly a trailing comment for the preceding argument. + - Default is '#<' + explicit_trailing_pattern: '#<' + _help_hashruler_min_length: + - If a comment line starts with at least this many consecutive + - hash characters, then don't lstrip() them off. This allows + - for lazy hash rulers where the first hash char is not + - separated by space + hashruler_min_length: 10 + _help_canonicalize_hashrulers: + - If true, then insert a space between the first hash char and + - remaining hash chars in a hash ruler, and normalize its + - length to fill the column + canonicalize_hashrulers: true + _help_enable_markup: + - enable comment markup parsing and reflow + enable_markup: false +_help_lint: Options affecting the linter +lint: + _help_disabled_codes: + - a list of lint codes to disable + disabled_codes: [] + _help_function_pattern: + - regular expression pattern describing valid function names + function_pattern: '[0-9a-z_]+' + _help_macro_pattern: + - regular expression pattern describing valid macro names + macro_pattern: '[0-9A-Z_]+' + _help_global_var_pattern: + - regular expression pattern describing valid names for + - variables with global (cache) scope + global_var_pattern: '[A-Z][0-9A-Z_]+' + _help_internal_var_pattern: + - regular expression pattern describing valid names for + - variables with global scope (but internal semantic) + internal_var_pattern: _[A-Z][0-9A-Z_]+ + _help_local_var_pattern: + - regular expression pattern describing valid names for + - variables with local scope + local_var_pattern: '[a-z][a-z0-9_]+' + _help_private_var_pattern: + - regular expression pattern describing valid names for + - privatedirectory variables + private_var_pattern: _[0-9a-z_]+ + _help_public_var_pattern: + - regular expression pattern describing valid names for public + - directory variables + public_var_pattern: '[A-Z][0-9A-Z_]+' + _help_argument_var_pattern: + - regular expression pattern describing valid names for + - function/macro arguments and loop variables. + argument_var_pattern: '[a-z][a-z0-9_]+' + _help_keyword_pattern: + - regular expression pattern describing valid names for + - keywords used in functions or macros + keyword_pattern: '[A-Z][0-9A-Z_]+' + _help_max_conditionals_custom_parser: + - In the heuristic for C0201, how many conditionals to match + - within a loop in before considering the loop a parser. + max_conditionals_custom_parser: 2 + _help_min_statement_spacing: + - Require at least this many newlines between statements + min_statement_spacing: 1 + _help_max_statement_spacing: + - Require no more than this many newlines between statements + max_statement_spacing: 2 + max_returns: 6 + max_branches: 12 + max_arguments: 5 + max_localvars: 15 + max_statements: 50 +_help_encode: Options affecting file encoding +encode: + _help_emit_byteorder_mark: + - If true, emit the unicode byte-order mark (BOM) at the start + - of the file + emit_byteorder_mark: false + _help_input_encoding: + - Specify the encoding of the input file. Defaults to utf-8 + input_encoding: utf-8 + _help_output_encoding: + - Specify the encoding of the output file. Defaults to utf-8. + - Note that cmake only claims to support utf-8 so be careful + - when using anything else + output_encoding: utf-8 +_help_misc: Miscellaneous configurations options. +misc: + _help_per_command: + - A dictionary containing any per-command configuration + - overrides. Currently only `command_case` is supported. + per_command: {} diff --git a/scripts/mingw64.cmake b/scripts/mingw64.cmake index 42612dde1..9cc1dbeea 100644 --- a/scripts/mingw64.cmake +++ b/scripts/mingw64.cmake @@ -1,35 +1,81 @@ -SET(CMAKE_SYSTEM_NAME Windows CACHE STRING "toolchain default") +set(CMAKE_SYSTEM_NAME + Windows + CACHE STRING "toolchain default") -SET(CMAKE_SYSTEM_PROCESSOR amd64 CACHE STRING "toolchain default") +set(CMAKE_SYSTEM_PROCESSOR + amd64 + CACHE STRING "toolchain default") # https://github.com/meganz/mingw-std-threads # # we simply compile with the POSIX C++ primitives, but faster is using the wrapper -SET(CMAKE_C_COMPILER /usr/bin/x86_64-w64-mingw32-gcc-posix CACHE STRING "toolchain default") -SET(CMAKE_CXX_COMPILER /usr/bin/x86_64-w64-mingw32-g++-posix CACHE STRING "toolchain default") -SET(CMAKE_RC_COMPILER_INIT /usr/bin/x86_64-w64-mingw32-windres CACHE STRING "toolchain default") -SET(CMAKE_RC_COMPILER /usr/bin/x86_64-w64-mingw32-windres CACHE STRING "toolchain default") -SET(CMAKE_AR /usr/bin/x86_64-w64-mingw32-gcc-ar-posix CACHE STRING "toolchain default") -SET(CMAKE_C_COMPILER_AR /usr/bin/x86_64-w64-mingw32-gcc-ar-posix CACHE STRING "toolchain default") -SET(CMAKE_CXX_COMPILER_AR /usr/bin/x86_64-w64-mingw32-gcc-ar-posix CACHE STRING "toolchain default") -SET(CMAKE_RANLIB /usr/bin/x86_64-w64-mingw32-gcc-ranlib-posix CACHE STRING "toolchain default") -SET(CMAKE_C_COMPILER_RANLIB /usr/bin/x86_64-w64-mingw32-gcc-ranlib-posix CACHE STRING "toolchain default") -SET(CMAKE_CXX_COMPILER_RANLIB /usr/bin/x86_64-w64-mingw32-gcc-ranlib-posix CACHE STRING "toolchain default") -SET(CMAKE_LINKER /usr/bin/x86_64-w64-mingw32-ld-posix CACHE STRING "toolchain default") -SET(CMAKE_NM /usr/bin/x86_64-w64-mingw32-nm-posix CACHE STRING "toolchain default") -SET(CMAKE_READELF /usr/bin/x86_64-w64-mingw32-readelf CACHE STRING "toolchain default") -SET(CMAKE_OBJCOPY /usr/bin/x86_64-w64-mingw32-objcopy CACHE STRING "toolchain default") -SET(CMAKE_OBJDUMP /usr/bin/x86_64-w64-mingw32-objdump CACHE STRING "toolchain default") +set(CMAKE_C_COMPILER + /usr/bin/x86_64-w64-mingw32-gcc-posix + CACHE STRING "toolchain default") +set(CMAKE_CXX_COMPILER + /usr/bin/x86_64-w64-mingw32-g++-posix + CACHE STRING "toolchain default") +set(CMAKE_RC_COMPILER_INIT + /usr/bin/x86_64-w64-mingw32-windres + CACHE STRING "toolchain default") +set(CMAKE_RC_COMPILER + /usr/bin/x86_64-w64-mingw32-windres + CACHE STRING "toolchain default") +set(CMAKE_AR + /usr/bin/x86_64-w64-mingw32-gcc-ar-posix + CACHE STRING "toolchain default") +set(CMAKE_C_COMPILER_AR + /usr/bin/x86_64-w64-mingw32-gcc-ar-posix + CACHE STRING "toolchain default") +set(CMAKE_CXX_COMPILER_AR + /usr/bin/x86_64-w64-mingw32-gcc-ar-posix + CACHE STRING "toolchain default") +set(CMAKE_RANLIB + /usr/bin/x86_64-w64-mingw32-gcc-ranlib-posix + CACHE STRING "toolchain default") +set(CMAKE_C_COMPILER_RANLIB + /usr/bin/x86_64-w64-mingw32-gcc-ranlib-posix + CACHE STRING "toolchain default") +set(CMAKE_CXX_COMPILER_RANLIB + /usr/bin/x86_64-w64-mingw32-gcc-ranlib-posix + CACHE STRING "toolchain default") +set(CMAKE_LINKER + /usr/bin/x86_64-w64-mingw32-ld-posix + CACHE STRING "toolchain default") +set(CMAKE_NM + /usr/bin/x86_64-w64-mingw32-nm-posix + CACHE STRING "toolchain default") +set(CMAKE_READELF + /usr/bin/x86_64-w64-mingw32-readelf + CACHE STRING "toolchain default") +set(CMAKE_OBJCOPY + /usr/bin/x86_64-w64-mingw32-objcopy + CACHE STRING "toolchain default") +set(CMAKE_OBJDUMP + /usr/bin/x86_64-w64-mingw32-objdump + CACHE STRING "toolchain default") -SET(CMAKE_SYSROOT /usr/x86_64-w64-mingw32 CACHE STRING "toolchain default") +set(CMAKE_SYSROOT + /usr/x86_64-w64-mingw32 + CACHE STRING "toolchain default") #set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER CACHE STRING "toolchain default") #set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY CACHE STRING "toolchain default") #set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY CACHE STRING "toolchain default") #set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY CACHE STRING "toolchain default") -set(CMAKE_WINDOWS_VERSION "WIN10" CACHE STRING "toolchain default") -set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "toolchain default") -set(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY ON CACHE BOOL "toolchain default") -set(CMAKE_VERBOSE_MAKEFILE ON CACHE BOOL "toolchain default") -set(THREADS_PREFER_PTHREAD_FLAG ON CACHE BOOL "toolchain default") +set(CMAKE_WINDOWS_VERSION + "WIN10" + CACHE STRING "toolchain default") +set(CMAKE_BUILD_TYPE + "RelWithDebInfo" + CACHE STRING "toolchain default") +set(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY + ON + CACHE BOOL "toolchain default") +set(CMAKE_VERBOSE_MAKEFILE + ON + CACHE BOOL "toolchain default") +set(THREADS_PREFER_PTHREAD_FLAG + ON + CACHE BOOL "toolchain default") From de98cde7b2ef67457216cd5417c860fda4ed9109 Mon Sep 17 00:00:00 2001 From: akallabeth Date: Wed, 27 Nov 2024 13:18:00 +0100 Subject: [PATCH 2/3] [cmake,gprof] rename configuration file --- CMakeLists.txt | 2 +- scripts/{gprof_generate.sh.cmake => gprof_generate.sh.in} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename scripts/{gprof_generate.sh.cmake => gprof_generate.sh.in} (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0dd54d379..5129ae41b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -444,7 +444,7 @@ if(ANDROID) set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH ) if (WITH_GPROF) - CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/scripts/gprof_generate.sh.cmake + CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/scripts/gprof_generate.sh.in ${PROJECT_BINARY_DIR}/scripts/gprof_generate.sh @ONLY) endif(WITH_GPROF) endif() diff --git a/scripts/gprof_generate.sh.cmake b/scripts/gprof_generate.sh.in similarity index 100% rename from scripts/gprof_generate.sh.cmake rename to scripts/gprof_generate.sh.in From faae38120c25bde2b3e1b101f942ed7b300db174 Mon Sep 17 00:00:00 2001 From: akallabeth Date: Wed, 27 Nov 2024 20:31:31 +0100 Subject: [PATCH 3/3] [cmake,format] reformat all cmake files --- CMakeCPack.cmake | 50 +- CMakeLists.txt | 715 +++++++++--------- channels/CMakeLists.txt | 158 ++-- channels/ainput/CMakeLists.txt | 4 +- channels/ainput/ChannelOptions.cmake | 18 +- channels/ainput/client/CMakeLists.txt | 9 +- channels/ainput/server/CMakeLists.txt | 8 +- channels/audin/CMakeLists.txt | 4 +- channels/audin/ChannelOptions.cmake | 20 +- channels/audin/client/CMakeLists.txt | 27 +- channels/audin/client/alsa/CMakeLists.txt | 10 +- channels/audin/client/ios/CMakeLists.txt | 52 +- channels/audin/client/mac/CMakeLists.txt | 21 +- channels/audin/client/opensles/CMakeLists.txt | 11 +- channels/audin/client/oss/CMakeLists.txt | 17 +- channels/audin/client/pulse/CMakeLists.txt | 10 +- channels/audin/client/sndio/CMakeLists.txt | 10 +- channels/audin/client/winmm/CMakeLists.txt | 9 +- channels/audin/server/CMakeLists.txt | 8 +- channels/client/CMakeLists.txt | 206 ++--- channels/cliprdr/CMakeLists.txt | 4 +- channels/cliprdr/ChannelOptions.cmake | 18 +- channels/cliprdr/client/CMakeLists.txt | 13 +- channels/cliprdr/server/CMakeLists.txt | 11 +- channels/disp/CMakeLists.txt | 6 +- channels/disp/ChannelOptions.cmake | 17 +- channels/disp/client/CMakeLists.txt | 11 +- channels/disp/server/CMakeLists.txt | 11 +- channels/drdynvc/CMakeLists.txt | 4 +- channels/drdynvc/ChannelOptions.cmake | 18 +- channels/drdynvc/client/CMakeLists.txt | 5 +- channels/drdynvc/server/CMakeLists.txt | 9 +- channels/drive/CMakeLists.txt | 3 +- channels/drive/ChannelOptions.cmake | 18 +- channels/drive/client/CMakeLists.txt | 10 +- channels/echo/CMakeLists.txt | 4 +- channels/echo/ChannelOptions.cmake | 18 +- channels/echo/client/CMakeLists.txt | 9 +- channels/echo/server/CMakeLists.txt | 8 +- channels/encomsp/CMakeLists.txt | 4 +- channels/encomsp/ChannelOptions.cmake | 18 +- channels/encomsp/client/CMakeLists.txt | 5 +- channels/encomsp/server/CMakeLists.txt | 9 +- channels/geometry/CMakeLists.txt | 2 +- channels/geometry/ChannelOptions.cmake | 17 +- channels/geometry/client/CMakeLists.txt | 9 +- channels/gfxredir/CMakeLists.txt | 8 +- channels/gfxredir/ChannelOptions.cmake | 24 +- channels/gfxredir/server/CMakeLists.txt | 11 +- channels/location/CMakeLists.txt | 4 +- channels/location/ChannelOptions.cmake | 18 +- channels/location/client/CMakeLists.txt | 8 +- channels/location/server/CMakeLists.txt | 8 +- channels/parallel/CMakeLists.txt | 2 +- channels/parallel/ChannelOptions.cmake | 36 +- channels/parallel/client/CMakeLists.txt | 8 +- channels/printer/CMakeLists.txt | 4 +- channels/printer/ChannelOptions.cmake | 50 +- channels/printer/client/CMakeLists.txt | 12 +- channels/printer/client/cups/CMakeLists.txt | 9 +- channels/printer/client/win/CMakeLists.txt | 8 +- channels/rail/CMakeLists.txt | 4 +- channels/rail/ChannelOptions.cmake | 18 +- channels/rail/client/CMakeLists.txt | 18 +- channels/rail/server/CMakeLists.txt | 11 +- channels/rdp2tcp/CMakeLists.txt | 2 +- channels/rdp2tcp/ChannelOptions.cmake | 13 +- channels/rdp2tcp/client/CMakeLists.txt | 8 +- channels/rdpdr/CMakeLists.txt | 4 +- channels/rdpdr/ChannelOptions.cmake | 18 +- channels/rdpdr/client/CMakeLists.txt | 32 +- channels/rdpdr/server/CMakeLists.txt | 9 +- channels/rdpear/CMakeLists.txt | 32 +- channels/rdpear/ChannelOptions.cmake | 18 +- channels/rdpear/client/CMakeLists.txt | 11 +- channels/rdpear/common/CMakeLists.txt | 43 +- channels/rdpear/common/test/CMakeLists.txt | 22 +- channels/rdpecam/CMakeLists.txt | 10 +- channels/rdpecam/ChannelOptions.cmake | 18 +- channels/rdpecam/client/CMakeLists.txt | 27 +- channels/rdpecam/client/v4l/CMakeLists.txt | 16 +- channels/rdpecam/server/CMakeLists.txt | 9 +- channels/rdpei/CMakeLists.txt | 6 +- channels/rdpei/ChannelOptions.cmake | 18 +- channels/rdpei/client/CMakeLists.txt | 12 +- channels/rdpei/server/CMakeLists.txt | 11 +- channels/rdpemsc/CMakeLists.txt | 2 +- channels/rdpemsc/ChannelOptions.cmake | 18 +- channels/rdpemsc/server/CMakeLists.txt | 8 +- channels/rdpgfx/CMakeLists.txt | 4 +- channels/rdpgfx/ChannelOptions.cmake | 18 +- channels/rdpgfx/client/CMakeLists.txt | 14 +- channels/rdpgfx/server/CMakeLists.txt | 11 +- channels/rdpsnd/CMakeLists.txt | 4 +- channels/rdpsnd/ChannelOptions.cmake | 18 +- channels/rdpsnd/client/CMakeLists.txt | 28 +- channels/rdpsnd/client/alsa/CMakeLists.txt | 9 +- channels/rdpsnd/client/fake/CMakeLists.txt | 9 +- channels/rdpsnd/client/ios/CMakeLists.txt | 18 +- channels/rdpsnd/client/mac/CMakeLists.txt | 13 +- .../rdpsnd/client/opensles/CMakeLists.txt | 10 +- channels/rdpsnd/client/oss/CMakeLists.txt | 16 +- channels/rdpsnd/client/pulse/CMakeLists.txt | 11 +- channels/rdpsnd/client/sndio/CMakeLists.txt | 10 +- channels/rdpsnd/client/winmm/CMakeLists.txt | 10 +- channels/rdpsnd/common/CMakeLists.txt | 7 +- channels/rdpsnd/server/CMakeLists.txt | 9 +- channels/remdesk/CMakeLists.txt | 4 +- channels/remdesk/ChannelOptions.cmake | 17 +- channels/remdesk/client/CMakeLists.txt | 9 +- channels/remdesk/common/CMakeLists.txt | 7 +- channels/remdesk/server/CMakeLists.txt | 9 +- channels/serial/CMakeLists.txt | 3 +- channels/serial/ChannelOptions.cmake | 38 +- channels/serial/client/CMakeLists.txt | 12 +- channels/server/CMakeLists.txt | 12 +- channels/smartcard/CMakeLists.txt | 2 +- channels/smartcard/ChannelOptions.cmake | 17 +- channels/smartcard/client/CMakeLists.txt | 15 +- channels/sshagent/CMakeLists.txt | 2 +- channels/sshagent/ChannelOptions.cmake | 18 +- channels/sshagent/client/CMakeLists.txt | 9 +- channels/telemetry/CMakeLists.txt | 2 +- channels/telemetry/ChannelOptions.cmake | 18 +- channels/telemetry/server/CMakeLists.txt | 8 +- channels/tsmf/CMakeLists.txt | 2 +- channels/tsmf/ChannelOptions.cmake | 26 +- channels/tsmf/client/CMakeLists.txt | 69 +- channels/tsmf/client/alsa/CMakeLists.txt | 10 +- channels/tsmf/client/ffmpeg/CMakeLists.txt | 21 +- channels/tsmf/client/gstreamer/CMakeLists.txt | 51 +- channels/tsmf/client/oss/CMakeLists.txt | 10 +- channels/tsmf/client/pulse/CMakeLists.txt | 10 +- channels/urbdrc/CMakeLists.txt | 8 +- channels/urbdrc/ChannelOptions.cmake | 31 +- channels/urbdrc/client/CMakeLists.txt | 17 +- channels/urbdrc/client/libusb/CMakeLists.txt | 13 +- channels/urbdrc/common/CMakeLists.txt | 10 +- channels/video/CMakeLists.txt | 2 +- channels/video/ChannelOptions.cmake | 18 +- channels/video/client/CMakeLists.txt | 9 +- ci/cmake-preloads/config-oss-fuzz.cmake | 48 +- ci/cmake-preloads/config-qa-static.cmake | 24 +- ci/cmake-preloads/config-qa.cmake | 64 +- .../freeRDPCore/src/main/cpp/CMakeLists.txt | 54 +- client/CMakeLists.txt | 140 ++-- client/Mac/CMakeLists.txt | 103 ++- client/Mac/ModuleOptions.cmake | 1 - client/Mac/cli/CMakeLists.txt | 88 +-- client/SDL/CMakeLists.txt | 67 +- client/SDL/SDL2/CMakeLists.txt | 40 +- client/SDL/SDL2/dialogs/CMakeLists.txt | 63 +- client/SDL/SDL2/dialogs/res/CMakeLists.txt | 15 +- client/SDL/SDL2/dialogs/test/CMakeLists.txt | 17 +- client/SDL/SDL2/man/CMakeLists.txt | 16 +- client/SDL/SDL3/CMakeLists.txt | 41 +- client/SDL/SDL3/dialogs/CMakeLists.txt | 35 +- client/SDL/SDL3/dialogs/res/CMakeLists.txt | 15 +- client/SDL/SDL3/dialogs/test/CMakeLists.txt | 18 +- client/SDL/SDL3/man/CMakeLists.txt | 16 +- client/SDL/common/CMakeLists.txt | 8 +- client/SDL/common/aad/CMakeLists.txt | 63 +- client/SDL/common/res/CMakeLists.txt | 144 ++-- client/SDL/common/test/CMakeLists.txt | 15 +- client/Sample/CMakeLists.txt | 25 +- client/Sample/ModuleOptions.cmake | 1 - client/Wayland/CMakeLists.txt | 38 +- client/Windows/CMakeLists.txt | 55 +- client/Windows/ModuleOptions.cmake | 1 - client/Windows/cli/CMakeLists.txt | 7 +- client/X11/CMakeLists.txt | 237 +++--- client/X11/ModuleOptions.cmake | 1 - client/X11/cli/CMakeLists.txt | 11 +- client/X11/man/CMakeLists.txt | 17 +- client/common/CMakeLists.txt | 57 +- client/common/man/CMakeLists.txt | 31 +- client/common/test/CMakeLists.txt | 15 +- client/iOS/CMakeLists.txt | 67 +- client/iOS/ModuleOptions.cmake | 1 - cmake/AddFuzzerTest.cmake | 26 +- cmake/AddTargetWithResourceFile.cmake | 181 ++--- cmake/CFlagsToVar.cmake | 21 +- cmake/CXXCompilerFlags.cmake | 118 ++- cmake/CheckCmakeCompat.cmake | 6 +- cmake/ClangDetectTool.cmake | 76 +- cmake/ClangFormat.cmake | 22 +- cmake/ClangTidy.cmake | 20 +- cmake/ClangToolchain.cmake | 26 +- cmake/CleaningConfigureFile.cmake | 17 +- cmake/CommonConfigOptions.cmake | 44 +- cmake/CompilerDetect.cmake | 4 +- cmake/CompilerFlags.cmake | 105 ++- cmake/ConfigOptions.cmake | 254 ++++--- cmake/ConfigOptionsiOS.cmake | 6 +- cmake/ConfigureFreeRDP.cmake | 14 +- cmake/ConfigureRPATH.cmake | 30 +- cmake/ConvertFileToHexArray.cmake | 20 +- cmake/DetectIntrinsicSupport.cmake | 57 +- cmake/DisableCompilerWarnings.cmake | 27 +- cmake/Doxygen.cmake | 40 +- cmake/EchoTarget.cmake | 335 ++++---- cmake/FindCairo.cmake | 151 ++-- cmake/FindFAAC.cmake | 5 +- cmake/FindFAAD2.cmake | 5 +- cmake/FindFFmpeg.cmake | 69 +- cmake/FindFeature.cmake | 106 +-- cmake/FindGSM.cmake | 5 +- cmake/FindJSONC.cmake | 13 +- cmake/FindKRB5.cmake | 126 ++- cmake/FindLAME.cmake | 7 +- cmake/FindMbedTLS.cmake | 38 +- cmake/FindOSS.cmake | 59 +- cmake/FindOpenH264.cmake | 53 +- cmake/FindOpenSLES.cmake | 15 +- cmake/FindPAM.cmake | 47 +- cmake/FindPCSC.cmake | 11 +- cmake/FindPCSCWinPR.cmake | 13 +- cmake/FindPixman.cmake | 6 +- cmake/FindV4L.cmake | 91 +-- cmake/FindWayland.cmake | 51 +- cmake/Findlibsystemd.cmake | 43 +- cmake/Findlibusb-1.0.cmake | 57 +- cmake/Findlodepng.cmake | 14 +- cmake/Findsoxr.cmake | 50 +- cmake/GNUInstallDirsWrapper.cmake | 28 +- cmake/GenerateManpages.cmake | 62 +- cmake/GetGitRevisionDescription.cmake | 145 ++-- cmake/InstallFreeRDPDesktop.cmake | 45 +- cmake/InstallFreeRDPMan.cmake | 84 +- cmake/JsonDetect.cmake | 82 +- cmake/LibFindMacros.cmake | 175 +++-- cmake/ListTargetProperties.cmake | 52 +- cmake/MSVCRuntime.cmake | 80 +- cmake/MergeStaticLibs.cmake | 206 ++--- cmake/PlatformDefaults.cmake | 198 ++--- cmake/PreventInSourceBuilds.cmake | 48 +- cmake/SetFreeRDPCMakeInstallDir.cmake | 10 +- cmake/ShowCMakeVars.cmake | 25 +- cmake/WarnUnmaintained.cmake | 19 +- cmake/WebView2.cmake | 53 +- cmake/ios.toolchain.cmake | 274 ++++--- cmake/pkg-config-install-prefix.cmake | 18 +- cmake/today.cmake | 20 +- .../cmake/aarch64-w64-mingw32-toolchain.cmake | 2 +- .../cmake/i686-w64-mingw32-toolchain.cmake | 2 +- .../cmake/x86_64-w64-mingw32-toolchain.cmake | 2 +- include/CMakeLists.txt | 206 +++-- libfreerdp/CMakeLists.txt | 282 ++++--- libfreerdp/cache/CMakeLists.txt | 36 +- libfreerdp/codec/CMakeLists.txt | 200 +++-- libfreerdp/codec/test/CMakeLists.txt | 23 +- libfreerdp/common/CMakeLists.txt | 10 +- libfreerdp/common/test/CMakeLists.txt | 23 +- libfreerdp/core/CMakeLists.txt | 239 +++--- libfreerdp/core/test/CMakeLists.txt | 36 +- libfreerdp/crypto/CMakeLists.txt | 47 +- libfreerdp/crypto/test/CMakeLists.txt | 21 +- libfreerdp/emu/CMakeLists.txt | 22 +- libfreerdp/gdi/CMakeLists.txt | 14 +- libfreerdp/gdi/test/CMakeLists.txt | 31 +- libfreerdp/locale/CMakeLists.txt | 92 +-- libfreerdp/locale/test/CMakeLists.txt | 38 +- libfreerdp/primitives/CMakeLists.txt | 215 +++--- libfreerdp/primitives/test/CMakeLists.txt | 38 +- libfreerdp/utils/CMakeLists.txt | 42 +- libfreerdp/utils/test/CMakeLists.txt | 20 +- packaging/windows/preload.cmake | 42 +- rdtk/CMakeLists.txt | 71 +- rdtk/include/CMakeLists.txt | 11 +- rdtk/librdtk/CMakeLists.txt | 47 +- rdtk/librdtk/test/CMakeLists.txt | 12 +- rdtk/sample/CMakeLists.txt | 6 +- rdtk/templates/CMakeLists.txt | 64 +- scripts/mingw64.cmake | 92 +-- server/CMakeLists.txt | 90 ++- server/Mac/CMakeLists.txt | 81 +- server/Mac/ModuleOptions.cmake | 1 - server/Sample/CMakeLists.txt | 43 +- server/Sample/ModuleOptions.cmake | 1 - server/Windows/CMakeLists.txt | 177 ++--- server/Windows/ModuleOptions.cmake | 1 - server/Windows/cli/CMakeLists.txt | 6 +- server/common/CMakeLists.txt | 15 +- server/proxy/CMakeLists.txt | 88 +-- server/proxy/channels/CMakeLists.txt | 15 +- server/proxy/cli/CMakeLists.txt | 2 +- server/proxy/modules/CMakeLists.txt | 10 +- .../modules/bitmap-filter/CMakeLists.txt | 22 +- server/proxy/modules/demo/CMakeLists.txt | 17 +- .../modules/dyn-channel-dump/CMakeLists.txt | 25 +- server/shadow/CMakeLists.txt | 170 ++--- server/shadow/Mac/CMakeLists.txt | 26 +- server/shadow/Win/CMakeLists.txt | 28 +- server/shadow/X11/CMakeLists.txt | 57 +- third-party/CMakeLists.txt | 10 +- uwac/CMakeLists.txt | 75 +- uwac/include/CMakeLists.txt | 10 +- uwac/libuwac/CMakeLists.txt | 63 +- uwac/templates/CMakeLists.txt | 57 +- winpr/CMakeLists.txt | 423 ++++++----- winpr/include/CMakeLists.txt | 35 +- winpr/libwinpr/CMakeLists.txt | 238 +++--- winpr/libwinpr/bcrypt/CMakeLists.txt | 1 - winpr/libwinpr/bcrypt/ModuleOptions.cmake | 2 - winpr/libwinpr/clipboard/CMakeLists.txt | 10 +- winpr/libwinpr/clipboard/ModuleOptions.cmake | 2 - winpr/libwinpr/clipboard/test/CMakeLists.txt | 28 +- winpr/libwinpr/comm/CMakeLists.txt | 56 +- winpr/libwinpr/comm/ModuleOptions.cmake | 6 +- winpr/libwinpr/comm/test/CMakeLists.txt | 31 +- winpr/libwinpr/crt/CMakeLists.txt | 35 +- winpr/libwinpr/crt/ModuleOptions.cmake | 2 - winpr/libwinpr/crt/test/CMakeLists.txt | 17 +- winpr/libwinpr/crypto/CMakeLists.txt | 39 +- winpr/libwinpr/crypto/ModuleOptions.cmake | 2 - winpr/libwinpr/crypto/test/CMakeLists.txt | 21 +- winpr/libwinpr/dsparse/CMakeLists.txt | 4 +- winpr/libwinpr/dsparse/ModuleOptions.cmake | 2 - winpr/libwinpr/dsparse/test/CMakeLists.txt | 12 +- winpr/libwinpr/environment/CMakeLists.txt | 2 +- .../libwinpr/environment/ModuleOptions.cmake | 6 +- .../libwinpr/environment/test/CMakeLists.txt | 17 +- winpr/libwinpr/error/CMakeLists.txt | 2 +- winpr/libwinpr/error/ModuleOptions.cmake | 6 +- winpr/libwinpr/error/test/CMakeLists.txt | 13 +- winpr/libwinpr/file/CMakeLists.txt | 10 +- winpr/libwinpr/file/ModuleOptions.cmake | 6 +- winpr/libwinpr/file/test/CMakeLists.txt | 91 ++- winpr/libwinpr/handle/CMakeLists.txt | 1 - winpr/libwinpr/handle/ModuleOptions.cmake | 6 +- winpr/libwinpr/input/CMakeLists.txt | 5 +- winpr/libwinpr/input/ModuleOptions.cmake | 2 - winpr/libwinpr/interlocked/CMakeLists.txt | 2 +- .../libwinpr/interlocked/ModuleOptions.cmake | 6 +- .../libwinpr/interlocked/test/CMakeLists.txt | 15 +- winpr/libwinpr/io/CMakeLists.txt | 2 +- winpr/libwinpr/io/ModuleOptions.cmake | 6 +- winpr/libwinpr/io/test/CMakeLists.txt | 12 +- winpr/libwinpr/library/CMakeLists.txt | 2 +- winpr/libwinpr/library/ModuleOptions.cmake | 6 +- winpr/libwinpr/library/test/CMakeLists.txt | 15 +- .../library/test/TestLibraryB/CMakeLists.txt | 1 - winpr/libwinpr/memory/CMakeLists.txt | 2 +- winpr/libwinpr/memory/ModuleOptions.cmake | 6 +- winpr/libwinpr/memory/test/CMakeLists.txt | 12 +- winpr/libwinpr/ncrypt/CMakeLists.txt | 18 +- winpr/libwinpr/ncrypt/ModuleOptions.cmake | 2 - winpr/libwinpr/ncrypt/test/CMakeLists.txt | 15 +- winpr/libwinpr/nt/CMakeLists.txt | 6 +- winpr/libwinpr/nt/ModuleOptions.cmake | 1 - winpr/libwinpr/nt/test/CMakeLists.txt | 13 +- winpr/libwinpr/path/CMakeLists.txt | 12 +- winpr/libwinpr/path/ModuleOptions.cmake | 6 +- winpr/libwinpr/path/test/CMakeLists.txt | 58 +- winpr/libwinpr/pipe/CMakeLists.txt | 2 +- winpr/libwinpr/pipe/ModuleOptions.cmake | 6 +- winpr/libwinpr/pipe/test/CMakeLists.txt | 14 +- winpr/libwinpr/pool/CMakeLists.txt | 27 +- winpr/libwinpr/pool/ModuleOptions.cmake | 6 +- winpr/libwinpr/pool/test/CMakeLists.txt | 17 +- winpr/libwinpr/registry/CMakeLists.txt | 5 +- winpr/libwinpr/registry/ModuleOptions.cmake | 6 +- winpr/libwinpr/rpc/CMakeLists.txt | 6 +- winpr/libwinpr/rpc/ModuleOptions.cmake | 2 - winpr/libwinpr/security/CMakeLists.txt | 2 +- winpr/libwinpr/security/ModuleOptions.cmake | 5 +- winpr/libwinpr/security/test/CMakeLists.txt | 12 +- winpr/libwinpr/shell/CMakeLists.txt | 4 +- winpr/libwinpr/shell/ModuleOptions.cmake | 2 - winpr/libwinpr/smartcard/CMakeLists.txt | 28 +- winpr/libwinpr/smartcard/ModuleOptions.cmake | 2 - winpr/libwinpr/smartcard/test/CMakeLists.txt | 13 +- winpr/libwinpr/sspi/CMakeLists.txt | 141 ++-- winpr/libwinpr/sspi/ModuleOptions.cmake | 2 - winpr/libwinpr/sspi/test/CMakeLists.txt | 24 +- winpr/libwinpr/sspicli/ModuleOptions.cmake | 2 - winpr/libwinpr/synch/CMakeLists.txt | 33 +- winpr/libwinpr/synch/ModuleOptions.cmake | 6 +- winpr/libwinpr/synch/test/CMakeLists.txt | 35 +- winpr/libwinpr/sysinfo/CMakeLists.txt | 7 +- winpr/libwinpr/sysinfo/ModuleOptions.cmake | 6 +- .../sysinfo/cpufeatures/CMakeLists.txt | 1 - winpr/libwinpr/sysinfo/test/CMakeLists.txt | 19 +- winpr/libwinpr/thread/CMakeLists.txt | 19 +- winpr/libwinpr/thread/ModuleOptions.cmake | 6 +- winpr/libwinpr/thread/test/CMakeLists.txt | 14 +- winpr/libwinpr/timezone/CMakeLists.txt | 56 +- winpr/libwinpr/timezone/ModuleOptions.cmake | 6 +- winpr/libwinpr/timezone/utils/CMakeLists.txt | 34 +- winpr/libwinpr/utils/CMakeLists.txt | 299 ++++---- winpr/libwinpr/utils/ModuleOptions.cmake | 2 - winpr/libwinpr/utils/test/CMakeLists.txt | 59 +- winpr/libwinpr/winsock/CMakeLists.txt | 2 +- winpr/libwinpr/winsock/ModuleOptions.cmake | 1 - winpr/libwinpr/wtsapi/CMakeLists.txt | 10 +- winpr/libwinpr/wtsapi/ModuleOptions.cmake | 6 +- winpr/libwinpr/wtsapi/test/CMakeLists.txt | 66 +- winpr/test/CMakeLists.txt | 9 +- winpr/tools/CMakeLists.txt | 109 +-- winpr/tools/hash-cli/CMakeLists.txt | 5 +- winpr/tools/makecert-cli/CMakeLists.txt | 5 +- winpr/tools/makecert/CMakeLists.txt | 10 +- 402 files changed, 6523 insertions(+), 7808 deletions(-) diff --git a/CMakeCPack.cmake b/CMakeCPack.cmake index b53e30aa1..d28454ff2 100644 --- a/CMakeCPack.cmake +++ b/CMakeCPack.cmake @@ -1,4 +1,3 @@ - # Generate .txt license file for CPack (PackageMaker requires a file extension) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/LICENSE ${CMAKE_CURRENT_BINARY_DIR}/LICENSE.txt @ONLY) @@ -6,28 +5,28 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/LICENSE ${CMAKE_CURRENT_BINARY_DIR}/L # If c++ macros/defines are set __cplusplus is also set which causes # problems when compiling freerdp/jni. To prevent this problem we set the macros to "". -if (ANDROID AND CMAKE_EXTRA_GENERATOR STREQUAL "Eclipse CDT4") - set(CMAKE_EXTRA_GENERATOR_CXX_SYSTEM_DEFINED_MACROS "") - message(STATUS "Disabled CXX system defines for eclipse (workaround).") +if(ANDROID AND CMAKE_EXTRA_GENERATOR STREQUAL "Eclipse CDT4") + set(CMAKE_EXTRA_GENERATOR_CXX_SYSTEM_DEFINED_MACROS "") + message(STATUS "Disabled CXX system defines for eclipse (workaround).") endif() set(CPACK_SOURCE_IGNORE_FILES "/\\\\.git/;/\\\\.gitignore;/CMakeCache.txt") if(NOT WIN32) - if(APPLE AND (NOT IOS)) + if(APPLE AND (NOT IOS)) - if(WITH_SERVER) - set(CPACK_PACKAGE_EXECUTABLES ${CPACK_PACKAGE_EXECUTABLES} "mfreerdp-server") - endif() - endif() - - if(WITH_X11) - set(CPACK_PACKAGE_EXECUTABLES "xfreerdp") - - if(WITH_SERVER) - set(CPACK_PACKAGE_EXECUTABLES ${CPACK_PACKAGE_EXECUTABLES} "xfreerdp-server") - endif() + if(WITH_SERVER) + set(CPACK_PACKAGE_EXECUTABLES ${CPACK_PACKAGE_EXECUTABLES} "mfreerdp-server") endif() + endif() + + if(WITH_X11) + set(CPACK_PACKAGE_EXECUTABLES "xfreerdp") + + if(WITH_SERVER) + set(CPACK_PACKAGE_EXECUTABLES ${CPACK_PACKAGE_EXECUTABLES} "xfreerdp-server") + endif() + endif() endif() set(CPACK_SYSTEM_NAME "${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}") @@ -43,7 +42,7 @@ set(CPACK_PACKAGE_VERSION ${FREERDP_VERSION_FULL}) set(CPACK_PACKAGE_VERSION_MAJOR ${FREERDP_VERSION_MAJOR}) set(CPACK_PACKAGE_VERSION_MINOR ${FREERDP_VERSION_MINOR}) set(CPACK_PACKAGE_VERSION_PATCH ${FREERDP_VERSION_REVISION}) -SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "FreeRDP: A Remote Desktop Protocol Implementation") +set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "FreeRDP: A Remote Desktop Protocol Implementation") set(CPACK_PACKAGE_CONTACT "Marc-Andre Moreau") set(CPACK_DEBIAN_PACKAGE_MAINTAINER "marcandre.moreau@gmail.com") @@ -61,16 +60,14 @@ set(CPACK_NSIS_MUI_UNICON "${PROJECT_SOURCE_DIR}/resource\\\\FreeRDP_Icon_96px.i set(CPACK_COMPONENTS_ALL client server libraries headers symbols tools) if(MSVC) - string(FIND ${CMAKE_MSVC_RUNTIME_LIBRARY} "DLL" IS_SHARED) + string(FIND ${CMAKE_MSVC_RUNTIME_LIBRARY} "DLL" IS_SHARED) - if(NOT IS_SHARED STREQUAL "-1") - set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP TRUE) - include(InstallRequiredSystemLibraries) + if(NOT IS_SHARED STREQUAL "-1") + set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP TRUE) + include(InstallRequiredSystemLibraries) - install(PROGRAMS ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS} - DESTINATION ${CMAKE_INSTALL_BINDIR} - COMPONENT libraries) - endif() + install(PROGRAMS ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS} DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT libraries) + endif() endif() set(CPACK_COMPONENT_CLIENT_DISPLAY_NAME "Client") @@ -95,8 +92,7 @@ set(CPACK_COMPONENT_GROUP_RUNTIME_DESCRIPTION "Runtime") set(CPACK_COMPONENT_GROUP_APPLICATIONS_DESCRIPTION "Applications") set(CPACK_COMPONENT_GROUP_DEVELOPMENT_DESCRIPTION "Development") -configure_file("${PROJECT_SOURCE_DIR}/CMakeCPackOptions.cmake.in" - "${PROJECT_BINARY_DIR}/CMakeCPackOptions.cmake" @ONLY) +configure_file("${PROJECT_SOURCE_DIR}/CMakeCPackOptions.cmake.in" "${PROJECT_BINARY_DIR}/CMakeCPackOptions.cmake" @ONLY) set(CPACK_PROJECT_CONFIG_FILE "${PROJECT_BINARY_DIR}/CMakeCPackOptions.cmake") include(CPack) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5129ae41b..11700a75f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,44 +21,40 @@ cmake_minimum_required(VERSION 3.13) if(POLICY CMP0091) - cmake_policy(SET CMP0091 NEW) + cmake_policy(SET CMP0091 NEW) endif() -project(FreeRDP - LANGUAGES C -) +project(FreeRDP LANGUAGES C) set(CMAKE_C_STANDARD 11) set(CMAKE_C_STANDARD_REQUIRED ON) set(CMAKE_C_EXTENSIONS ON) -add_custom_target(fuzzers - COMMENT "Build fuzzers" -) +add_custom_target(fuzzers COMMENT "Build fuzzers") if(NOT DEFINED VENDOR) - set(VENDOR "FreeRDP" CACHE STRING "FreeRDP package vendor") + set(VENDOR "FreeRDP" CACHE STRING "FreeRDP package vendor") endif() if(NOT DEFINED PRODUCT) - set(PRODUCT "FreeRDP" CACHE STRING "FreeRDP package name") + set(PRODUCT "FreeRDP" CACHE STRING "FreeRDP package name") endif() if(NOT DEFINED FREERDP_VENDOR) - set(FREERDP_VENDOR 1) + set(FREERDP_VENDOR 1) endif() -if (NOT WIN32 AND NOT ANDROID) - if (APPLE) - set(OPT_DEFAULT_VAL OFF) - else() - set(OPT_DEFAULT_VAL ON) - endif() - option(WITH_X11 "build X11 client/server" ${OPT_DEFAULT_VAL}) +if(NOT WIN32 AND NOT ANDROID) + if(APPLE) + set(OPT_DEFAULT_VAL OFF) + else() + set(OPT_DEFAULT_VAL ON) + endif() + option(WITH_X11 "build X11 client/server" ${OPT_DEFAULT_VAL}) endif() # Enable coverity related pragma definitions -if (COVERITY_BUILD) - add_compile_definitions(COVERITY_BUILD) +if(COVERITY_BUILD) + add_compile_definitions(COVERITY_BUILD) endif() # Include our extra modules @@ -69,7 +65,7 @@ include(CheckCmakeCompat) # Include cmake modules if(WITH_CLANG_FORMAT) - include(ClangFormat) + include(ClangFormat) endif() include(CompilerFlags) @@ -93,22 +89,22 @@ include(Doxygen) # Soname versioning set(BUILD_NUMBER 0) -if ($ENV{BUILD_NUMBER}) - set(BUILD_NUMBER $ENV{BUILD_NUMBER}) +if($ENV{BUILD_NUMBER}) + set(BUILD_NUMBER $ENV{BUILD_NUMBER}) endif() set(VERSION_REGEX "^(.*)([0-9]+)\\.([0-9]+)\\.([0-9]+)-?(.*)") set(RAW_VERSION_STRING "3.9.1-dev0") if(EXISTS "${PROJECT_SOURCE_DIR}/.source_tag") - file(READ ${PROJECT_SOURCE_DIR}/.source_tag RAW_VERSION_STRING) + file(READ ${PROJECT_SOURCE_DIR}/.source_tag RAW_VERSION_STRING) elseif(USE_VERSION_FROM_GIT_TAG) - git_get_exact_tag(_GIT_TAG --tags --always) - if (NOT ${_GIT_TAG} STREQUAL "n/a") - string(REGEX MATCH ${VERSION_REGEX} FOUND_TAG "${_GIT_TAG}") - if (FOUND_TAG) - set(RAW_VERSION_STRING ${_GIT_TAG}) - endif() - endif() + git_get_exact_tag(_GIT_TAG --tags --always) + if(NOT ${_GIT_TAG} STREQUAL "n/a") + string(REGEX MATCH ${VERSION_REGEX} FOUND_TAG "${_GIT_TAG}") + if(FOUND_TAG) + set(RAW_VERSION_STRING ${_GIT_TAG}) + endif() + endif() endif() string(STRIP ${RAW_VERSION_STRING} RAW_VERSION_STRING) @@ -119,27 +115,27 @@ string(REGEX REPLACE "${VERSION_REGEX}" "\\5" FREERDP_VERSION_SUFFIX "${RAW_VERS set(FREERDP_API_VERSION "${FREERDP_VERSION_MAJOR}") set(FREERDP_VERSION "${FREERDP_VERSION_MAJOR}.${FREERDP_VERSION_MINOR}.${FREERDP_VERSION_REVISION}") -if (FREERDP_VERSION_SUFFIX) - set(FREERDP_VERSION_FULL "${FREERDP_VERSION}-${FREERDP_VERSION_SUFFIX}") +if(FREERDP_VERSION_SUFFIX) + set(FREERDP_VERSION_FULL "${FREERDP_VERSION}-${FREERDP_VERSION_SUFFIX}") else() - set(FREERDP_VERSION_FULL "${FREERDP_VERSION}") + set(FREERDP_VERSION_FULL "${FREERDP_VERSION}") endif() message("FREERDP_VERSION=${FREERDP_VERSION_FULL}") -if(EXISTS "${PROJECT_SOURCE_DIR}/.source_version" ) - file(READ ${PROJECT_SOURCE_DIR}/.source_version GIT_REVISION) +if(EXISTS "${PROJECT_SOURCE_DIR}/.source_version") + file(READ ${PROJECT_SOURCE_DIR}/.source_version GIT_REVISION) string(STRIP ${GIT_REVISION} GIT_REVISION) elseif(USE_VERSION_FROM_GIT_TAG) - git_get_exact_tag(GIT_REVISION --tags --always) + git_get_exact_tag(GIT_REVISION --tags --always) - if (${GIT_REVISION} STREQUAL "n/a") - git_rev_parse (GIT_REVISION --short) - endif() + if(${GIT_REVISION} STREQUAL "n/a") + git_rev_parse(GIT_REVISION --short) + endif() endif() -if (NOT GIT_REVISION) - set(GIT_REVISION ${FREERDP_VERSION}) +if(NOT GIT_REVISION) + set(GIT_REVISION ${FREERDP_VERSION}) endif() message(STATUS "Git Revision ${GIT_REVISION}") @@ -151,43 +147,43 @@ set(FREERDP_MAJOR_DIR "freerdp${FREERDP_VERSION_MAJOR}") set(FREERDP_INCLUDE_DIR "include/${FREERDP_MAJOR_DIR}/") option(WITH_SMARTCARD_EMULATE "Emulate smartcards instead of redirecting readers" ON) -if (WITH_SMARTCARD_EMULATE) - add_definitions(-DWITH_SMARTCARD_EMULATE) - find_package(ZLIB REQUIRED) +if(WITH_SMARTCARD_EMULATE) + add_definitions(-DWITH_SMARTCARD_EMULATE) + find_package(ZLIB REQUIRED) endif() option(WITH_FREERDP_DEPRECATED "Build FreeRDP deprecated symbols" OFF) -if (WITH_FREERDP_DEPRECATED) - add_definitions(-DWITH_FREERDP_DEPRECATED) +if(WITH_FREERDP_DEPRECATED) + add_definitions(-DWITH_FREERDP_DEPRECATED) endif() option(WITH_FREERDP_DEPRECATED_COMMANDLINE "Build FreeRDP deprecated command line options" OFF) -if (WITH_FREERDP_DEPRECATED_COMMANDLINE) - add_definitions(-DWITH_FREERDP_DEPRECATED_COMMANDLINE) +if(WITH_FREERDP_DEPRECATED_COMMANDLINE) + add_definitions(-DWITH_FREERDP_DEPRECATED_COMMANDLINE) endif() # Make paths absolute -if (CMAKE_INSTALL_PREFIX) - get_filename_component(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" ABSOLUTE) +if(CMAKE_INSTALL_PREFIX) + get_filename_component(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" ABSOLUTE) endif() -if (FREERDP_EXTERNAL_PATH) - get_filename_component (FREERDP_EXTERNAL_PATH "${FREERDP_EXTERNAL_PATH}" ABSOLUTE) +if(FREERDP_EXTERNAL_PATH) + get_filename_component(FREERDP_EXTERNAL_PATH "${FREERDP_EXTERNAL_PATH}" ABSOLUTE) endif() # Allow to search the host machine for git/ccache if(CMAKE_CROSSCOMPILING) - SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH) + set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH) endif(CMAKE_CROSSCOMPILING) find_program(CCACHE ccache) if(CCACHE AND WITH_CCACHE) - if(NOT DEFINED CMAKE_C_COMPILER_LAUNCHER) - SET(CMAKE_C_COMPILER_LAUNCHER ${CCACHE}) - endif(NOT DEFINED CMAKE_C_COMPILER_LAUNCHER) + if(NOT DEFINED CMAKE_C_COMPILER_LAUNCHER) + set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE}) + endif(NOT DEFINED CMAKE_C_COMPILER_LAUNCHER) endif(CCACHE AND WITH_CCACHE) if(CMAKE_CROSSCOMPILING) - SET (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY) + set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY) endif(CMAKE_CROSSCOMPILING) # /Allow to search the host machine for git/ccache @@ -196,273 +192,286 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON) option(CTEST_OUTPUT_ON_FAILURE ON "show verbose output on CTest failures") if(BUILD_TESTING_INTERNAL) - set(EXPORT_ALL_SYMBOLS ON CACHE BOOL "testing default" FORCE) - add_definitions(-DBUILD_TESTING_INTERNAL) + set(EXPORT_ALL_SYMBOLS ON CACHE BOOL "testing default" FORCE) + add_definitions(-DBUILD_TESTING_INTERNAL) elseif(BUILD_TESTING) - set(EXPORT_ALL_SYMBOLS OFF CACHE BOOL "testing default" FORCE) + set(EXPORT_ALL_SYMBOLS OFF CACHE BOOL "testing default" FORCE) else() - option(EXPORT_ALL_SYMBOLS "Export all symbols form library" OFF) + option(EXPORT_ALL_SYMBOLS "Export all symbols form library" OFF) endif() -if (EXPORT_ALL_SYMBOLS) - # set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) - add_definitions(-DEXPORT_ALL_SYMBOLS) +if(EXPORT_ALL_SYMBOLS) + # set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) + add_definitions(-DEXPORT_ALL_SYMBOLS) endif(EXPORT_ALL_SYMBOLS) # Compiler-specific flags if(CMAKE_COMPILER_IS_GNUCC) - if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64" OR CMAKE_SYSTEM_PROCESSOR MATCHES "i686") - CHECK_SYMBOL_EXISTS(__x86_64__ "" IS_X86_64) - if(IS_X86_64) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC") - else() - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=i686") - endif() - endif() + if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64" OR CMAKE_SYSTEM_PROCESSOR MATCHES "i686") + check_symbol_exists(__x86_64__ "" IS_X86_64) + if(IS_X86_64) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC") + else() + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=i686") + endif() + endif() - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall") - if(NOT EXPORT_ALL_SYMBOLS) - message(STATUS "GCC default symbol visibility: hidden") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden") - endif() - CHECK_C_COMPILER_FLAG (-Wimplicit-function-declaration Wimplicit-function-declaration) - if(Wimplicit-function-declaration) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wimplicit-function-declaration") - endif() + if(NOT EXPORT_ALL_SYMBOLS) + message(STATUS "GCC default symbol visibility: hidden") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden") + endif() + check_c_compiler_flag(-Wimplicit-function-declaration Wimplicit-function-declaration) + if(Wimplicit-function-declaration) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wimplicit-function-declaration") + endif() - if (NOT OPENBSD) - CHECK_C_COMPILER_FLAG (-Wredundant-decls Wredundant-decls) - if(Wredundant-decls) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wredundant-decls") - endif() - endif() - if(CMAKE_BUILD_TYPE STREQUAL "Release") - add_definitions(-DNDEBUG) - else() - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g") - endif() + if(NOT OPENBSD) + check_c_compiler_flag(-Wredundant-decls Wredundant-decls) + if(Wredundant-decls) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wredundant-decls") + endif() + endif() + if(CMAKE_BUILD_TYPE STREQUAL "Release") + add_definitions(-DNDEBUG) + else() + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g") + endif() endif() set(THREAD_PREFER_PTHREAD_FLAG TRUE) if(NOT IOS) - find_package(Threads REQUIRED) + find_package(Threads REQUIRED) endif() # Enable address sanitizer, where supported and when required if(CMAKE_COMPILER_IS_CLANG OR CMAKE_COMPILER_IS_GNUCC) - set(CMAKE_REQUIRED_LINK_OPTIONS_SAVED ${CMAKE_REQUIRED_LINK_OPTIONS}) - file(WRITE ${PROJECT_BINARY_DIR}/foo.txt "") - if(WITH_SANITIZE_ADDRESS) - list(APPEND CMAKE_REQUIRED_LINK_OPTIONS "-fsanitize=address") - CHECK_C_COMPILER_FLAG ("-fsanitize=address" fsanitize-address) - CHECK_C_COMPILER_FLAG ("-fsanitize-blacklist=${PROJECT_BINARY_DIR}/foo.txt" fsanitize-blacklist) - CHECK_C_COMPILER_FLAG ("-fsanitize-address-use-after-scope" fsanitize-address-use-after-scope) + set(CMAKE_REQUIRED_LINK_OPTIONS_SAVED ${CMAKE_REQUIRED_LINK_OPTIONS}) + file(WRITE ${PROJECT_BINARY_DIR}/foo.txt "") + if(WITH_SANITIZE_ADDRESS) + list(APPEND CMAKE_REQUIRED_LINK_OPTIONS "-fsanitize=address") + check_c_compiler_flag("-fsanitize=address" fsanitize-address) + check_c_compiler_flag("-fsanitize-blacklist=${PROJECT_BINARY_DIR}/foo.txt" fsanitize-blacklist) + check_c_compiler_flag("-fsanitize-address-use-after-scope" fsanitize-address-use-after-scope) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address") - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fsanitize=address") - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fsanitize=address") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address") - if(fsanitize-blacklist) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize-blacklist=${PROJECT_SOURCE_DIR}/scripts/blacklist-address-sanitizer.txt") - endif(fsanitize-blacklist) + if(fsanitize-blacklist) + set(CMAKE_C_FLAGS + "${CMAKE_C_FLAGS} -fsanitize-blacklist=${PROJECT_SOURCE_DIR}/scripts/blacklist-address-sanitizer.txt" + ) + endif(fsanitize-blacklist) - if(fsanitize-address-use-after-scope) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize-address-use-after-scope") - endif(fsanitize-address-use-after-scope) - elseif(WITH_SANITIZE_MEMORY) - list(APPEND CMAKE_REQUIRED_LINK_OPTIONS "-fsanitize=memory") - CHECK_C_COMPILER_FLAG ("-fsanitize=memory" fsanitize-memory) - CHECK_C_COMPILER_FLAG ("-fsanitize-blacklist=${PROJECT_BINARY_DIR}/foo.txt" fsanitize-blacklist) - CHECK_C_COMPILER_FLAG ("-fsanitize-memory-use-after-dtor" fsanitize-memory-use-after-dtor) - CHECK_C_COMPILER_FLAG ("-fsanitize-memory-track-origins" fsanitize-memory-track-origins) + if(fsanitize-address-use-after-scope) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize-address-use-after-scope") + endif(fsanitize-address-use-after-scope) + elseif(WITH_SANITIZE_MEMORY) + list(APPEND CMAKE_REQUIRED_LINK_OPTIONS "-fsanitize=memory") + check_c_compiler_flag("-fsanitize=memory" fsanitize-memory) + check_c_compiler_flag("-fsanitize-blacklist=${PROJECT_BINARY_DIR}/foo.txt" fsanitize-blacklist) + check_c_compiler_flag("-fsanitize-memory-use-after-dtor" fsanitize-memory-use-after-dtor) + check_c_compiler_flag("-fsanitize-memory-track-origins" fsanitize-memory-track-origins) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=memory") - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fsanitize=memory") - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=memory") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=memory") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fsanitize=memory") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=memory") - if(fsanitize-blacklist) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize-blacklist=${PROJECT_SOURCE_DIR}/scripts/blacklist-memory-sanitizer.txt") - endif(fsanitize-blacklist) + if(fsanitize-blacklist) + set(CMAKE_C_FLAGS + "${CMAKE_C_FLAGS} -fsanitize-blacklist=${PROJECT_SOURCE_DIR}/scripts/blacklist-memory-sanitizer.txt" + ) + endif(fsanitize-blacklist) - if (fsanitize-memory-use-after-dtor) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize-memory-use-after-dtor") - endif(fsanitize-memory-use-after-dtor) + if(fsanitize-memory-use-after-dtor) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize-memory-use-after-dtor") + endif(fsanitize-memory-use-after-dtor) - if (fsanitize-memory-track-origins) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize-memory-track-origins") - endif(fsanitize-memory-track-origins) - elseif(WITH_SANITIZE_THREAD) - list(APPEND CMAKE_REQUIRED_LINK_OPTIONS "-fsanitize=thread") - CHECK_C_COMPILER_FLAG ("-fsanitize=thread" fsanitize-thread) - CHECK_C_COMPILER_FLAG ("-fsanitize-blacklist=${PROJECT_BINARY_DIR}/foo.txt" fsanitize-blacklist) + if(fsanitize-memory-track-origins) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize-memory-track-origins") + endif(fsanitize-memory-track-origins) + elseif(WITH_SANITIZE_THREAD) + list(APPEND CMAKE_REQUIRED_LINK_OPTIONS "-fsanitize=thread") + check_c_compiler_flag("-fsanitize=thread" fsanitize-thread) + check_c_compiler_flag("-fsanitize-blacklist=${PROJECT_BINARY_DIR}/foo.txt" fsanitize-blacklist) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=thread") - if(fsanitize-blacklist) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize-blacklist=${PROJECT_SOURCE_DIR}/scripts/blacklist-thread-sanitizer.txt") - endif(fsanitize-blacklist) - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fsanitize=thread") - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=thread") - endif() + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=thread") + if(fsanitize-blacklist) + set(CMAKE_C_FLAGS + "${CMAKE_C_FLAGS} -fsanitize-blacklist=${PROJECT_SOURCE_DIR}/scripts/blacklist-thread-sanitizer.txt" + ) + endif(fsanitize-blacklist) + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fsanitize=thread") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=thread") + endif() - file(REMOVE ${PROJECT_BINARY_DIR}/foo.txt) - set(CMAKE_REQUIRED_LINK_OPTIONS ${CMAKE_REQUIRED_LINK_OPTIONS_SAVED}) + file(REMOVE ${PROJECT_BINARY_DIR}/foo.txt) + set(CMAKE_REQUIRED_LINK_OPTIONS ${CMAKE_REQUIRED_LINK_OPTIONS_SAVED}) - if (WITH_NO_UNDEFINED) - CHECK_C_COMPILER_FLAG (-Wl,--no-undefined no-undefined) + if(WITH_NO_UNDEFINED) + check_c_compiler_flag(-Wl,--no-undefined no-undefined) - if(no-undefined) - SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--no-undefined" ) - SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined" ) - endif() - endif() + if(no-undefined) + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--no-undefined") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined") + endif() + endif() endif() if(MSVC) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Gd") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Gd") - set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}) - set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}) + set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}) + set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}) - if(CMAKE_BUILD_TYPE STREQUAL "Release") - else() - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Zi") - endif() + if(CMAKE_BUILD_TYPE STREQUAL "Release") - add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE) + else() + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Zi") + endif() + + add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE) endif() if(ANDROID) - # workaround for https://github.com/android-ndk/ndk/issues/243 - string(REPLACE "-g " "" CMAKE_C_FLAGS ${CMAKE_C_FLAGS}) - set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g") + # workaround for https://github.com/android-ndk/ndk/issues/243 + string(REPLACE "-g " "" CMAKE_C_FLAGS ${CMAKE_C_FLAGS}) + set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g") endif() if(WIN32) - add_definitions(-DUNICODE -D_UNICODE) - add_definitions(-D_CRT_SECURE_NO_WARNINGS) - add_definitions(-DWIN32_LEAN_AND_MEAN) - add_definitions(-D_WINSOCK_DEPRECATED_NO_WARNINGS) + add_definitions(-DUNICODE -D_UNICODE) + add_definitions(-D_CRT_SECURE_NO_WARNINGS) + add_definitions(-DWIN32_LEAN_AND_MEAN) + add_definitions(-D_WINSOCK_DEPRECATED_NO_WARNINGS) - set(CMAKE_DL_LIBS "") - set(CMAKE_USE_RELATIVE_PATH ON) - string(TIMESTAMP RC_VERSION_YEAR "%Y") + set(CMAKE_DL_LIBS "") + set(CMAKE_USE_RELATIVE_PATH ON) + string(TIMESTAMP RC_VERSION_YEAR "%Y") - if(NOT DEFINED CMAKE_WINDOWS_VERSION) - set(CMAKE_WINDOWS_VERSION "WIN7") - endif() + if(NOT DEFINED CMAKE_WINDOWS_VERSION) + set(CMAKE_WINDOWS_VERSION "WIN7") + endif() - if(CMAKE_WINDOWS_VERSION STREQUAL "WINXP") - add_definitions(-DWINVER=0x0501 -D_WIN32_WINNT=0x0501) - elseif(CMAKE_WINDOWS_VERSION STREQUAL "WIN7") - add_definitions(-DWINVER=0x0601 -D_WIN32_WINNT=0x0601) - elseif(CMAKE_WINDOWS_VERSION STREQUAL "WIN8") - add_definitions(-DWINVER=0x0602 -D_WIN32_WINNT=0x0602) - elseif(CMAKE_WINDOWS_VERSION STREQUAL "WIN10") - add_definitions(-DWINVER=0x0A00 -D_WIN32_WINNT=0x0A00) - endif() + if(CMAKE_WINDOWS_VERSION STREQUAL "WINXP") + add_definitions(-DWINVER=0x0501 -D_WIN32_WINNT=0x0501) + elseif(CMAKE_WINDOWS_VERSION STREQUAL "WIN7") + add_definitions(-DWINVER=0x0601 -D_WIN32_WINNT=0x0601) + elseif(CMAKE_WINDOWS_VERSION STREQUAL "WIN8") + add_definitions(-DWINVER=0x0602 -D_WIN32_WINNT=0x0602) + elseif(CMAKE_WINDOWS_VERSION STREQUAL "WIN10") + add_definitions(-DWINVER=0x0A00 -D_WIN32_WINNT=0x0A00) + endif() - # Set product and vendor for dll and exe version information. - set(RC_VERSION_VENDOR ${VENDOR}) - set(RC_VERSION_PRODUCT ${PRODUCT}) - set(RC_VERSION_PATCH ${BUILD_NUMBER}) - set(RC_VERSION_DESCRIPTION "${FREERDP_VERSION_FULL} ${GIT_REVISION} ${CMAKE_WINDOWS_VERSION} ${CMAKE_SYSTEM_PROCESSOR}") + # Set product and vendor for dll and exe version information. + set(RC_VERSION_VENDOR ${VENDOR}) + set(RC_VERSION_PRODUCT ${PRODUCT}) + set(RC_VERSION_PATCH ${BUILD_NUMBER}) + set(RC_VERSION_DESCRIPTION + "${FREERDP_VERSION_FULL} ${GIT_REVISION} ${CMAKE_WINDOWS_VERSION} ${CMAKE_SYSTEM_PROCESSOR}" + ) - if (FREERDP_EXTERNAL_SSL_PATH) - set(OPENSSL_ROOT_DIR ${FREERDP_EXTERNAL_SSL_PATH}) - endif() + if(FREERDP_EXTERNAL_SSL_PATH) + set(OPENSSL_ROOT_DIR ${FREERDP_EXTERNAL_SSL_PATH}) + endif() endif() add_definitions(-DFREERDP_EXPORTS) # Mac OS X if(APPLE) - if(IOS) - if (NOT FREERDP_IOS_EXTERNAL_SSL_PATH) - message(STATUS "FREERDP_IOS_EXTERNAL_SSL_PATH not set! Required if openssl is not found in the iOS SDK (which usually isn't") - endif() - set(CMAKE_FIND_ROOT_PATH ${CMAKE_FIND_ROOT_PATH} ${FREERDP_IOS_EXTERNAL_SSL_PATH}) - set_property(GLOBAL PROPERTY XCODE_ATTRIBUTE_SKIP_INSTALL YES) - endif(IOS) + if(IOS) + if(NOT FREERDP_IOS_EXTERNAL_SSL_PATH) + message( + STATUS + "FREERDP_IOS_EXTERNAL_SSL_PATH not set! Required if openssl is not found in the iOS SDK (which usually isn't" + ) + endif() + set(CMAKE_FIND_ROOT_PATH ${CMAKE_FIND_ROOT_PATH} ${FREERDP_IOS_EXTERNAL_SSL_PATH}) + set_property(GLOBAL PROPERTY XCODE_ATTRIBUTE_SKIP_INSTALL YES) + endif(IOS) -# Temporarily disabled, causes the cmake script to be reexecuted, causing the compilation to fail. -# Workaround: specify the parameter in the command-line -# if(WITH_CLANG) -# set(CMAKE_C_COMPILER "clang") -# endif() + # Temporarily disabled, causes the cmake script to be reexecuted, causing the compilation to fail. + # Workaround: specify the parameter in the command-line + # if(WITH_CLANG) + # set(CMAKE_C_COMPILER "clang") + # endif() - if (WITH_VERBOSE) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -v") - endif() + if(WITH_VERBOSE) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -v") + endif() endif(APPLE) # Android if(ANDROID) - set_property( GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS ${ANDROID_LIBRARY_USE_LIB64_PATHS} ) + set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS ${ANDROID_LIBRARY_USE_LIB64_PATHS}) - if (${ANDROID_ABI} STREQUAL "armeabi") - set (WITH_NEON OFF) - endif() + if(${ANDROID_ABI} STREQUAL "armeabi") + set(WITH_NEON OFF) + endif() - if(ANDROID_ABI STREQUAL arm64-v8a) - include (CheckCCompilerFlag) - check_c_compiler_flag("-mfloat-abi=softfp" ABI_SOFTFP_SUPPORTED) + if(ANDROID_ABI STREQUAL arm64-v8a) + include(CheckCCompilerFlag) + check_c_compiler_flag("-mfloat-abi=softfp" ABI_SOFTFP_SUPPORTED) - if (ABI_SOFTFP_SUPPORTED) - # https://github.com/android/ndk/issues/910 - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfloat-abi=softfp") - endif() - endif() + if(ABI_SOFTFP_SUPPORTED) + # https://github.com/android/ndk/issues/910 + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfloat-abi=softfp") + endif() + endif() - if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") - add_definitions(-DNDK_DEBUG=1) + if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") + add_definitions(-DNDK_DEBUG=1) - # NOTE: Manually add -gdwarf-3, as newer toolchains default to -gdwarf-4, - # which is not supported by the gdbserver binary shipped with - # the android NDK (tested with r9b) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_DEBUG} -gdwarf-3") - endif() - set(CMAKE_C_LINK_FLAGS "${CMAKE_C_LINK_FLAGS} -llog") + # NOTE: Manually add -gdwarf-3, as newer toolchains default to -gdwarf-4, + # which is not supported by the gdbserver binary shipped with + # the android NDK (tested with r9b) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_DEBUG} -gdwarf-3") + endif() + set(CMAKE_C_LINK_FLAGS "${CMAKE_C_LINK_FLAGS} -llog") - # CMAKE_PREFIX_PATH detection is broken in most Android toolchain files - # Append it to CMAKE_FIND_ROOT_PATH and avoid potential duplicates - list(APPEND CMAKE_FIND_ROOT_PATH ${CMAKE_PREFIX_PATH}) - list(REMOVE_DUPLICATES CMAKE_FIND_ROOT_PATH) + # CMAKE_PREFIX_PATH detection is broken in most Android toolchain files + # Append it to CMAKE_FIND_ROOT_PATH and avoid potential duplicates + list(APPEND CMAKE_FIND_ROOT_PATH ${CMAKE_PREFIX_PATH}) + list(REMOVE_DUPLICATES CMAKE_FIND_ROOT_PATH) - if (NOT FREERDP_EXTERNAL_PATH) - if (IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/external/") - set (FREERDP_EXTERNAL_PATH "${CMAKE_CURRENT_SOURCE_DIR}/external/") - else() - message(STATUS "FREERDP_EXTERNAL_PATH not set!") - endif() - endif() + if(NOT FREERDP_EXTERNAL_PATH) + if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/external/") + set(FREERDP_EXTERNAL_PATH "${CMAKE_CURRENT_SOURCE_DIR}/external/") + else() + message(STATUS "FREERDP_EXTERNAL_PATH not set!") + endif() + endif() - list (APPEND CMAKE_INCLUDE_PATH ${FREERDP_EXTERNAL_PATH}/${ANDROID_ABI}/include) - list (APPEND CMAKE_LIBRARY_PATH ${FREERDP_EXTERNAL_PATH}/${ANDROID_ABI}/ ) - set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH ) - set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH ) + list(APPEND CMAKE_INCLUDE_PATH ${FREERDP_EXTERNAL_PATH}/${ANDROID_ABI}/include) + list(APPEND CMAKE_LIBRARY_PATH ${FREERDP_EXTERNAL_PATH}/${ANDROID_ABI}/) + set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH) + set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH) - if (WITH_GPROF) - CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/scripts/gprof_generate.sh.in - ${PROJECT_BINARY_DIR}/scripts/gprof_generate.sh @ONLY) - endif(WITH_GPROF) + if(WITH_GPROF) + configure_file( + ${PROJECT_SOURCE_DIR}/scripts/gprof_generate.sh.in ${PROJECT_BINARY_DIR}/scripts/gprof_generate.sh @ONLY + ) + endif(WITH_GPROF) endif() if(WITH_VALGRIND_MEMCHECK) - check_include_files(valgrind/memcheck.h FREERDP_HAVE_VALGRIND_MEMCHECK_H) + check_include_files(valgrind/memcheck.h FREERDP_HAVE_VALGRIND_MEMCHECK_H) else() - unset(FREERDP_HAVE_VALGRIND_MEMCHECK_H CACHE) + unset(FREERDP_HAVE_VALGRIND_MEMCHECK_H CACHE) endif() if(UNIX OR CYGWIN) - set(WAYLAND_FEATURE_TYPE "RECOMMENDED") + set(WAYLAND_FEATURE_TYPE "RECOMMENDED") else() - set(WAYLAND_FEATURE_TYPE "DISABLED") + set(WAYLAND_FEATURE_TYPE "DISABLED") endif() if(WITH_PCSC_WINPR) - find_package(PCSCWinPR) + find_package(PCSCWinPR) endif() set(WAYLAND_FEATURE_PURPOSE "Wayland") @@ -509,44 +518,44 @@ set(SOXR_FEATURE_PURPOSE "codec") set(SOXR_FEATURE_DESCRIPTION "SOX audio resample library") if(WIN32) - set(WAYLAND_FEATURE_TYPE "DISABLED") - set(PCSC_FEATURE_TYPE "DISABLED") + set(WAYLAND_FEATURE_TYPE "DISABLED") + set(PCSC_FEATURE_TYPE "DISABLED") endif() if(APPLE) - set(WAYLAND_FEATURE_TYPE "DISABLED") - if(IOS) - set(PCSC_FEATURE_TYPE "DISABLED") - endif() + set(WAYLAND_FEATURE_TYPE "DISABLED") + if(IOS) + set(PCSC_FEATURE_TYPE "DISABLED") + endif() endif() if(ANDROID) - set(WAYLAND_FEATURE_TYPE "DISABLED") - set(PCSC_FEATURE_TYPE "DISABLED") + set(WAYLAND_FEATURE_TYPE "DISABLED") + set(PCSC_FEATURE_TYPE "DISABLED") endif() find_feature(Wayland ${WAYLAND_FEATURE_TYPE} ${WAYLAND_FEATURE_PURPOSE} ${WAYLAND_FEATURE_DESCRIPTION}) option(WITH_LIBRESSL "build with LibreSSL" OFF) -if (WITH_LIBRESSL) - find_package(LibreSSL REQUIRED) - include_directories(SYSTEM ${LibreSSL_INCLUDE_DIRS}) - set(OPENSSL_INCLUDE_DIR ${LIBRESSL_INCLUDE_DIR}) - set(OPENSSL_LIBRARIES ${LIBRESSL_LIBRARIES}) - set(OPENSSL_CRYPTO_LIBRARIES ${LIBRESSL_LIBRARIES}) - set(WITH_OPENSSL ON) - set(OPENSSL_FOUND ON) - add_definitions("-DWITH_LIBRESSL") - add_definitions("-DWITH_OPENSSL") +if(WITH_LIBRESSL) + find_package(LibreSSL REQUIRED) + include_directories(SYSTEM ${LibreSSL_INCLUDE_DIRS}) + set(OPENSSL_INCLUDE_DIR ${LIBRESSL_INCLUDE_DIR}) + set(OPENSSL_LIBRARIES ${LIBRESSL_LIBRARIES}) + set(OPENSSL_CRYPTO_LIBRARIES ${LIBRESSL_LIBRARIES}) + set(WITH_OPENSSL ON) + set(OPENSSL_FOUND ON) + add_definitions("-DWITH_LIBRESSL") + add_definitions("-DWITH_OPENSSL") else() - find_feature(OpenSSL ${OPENSSL_FEATURE_TYPE} ${OPENSSL_FEATURE_PURPOSE} ${OPENSSL_FEATURE_DESCRIPTION}) - find_feature(MbedTLS ${MBEDTLS_FEATURE_TYPE} ${MBEDTLS_FEATURE_PURPOSE} ${MBEDTLS_FEATURE_DESCRIPTION}) + find_feature(OpenSSL ${OPENSSL_FEATURE_TYPE} ${OPENSSL_FEATURE_PURPOSE} ${OPENSSL_FEATURE_DESCRIPTION}) + find_feature(MbedTLS ${MBEDTLS_FEATURE_TYPE} ${MBEDTLS_FEATURE_PURPOSE} ${MBEDTLS_FEATURE_DESCRIPTION}) endif() find_feature(PCSC ${PCSC_FEATURE_TYPE} ${PCSC_FEATURE_PURPOSE} ${PCSC_FEATURE_DESCRIPTION}) -if (WITH_DSP_FFMPEG OR WITH_VIDEO_FFMPEG OR WITH_FFMPEG) - find_package(FFmpeg REQUIRED COMPONENTS AVUTIL AVCODEC) +if(WITH_DSP_FFMPEG OR WITH_VIDEO_FFMPEG OR WITH_FFMPEG) + find_package(FFmpeg REQUIRED COMPONENTS AVUTIL AVCODEC) endif() find_feature(OpenH264 ${OPENH264_FEATURE_TYPE} ${OPENH264_FEATURE_PURPOSE} ${OPENH264_FEATURE_DESCRIPTION}) @@ -557,67 +566,70 @@ find_feature(FAAD2 ${FAAD2_FEATURE_TYPE} ${FAAD2_FEATURE_PURPOSE} ${FAAD2_FEATUR find_feature(FAAC ${FAAC_FEATURE_TYPE} ${FAAC_FEATURE_PURPOSE} ${FAAC_FEATURE_DESCRIPTION}) find_feature(soxr ${SOXR_FEATURE_TYPE} ${SOXR_FEATURE_PURPOSE} ${SOXR_FEATURE_DESCRIPTION}) -if (WITH_OPENH264 AND NOT WITH_OPENH264_LOADING) - option(WITH_OPENH264_LOADING "Use LoadLibrary to load openh264 at runtime" OFF) -endif (WITH_OPENH264 AND NOT WITH_OPENH264_LOADING) +if(WITH_OPENH264 AND NOT WITH_OPENH264_LOADING) + option(WITH_OPENH264_LOADING "Use LoadLibrary to load openh264 at runtime" OFF) +endif(WITH_OPENH264 AND NOT WITH_OPENH264_LOADING) # Version check, if we have detected FFMPEG but the version is too old # deactivate it as sound backend. -if (WITH_DSP_FFMPEG) - if (AVCODEC_VERSION VERSION_LESS "57.48.101") - message(WARNING "FFmpeg version detected (${AVCODEC_VERSION}) is too old. (Require at least 57.48.101 for sound). Deactivating") - set(WITH_DSP_FFMPEG OFF) - endif() -endif (WITH_DSP_FFMPEG) +if(WITH_DSP_FFMPEG) + if(AVCODEC_VERSION VERSION_LESS "57.48.101") + message( + WARNING + "FFmpeg version detected (${AVCODEC_VERSION}) is too old. (Require at least 57.48.101 for sound). Deactivating" + ) + set(WITH_DSP_FFMPEG OFF) + endif() +endif(WITH_DSP_FFMPEG) -if (WITH_OPENH264 AND NOT OPENH264_FOUND) - message(FATAL_ERROR "OpenH264 support requested but not detected") +if(WITH_OPENH264 AND NOT OPENH264_FOUND) + message(FATAL_ERROR "OpenH264 support requested but not detected") endif() set(WITH_OPENH264 ${OPENH264_FOUND}) if(OPENSSL_FOUND) - add_definitions("-DWITH_OPENSSL") - message(STATUS "Using OpenSSL Version: ${OPENSSL_VERSION}") - include_directories(SYSTEM ${OPENSSL_INCLUDE_DIR}) + add_definitions("-DWITH_OPENSSL") + message(STATUS "Using OpenSSL Version: ${OPENSSL_VERSION}") + include_directories(SYSTEM ${OPENSSL_INCLUDE_DIR}) endif() if(MBEDTLS_FOUND) - add_definitions("-DWITH_MBEDTLS") + add_definitions("-DWITH_MBEDTLS") endif() -if (WITH_OPENH264 OR WITH_MEDIA_FOUNDATION OR WITH_VIDEO_FFMPEG OR WITH_MEDIACODEC) - set(WITH_GFX_H264 ON) +if(WITH_OPENH264 OR WITH_MEDIA_FOUNDATION OR WITH_VIDEO_FFMPEG OR WITH_MEDIACODEC) + set(WITH_GFX_H264 ON) else() - set(WITH_GFX_H264 OFF) + set(WITH_GFX_H264 OFF) endif() # Android expects all libraries to be loadable # without paths. -if (ANDROID OR WIN32 OR MAC_BUNDLE) - set(PLUGIN_ABS_PATHS_DEFAULT OFF) +if(ANDROID OR WIN32 OR MAC_BUNDLE) + set(PLUGIN_ABS_PATHS_DEFAULT OFF) else() - set(PLUGIN_ABS_PATHS_DEFAULT ON) + set(PLUGIN_ABS_PATHS_DEFAULT ON) endif() option(WITH_ABSOLUTE_PLUGIN_LOAD_PATHS "Load plugins with absolute paths" ${PLUGIN_ABS_PATHS_DEFAULT}) -if (NOT WITH_ABSOLUTE_PLUGIN_LOAD_PATHS) +if(NOT WITH_ABSOLUTE_PLUGIN_LOAD_PATHS) set(FREERDP_DATA_PATH "share") - if (NOT FREERDP_INSTALL_PREFIX) - set(FREERDP_INSTALL_PREFIX ".") + if(NOT FREERDP_INSTALL_PREFIX) + set(FREERDP_INSTALL_PREFIX ".") endif() set(FREERDP_LIBRARY_PATH ".") set(FREERDP_PLUGIN_PATH ".") else() - set(FREERDP_DATA_PATH "${CMAKE_INSTALL_PREFIX}/share/${FREERDP_MAJOR_DIR}") - if (NOT FREERDP_INSTALL_PREFIX) - set(FREERDP_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") - endif() - set(FREERDP_LIBRARY_PATH "${CMAKE_INSTALL_LIBDIR}") - if (WIN32) - set(FREERDP_PLUGIN_PATH "${CMAKE_INSTALL_BINDIR}/${FREERDP_MAJOR_DIR}") - else() - set(FREERDP_PLUGIN_PATH "${CMAKE_INSTALL_LIBDIR}/${FREERDP_MAJOR_DIR}") - endif() + set(FREERDP_DATA_PATH "${CMAKE_INSTALL_PREFIX}/share/${FREERDP_MAJOR_DIR}") + if(NOT FREERDP_INSTALL_PREFIX) + set(FREERDP_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") + endif() + set(FREERDP_LIBRARY_PATH "${CMAKE_INSTALL_LIBDIR}") + if(WIN32) + set(FREERDP_PLUGIN_PATH "${CMAKE_INSTALL_BINDIR}/${FREERDP_MAJOR_DIR}") + else() + set(FREERDP_PLUGIN_PATH "${CMAKE_INSTALL_LIBDIR}/${FREERDP_MAJOR_DIR}") + endif() endif() set(FREERDP_ADDIN_PATH "${FREERDP_PLUGIN_PATH}") @@ -628,20 +640,19 @@ set(FREERDP_EXTENSION_PATH "${CMAKE_INSTALL_FULL_LIBDIR}/${FREERDP_EXTENSION_POS # Proxy plugins path if(NOT DEFINED PROXY_PLUGINDIR) - message("using default plugins location") - set(FREERDP_PROXY_PLUGINDIR "${FREERDP_PLUGIN_PATH}/proxy/") + message("using default plugins location") + set(FREERDP_PROXY_PLUGINDIR "${FREERDP_PLUGIN_PATH}/proxy/") else() - set(FREERDP_PROXY_PLUGINDIR "${PROXY_PLUGINDIR}") + set(FREERDP_PROXY_PLUGINDIR "${PROXY_PLUGINDIR}") endif() # Android profiling if(ANDROID) - if(WITH_GPROF) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pg") - set(PROFILER_LIBRARIES - "${FREERDP_EXTERNAL_PROFILER_PATH}/obj/local/${ANDROID_ABI}/libandroid-ndk-profiler.a") - include_directories(SYSTEM "${FREERDP_EXTERNAL_PROFILER_PATH}") - endif() + if(WITH_GPROF) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pg") + set(PROFILER_LIBRARIES "${FREERDP_EXTERNAL_PROFILER_PATH}/obj/local/${ANDROID_ABI}/libandroid-ndk-profiler.a") + include_directories(SYSTEM "${FREERDP_EXTERNAL_PROFILER_PATH}") + endif() endif() # Unit Tests @@ -649,34 +660,34 @@ endif() include(CTest) if(BUILD_TESTING_INTERNAL OR BUILD_TESTING) - enable_testing() + enable_testing() - if(MSVC) - set(TESTING_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}") - else() - set(TESTING_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/Testing") - endif() + if(MSVC) + set(TESTING_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}") + else() + set(TESTING_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/Testing") + endif() endif() include(CommonConfigOptions) -if (FREERDP_UNIFIED_BUILD) - add_subdirectory(winpr) - if (WITH_WAYLAND) - add_subdirectory(uwac) - endif() - if (WITH_SERVER) - option(WITH_RDTK "build rdtk toolkit" ON) - if (WITH_RDTK) - add_subdirectory(rdtk) - endif() - endif() +if(FREERDP_UNIFIED_BUILD) + add_subdirectory(winpr) + if(WITH_WAYLAND) + add_subdirectory(uwac) + endif() + if(WITH_SERVER) + option(WITH_RDTK "build rdtk toolkit" ON) + if(WITH_RDTK) + add_subdirectory(rdtk) + endif() + endif() - include_directories(${PROJECT_SOURCE_DIR}/winpr/include) - include_directories(${PROJECT_BINARY_DIR}/winpr/include) + include_directories(${PROJECT_SOURCE_DIR}/winpr/include) + include_directories(${PROJECT_BINARY_DIR}/winpr/include) else() - find_package(WinPR 3 REQUIRED) - include_directories(SYSTEM ${WinPR_INCLUDE_DIR}) + find_package(WinPR 3 REQUIRED) + include_directories(SYSTEM ${WinPR_INCLUDE_DIR}) endif() option(WITH_AAD "Compile with support for Azure AD authentication" ${WITH_WINPR_JSON}) @@ -689,25 +700,24 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) # Sub-directories if(WITH_THIRD_PARTY) - add_subdirectory(third-party) - if (NOT "${THIRD_PARTY_INCLUDES}" STREQUAL "") - include_directories(SYSTEM ${THIRD_PARTY_INCLUDES}) - endif() + add_subdirectory(third-party) + if(NOT "${THIRD_PARTY_INCLUDES}" STREQUAL "") + include_directories(SYSTEM ${THIRD_PARTY_INCLUDES}) + endif() endif() - add_subdirectory(libfreerdp) if(WITH_CHANNELS) - add_subdirectory(channels) + add_subdirectory(channels) endif() if(WITH_CLIENT_COMMON OR WITH_CLIENT) -add_subdirectory(client) + add_subdirectory(client) endif() if(WITH_SERVER) - add_subdirectory(server) + add_subdirectory(server) endif() # Packaging @@ -715,22 +725,22 @@ endif() set(CMAKE_CPACK_INCLUDE_FILE "CMakeCPack.cmake") if(NOT (VENDOR MATCHES "FreeRDP")) - if(DEFINED CLIENT_VENDOR_PATH) - if(EXISTS "${PROJECT_SOURCE_DIR}/${CLIENT_VENDOR_PATH}/CMakeCPack.cmake") - set(CMAKE_CPACK_INCLUDE_FILE "${CLIENT_VENDOR_PATH}/CMakeCPack.cmake") - endif() - endif() + if(DEFINED CLIENT_VENDOR_PATH) + if(EXISTS "${PROJECT_SOURCE_DIR}/${CLIENT_VENDOR_PATH}/CMakeCPack.cmake") + set(CMAKE_CPACK_INCLUDE_FILE "${CLIENT_VENDOR_PATH}/CMakeCPack.cmake") + endif() + endif() endif() #message("VENDOR: ${VENDOR} CLIENT_VENDOR_PATH: ${CLIENT_VENDOR_PATH} CMAKE_CPACK_INCLUDE_FILE: ${CMAKE_CPACK_INCLUDE_FILE}") set(FREERDP_BUILD_CONFIG_LIST "") -GET_CMAKE_PROPERTY(res VARIABLES) -FOREACH(var ${res}) - IF (var MATCHES "^WITH_*|^BUILD_TESTING*|^WINPR_HAVE_*") - LIST(APPEND FREERDP_BUILD_CONFIG_LIST "${var}=${${var}}") - ENDIF() -ENDFOREACH() +get_cmake_property(res VARIABLES) +foreach(var ${res}) + if(var MATCHES "^WITH_*|^BUILD_TESTING*|^WINPR_HAVE_*") + list(APPEND FREERDP_BUILD_CONFIG_LIST "${var}=${${var}}") + endif() +endforeach() string(REPLACE ";" " " FREERDP_BUILD_CONFIG "${FREERDP_BUILD_CONFIG_LIST}") add_subdirectory(include) @@ -740,8 +750,5 @@ include(${CMAKE_CPACK_INCLUDE_FILE}) message(STATUS "Intrinsic path configuration:") #ShowCMakeVars("^CMAKE_INSTALL_PREFIX") #ShowCMakeVars("^CMAKE_INSTALL_LIBDIR") -ShowCMakeVars("^FREERDP_INSTALL_PREFIX|^FREERDP_LIBRARY_PATH|^FREERDP_PLUGIN_PATH") -ShowCMakeVars("^FREERDP_ADDIN_PATH|^FREERDP_EXTENSION_PATH|^FREERDP_PROXY_PLUGINDIR") - - - +showcmakevars("^FREERDP_INSTALL_PREFIX|^FREERDP_LIBRARY_PATH|^FREERDP_PLUGIN_PATH") +showcmakevars("^FREERDP_ADDIN_PATH|^FREERDP_EXTENSION_PATH|^FREERDP_PROXY_PLUGINDIR") diff --git a/channels/CMakeLists.txt b/channels/CMakeLists.txt index ca1bb6c2a..080d062df 100644 --- a/channels/CMakeLists.txt +++ b/channels/CMakeLists.txt @@ -21,11 +21,7 @@ include(CMakeDependentOption) macro(define_channel_options) set(PREFIX "CHANNEL") - cmake_parse_arguments(${PREFIX} - "" - "NAME;TYPE;DESCRIPTION;SPECIFICATIONS;DEFAULT" - "" - ${ARGN}) + cmake_parse_arguments(${PREFIX} "" "NAME;TYPE;DESCRIPTION;SPECIFICATIONS;DEFAULT" "" ${ARGN}) string(TOUPPER "CHANNEL_${CHANNEL_NAME}" CHANNEL_OPTION) string(TOUPPER "CHANNEL_${CHANNEL_NAME}_CLIENT" CHANNEL_CLIENT_OPTION) @@ -52,8 +48,8 @@ macro(define_channel_options) set(CHANNEL_OPTION_DOC "Build ${CHANNEL_NAME} ${CHANNEL_TYPE} channel") - if ("${CHANNEL_TYPE}" STREQUAL "DYNAMIC") - CMAKE_DEPENDENT_OPTION(${CHANNEL_OPTION} "${CHANNEL_OPTION_DOC}" ${CHANNEL_DEFAULT} "CHANNEL_DRDYNVC" OFF) + if("${CHANNEL_TYPE}" STREQUAL "DYNAMIC") + cmake_dependent_option(${CHANNEL_OPTION} "${CHANNEL_OPTION_DOC}" ${CHANNEL_DEFAULT} "CHANNEL_DRDYNVC" OFF) else() option(${CHANNEL_OPTION} "${CHANNEL_OPTION_DOC}" ${CHANNEL_DEFAULT}) endif() @@ -65,8 +61,9 @@ macro(define_channel_client_options _channel_client_default) string(TOUPPER "CHANNEL_${CHANNEL_NAME}" CHANNEL_OPTION) set(CHANNEL_CLIENT_OPTION_DOC "Build ${CHANNEL_NAME} ${CHANNEL_TYPE} channel client") - CMAKE_DEPENDENT_OPTION(${CHANNEL_CLIENT_OPTION} "${CHANNEL_CLIENT_OPTION_DOC}" - ${_channel_client_default} "${CHANNEL_OPTION}" OFF) + cmake_dependent_option( + ${CHANNEL_CLIENT_OPTION} "${CHANNEL_CLIENT_OPTION_DOC}" ${_channel_client_default} "${CHANNEL_OPTION}" OFF + ) endmacro(define_channel_client_options) macro(define_channel_server_options _channel_server_default) @@ -74,8 +71,9 @@ macro(define_channel_server_options _channel_server_default) string(TOUPPER "CHANNEL_${CHANNEL_NAME}" CHANNEL_OPTION) set(CHANNEL_SERVER_OPTION_DOC "Build ${CHANNEL_NAME} ${CHANNEL_TYPE} channel server") - CMAKE_DEPENDENT_OPTION(${CHANNEL_SERVER_OPTION} "${CHANNEL_SERVER_OPTION_DOC}" - ${_channel_server_default} "${CHANNEL_OPTION}" OFF) + cmake_dependent_option( + ${CHANNEL_SERVER_OPTION} "${CHANNEL_SERVER_OPTION_DOC}" ${_channel_server_default} "${CHANNEL_OPTION}" OFF + ) endmacro(define_channel_server_options) macro(define_channel _channel_name) @@ -119,29 +117,33 @@ macro(define_channel_server_subsystem _channel_name _subsystem _type) endmacro(define_channel_server_subsystem) macro(add_channel_client _channel_prefix _channel_name) - if (${_channel_prefix}_CLIENT) - add_subdirectory(client) - if(${${_channel_prefix}_CLIENT_STATIC}) - set(CHANNEL_STATIC_CLIENT_MODULES ${CHANNEL_STATIC_CLIENT_MODULES} ${_channel_prefix} PARENT_SCOPE) - set(${_channel_prefix}_CLIENT_NAME ${${_channel_prefix}_CLIENT_NAME} PARENT_SCOPE) - set(${_channel_prefix}_CLIENT_CHANNEL ${${_channel_prefix}_CLIENT_CHANNEL} PARENT_SCOPE) - set(${_channel_prefix}_CLIENT_ENTRY ${${_channel_prefix}_CLIENT_ENTRY} PARENT_SCOPE) - set(CHANNEL_STATIC_CLIENT_ENTRIES ${CHANNEL_STATIC_CLIENT_ENTRIES} ${${_channel_prefix}_CLIENT_ENTRY} PARENT_SCOPE) - endif() - endif() + if(${_channel_prefix}_CLIENT) + add_subdirectory(client) + if(${${_channel_prefix}_CLIENT_STATIC}) + set(CHANNEL_STATIC_CLIENT_MODULES ${CHANNEL_STATIC_CLIENT_MODULES} ${_channel_prefix} PARENT_SCOPE) + set(${_channel_prefix}_CLIENT_NAME ${${_channel_prefix}_CLIENT_NAME} PARENT_SCOPE) + set(${_channel_prefix}_CLIENT_CHANNEL ${${_channel_prefix}_CLIENT_CHANNEL} PARENT_SCOPE) + set(${_channel_prefix}_CLIENT_ENTRY ${${_channel_prefix}_CLIENT_ENTRY} PARENT_SCOPE) + set(CHANNEL_STATIC_CLIENT_ENTRIES ${CHANNEL_STATIC_CLIENT_ENTRIES} ${${_channel_prefix}_CLIENT_ENTRY} + PARENT_SCOPE + ) + endif() + endif() endmacro(add_channel_client) macro(add_channel_server _channel_prefix _channel_name) - if (${_channel_prefix}_SERVER) - add_subdirectory(server) - if(${${_channel_prefix}_SERVER_STATIC}) - set(CHANNEL_STATIC_SERVER_MODULES ${CHANNEL_STATIC_SERVER_MODULES} ${_channel_prefix} PARENT_SCOPE) - set(${_channel_prefix}_SERVER_NAME ${${_channel_prefix}_SERVER_NAME} PARENT_SCOPE) - set(${_channel_prefix}_SERVER_CHANNEL ${${_channel_prefix}_SERVER_CHANNEL} PARENT_SCOPE) - set(${_channel_prefix}_SERVER_ENTRY ${${_channel_prefix}_SERVER_ENTRY} PARENT_SCOPE) - set(CHANNEL_STATIC_SERVER_ENTRIES ${CHANNEL_STATIC_SERVER_ENTRIES} ${${_channel_prefix}_SERVER_ENTRY} PARENT_SCOPE) - endif() - endif() + if(${_channel_prefix}_SERVER) + add_subdirectory(server) + if(${${_channel_prefix}_SERVER_STATIC}) + set(CHANNEL_STATIC_SERVER_MODULES ${CHANNEL_STATIC_SERVER_MODULES} ${_channel_prefix} PARENT_SCOPE) + set(${_channel_prefix}_SERVER_NAME ${${_channel_prefix}_SERVER_NAME} PARENT_SCOPE) + set(${_channel_prefix}_SERVER_CHANNEL ${${_channel_prefix}_SERVER_CHANNEL} PARENT_SCOPE) + set(${_channel_prefix}_SERVER_ENTRY ${${_channel_prefix}_SERVER_ENTRY} PARENT_SCOPE) + set(CHANNEL_STATIC_SERVER_ENTRIES ${CHANNEL_STATIC_SERVER_ENTRIES} ${${_channel_prefix}_SERVER_ENTRY} + PARENT_SCOPE + ) + endif() + endif() endmacro(add_channel_server) macro(add_channel_client_subsystem _channel_prefix _channel_name _subsystem _type) @@ -165,79 +167,87 @@ macro(add_channel_client_subsystem _channel_prefix _channel_name _subsystem _typ endmacro(add_channel_client_subsystem) macro(channel_install _targets _destination _export_target) - if (NOT BUILD_SHARED_LIBS) - foreach(_target_name IN ITEMS ${_targets}) - target_include_directories(${_target_name} INTERFACE $) - endforeach() - install(TARGETS ${_targets} DESTINATION ${_destination} EXPORT ${_export_target}) - endif() + if(NOT BUILD_SHARED_LIBS) + foreach(_target_name IN ITEMS ${_targets}) + target_include_directories(${_target_name} INTERFACE $) + endforeach() + install(TARGETS ${_targets} DESTINATION ${_destination} EXPORT ${_export_target}) + endif() endmacro(channel_install) macro(server_channel_install _targets _destination) - channel_install(${_targets} ${_destination} "FreeRDP-ServerTargets") + channel_install(${_targets} ${_destination} "FreeRDP-ServerTargets") endmacro(server_channel_install) macro(client_channel_install _targets _destination) - channel_install(${_targets} ${_destination} "FreeRDP-ClientTargets") + channel_install(${_targets} ${_destination} "FreeRDP-ClientTargets") endmacro(client_channel_install) macro(add_channel_client_library _module_prefix _module_name _channel_name _dynamic _entry) set(_lnk_dir ${${_module_prefix}_LINK_DIRS}) - if (NOT "${_lnk_dir}" STREQUAL "") + if(NOT "${_lnk_dir}" STREQUAL "") link_directories(${_lnk_dir}) endif() - set(${_module_prefix}_STATIC ON PARENT_SCOPE) - set(${_module_prefix}_NAME ${_module_name} PARENT_SCOPE) - set(${_module_prefix}_CHANNEL ${_channel_name} PARENT_SCOPE) - set(${_module_prefix}_ENTRY ${_entry} PARENT_SCOPE) + set(${_module_prefix}_STATIC ON PARENT_SCOPE) + set(${_module_prefix}_NAME ${_module_name} PARENT_SCOPE) + set(${_module_prefix}_CHANNEL ${_channel_name} PARENT_SCOPE) + set(${_module_prefix}_ENTRY ${_entry} PARENT_SCOPE) - add_library(${_module_name} OBJECT ${${_module_prefix}_SRCS}) - set_property(TARGET ${_module_name} PROPERTY FOLDER "Channels/${CHANNEL_NAME}/Client") + add_library(${_module_name} OBJECT ${${_module_prefix}_SRCS}) + set_property(TARGET ${_module_name} PROPERTY FOLDER "Channels/${CHANNEL_NAME}/Client") - if (${_module_prefix}_LIBS) - target_link_libraries(${_module_name} PUBLIC ${${_module_prefix}_LIBS}) - endif() - client_channel_install(${_module_name} ${FREERDP_ADDIN_PATH}) + if(${_module_prefix}_LIBS) + target_link_libraries(${_module_name} PUBLIC ${${_module_prefix}_LIBS}) + endif() + client_channel_install(${_module_name} ${FREERDP_ADDIN_PATH}) endmacro(add_channel_client_library) -macro(add_channel_client_subsystem_library _module_prefix _module_name _channel_name _type _dynamic _entry) +macro( + add_channel_client_subsystem_library + _module_prefix + _module_name + _channel_name + _type + _dynamic + _entry +) set(_lnk_dir ${${_module_prefix}_LINK_DIRS}) - if (NOT "${_lnk_dir}" STREQUAL "") + if(NOT "${_lnk_dir}" STREQUAL "") link_directories(${_lnk_dir}) endif() - set(${_module_prefix}_STATIC ON PARENT_SCOPE) - set(${_module_prefix}_NAME ${_module_name} PARENT_SCOPE) - set(${_module_prefix}_TYPE ${_type} PARENT_SCOPE) + set(${_module_prefix}_STATIC ON PARENT_SCOPE) + set(${_module_prefix}_NAME ${_module_name} PARENT_SCOPE) + set(${_module_prefix}_TYPE ${_type} PARENT_SCOPE) - add_library(${_module_name} OBJECT ${${_module_prefix}_SRCS}) - set_property(TARGET ${_module_name} PROPERTY FOLDER "Channels/${_channel_name}/Client/Subsystem/${CHANNEL_SUBSYSTEM}") + add_library(${_module_name} OBJECT ${${_module_prefix}_SRCS}) + set_property(TARGET ${_module_name} PROPERTY FOLDER "Channels/${_channel_name}/Client/Subsystem/${CHANNEL_SUBSYSTEM}") - if (${_module_prefix}_LIBS) - target_link_libraries(${_module_name} PUBLIC ${${_module_prefix}_LIBS}) - endif() - client_channel_install(${_module_name} ${FREERDP_ADDIN_PATH}) + if(${_module_prefix}_LIBS) + target_link_libraries(${_module_name} PUBLIC ${${_module_prefix}_LIBS}) + endif() + client_channel_install(${_module_name} ${FREERDP_ADDIN_PATH}) endmacro(add_channel_client_subsystem_library) macro(add_channel_server_library _module_prefix _module_name _channel_name _dynamic _entry) set(_lnk_dir ${${_module_prefix}_LINK_DIRS}) - if (NOT "${_lnk_dir}" STREQUAL "") + if(NOT "${_lnk_dir}" STREQUAL "") link_directories(${_lnk_dir}) endif() - set(${_module_prefix}_STATIC ON PARENT_SCOPE) - set(${_module_prefix}_NAME ${_module_name} PARENT_SCOPE) - set(${_module_prefix}_CHANNEL ${_channel_name} PARENT_SCOPE) - set(${_module_prefix}_ENTRY ${_entry} PARENT_SCOPE) + set(${_module_prefix}_STATIC ON PARENT_SCOPE) + set(${_module_prefix}_NAME ${_module_name} PARENT_SCOPE) + set(${_module_prefix}_CHANNEL ${_channel_name} PARENT_SCOPE) + set(${_module_prefix}_ENTRY ${_entry} PARENT_SCOPE) - add_library(${_module_name} OBJECT ${${_module_prefix}_SRCS}) - set_property(TARGET ${_module_name} PROPERTY FOLDER "Channels/${CHANNEL_NAME}/Server") + add_library(${_module_name} OBJECT ${${_module_prefix}_SRCS}) + set_property(TARGET ${_module_name} PROPERTY FOLDER "Channels/${CHANNEL_NAME}/Server") - if (${_module_prefix}_LIBS) - target_link_libraries(${_module_name} PUBLIC ${${_module_prefix}_LIBS}) - endif() - server_channel_install(${_module_name} ${FREERDP_ADDIN_PATH}) + if(${_module_prefix}_LIBS) + target_link_libraries(${_module_name} PUBLIC ${${_module_prefix}_LIBS}) + endif() + server_channel_install(${_module_name} ${FREERDP_ADDIN_PATH}) endmacro(add_channel_server_library) set(FILENAME "ChannelOptions.cmake") @@ -254,7 +264,7 @@ foreach(FILEPATH ${FILEPATHS}) endif() endforeach() -if (NOT "${DRDYNVC_MATCH}" STREQUAL "") +if(NOT "${DRDYNVC_MATCH}" STREQUAL "") list(REMOVE_ITEM FILEPATHS ${DRDYNVC_MATCH}) list(APPEND FILEPATHS ${DRDYNVC_MATCH}) list(REVERSE FILEPATHS) # list PREPEND is not available on old CMake3 @@ -281,7 +291,7 @@ foreach(FILEPATH ${FILEPATHS}) endif() endforeach(FILEPATH) -if (WITH_CHANNELS) +if(WITH_CHANNELS) if(WITH_CLIENT_CHANNELS) add_subdirectory(client) set(FREERDP_CHANNELS_CLIENT_SRCS ${FREERDP_CHANNELS_CLIENT_SRCS} PARENT_SCOPE) diff --git a/channels/ainput/CMakeLists.txt b/channels/ainput/CMakeLists.txt index b1d1a6a4a..0e332eb7d 100644 --- a/channels/ainput/CMakeLists.txt +++ b/channels/ainput/CMakeLists.txt @@ -19,9 +19,9 @@ define_channel("ainput") if(WITH_CLIENT_CHANNELS) - add_channel_client(${MODULE_PREFIX} ${CHANNEL_NAME}) + add_channel_client(${MODULE_PREFIX} ${CHANNEL_NAME}) endif() if(WITH_SERVER_CHANNELS) - add_channel_server(${MODULE_PREFIX} ${CHANNEL_NAME}) + add_channel_server(${MODULE_PREFIX} ${CHANNEL_NAME}) endif() diff --git a/channels/ainput/ChannelOptions.cmake b/channels/ainput/ChannelOptions.cmake index eafc6c0f5..2ac7cb37a 100644 --- a/channels/ainput/ChannelOptions.cmake +++ b/channels/ainput/ChannelOptions.cmake @@ -1,13 +1,19 @@ - set(OPTION_DEFAULT OFF) set(OPTION_CLIENT_DEFAULT ON) set(OPTION_SERVER_DEFAULT ON) -define_channel_options(NAME "ainput" TYPE "dynamic" - DESCRIPTION "Advanced Input Virtual Channel Extension" - SPECIFICATIONS "[XXXXX]" - DEFAULT ${OPTION_DEFAULT}) +define_channel_options( + NAME + "ainput" + TYPE + "dynamic" + DESCRIPTION + "Advanced Input Virtual Channel Extension" + SPECIFICATIONS + "[XXXXX]" + DEFAULT + ${OPTION_DEFAULT} +) define_channel_client_options(${OPTION_CLIENT_DEFAULT}) define_channel_server_options(${OPTION_SERVER_DEFAULT}) - diff --git a/channels/ainput/client/CMakeLists.txt b/channels/ainput/client/CMakeLists.txt index 00c8e4acd..0bd9abf99 100644 --- a/channels/ainput/client/CMakeLists.txt +++ b/channels/ainput/client/CMakeLists.txt @@ -18,14 +18,9 @@ define_channel_client("ainput") -set(${MODULE_PREFIX}_SRCS - ainput_main.c - ainput_main.h -) +set(${MODULE_PREFIX}_SRCS ainput_main.c ainput_main.h) -set(${MODULE_PREFIX}_LIBS - winpr -) +set(${MODULE_PREFIX}_LIBS winpr) include_directories(..) diff --git a/channels/ainput/server/CMakeLists.txt b/channels/ainput/server/CMakeLists.txt index 13bf2e4cd..b5becfb16 100644 --- a/channels/ainput/server/CMakeLists.txt +++ b/channels/ainput/server/CMakeLists.txt @@ -18,11 +18,7 @@ define_channel_server("ainput") -set(${MODULE_PREFIX}_SRCS - ainput_main.c -) +set(${MODULE_PREFIX}_SRCS ainput_main.c) -set(${MODULE_PREFIX}_LIBS - freerdp -) +set(${MODULE_PREFIX}_LIBS freerdp) add_channel_server_library(${MODULE_PREFIX} ${MODULE_NAME} ${CHANNEL_NAME} FALSE "DVCPluginEntry") diff --git a/channels/audin/CMakeLists.txt b/channels/audin/CMakeLists.txt index d72b1021b..2c92a64aa 100644 --- a/channels/audin/CMakeLists.txt +++ b/channels/audin/CMakeLists.txt @@ -18,9 +18,9 @@ define_channel("audin") if(WITH_CLIENT_CHANNELS) - add_channel_client(${MODULE_PREFIX} ${CHANNEL_NAME}) + add_channel_client(${MODULE_PREFIX} ${CHANNEL_NAME}) endif() if(WITH_SERVER_CHANNELS) - add_channel_server(${MODULE_PREFIX} ${CHANNEL_NAME}) + add_channel_server(${MODULE_PREFIX} ${CHANNEL_NAME}) endif() diff --git a/channels/audin/ChannelOptions.cmake b/channels/audin/ChannelOptions.cmake index 39ca402e8..38d67c7ae 100644 --- a/channels/audin/ChannelOptions.cmake +++ b/channels/audin/ChannelOptions.cmake @@ -1,17 +1,23 @@ - set(OPTION_DEFAULT OFF) set(OPTION_CLIENT_DEFAULT ON) set(OPTION_SERVER_DEFAULT ON) if(ANDROID) - set(OPTION_SERVER_DEFAULT OFF) + set(OPTION_SERVER_DEFAULT OFF) endif() -define_channel_options(NAME "audin" TYPE "dynamic" - DESCRIPTION "Audio Input Redirection Virtual Channel Extension" - SPECIFICATIONS "[MS-RDPEAI]" - DEFAULT ${OPTION_DEFAULT}) +define_channel_options( + NAME + "audin" + TYPE + "dynamic" + DESCRIPTION + "Audio Input Redirection Virtual Channel Extension" + SPECIFICATIONS + "[MS-RDPEAI]" + DEFAULT + ${OPTION_DEFAULT} +) define_channel_client_options(${OPTION_CLIENT_DEFAULT}) define_channel_server_options(${OPTION_SERVER_DEFAULT}) - diff --git a/channels/audin/client/CMakeLists.txt b/channels/audin/client/CMakeLists.txt index 043e1b5ce..5ce4015bc 100644 --- a/channels/audin/client/CMakeLists.txt +++ b/channels/audin/client/CMakeLists.txt @@ -17,47 +17,42 @@ define_channel_client("audin") -set(${MODULE_PREFIX}_SRCS - audin_main.c - audin_main.h -) +set(${MODULE_PREFIX}_SRCS audin_main.c audin_main.h) -set(${MODULE_PREFIX}_LIBS - freerdp winpr -) +set(${MODULE_PREFIX}_LIBS freerdp winpr) include_directories(..) add_channel_client_library(${MODULE_PREFIX} ${MODULE_NAME} ${CHANNEL_NAME} TRUE "DVCPluginEntry") if(WITH_OSS) - add_channel_client_subsystem(${MODULE_PREFIX} ${CHANNEL_NAME} "oss" "") + add_channel_client_subsystem(${MODULE_PREFIX} ${CHANNEL_NAME} "oss" "") endif() if(WITH_ALSA) - add_channel_client_subsystem(${MODULE_PREFIX} ${CHANNEL_NAME} "alsa" "") + add_channel_client_subsystem(${MODULE_PREFIX} ${CHANNEL_NAME} "alsa" "") endif() if(WITH_PULSE) - add_channel_client_subsystem(${MODULE_PREFIX} ${CHANNEL_NAME} "pulse" "") + add_channel_client_subsystem(${MODULE_PREFIX} ${CHANNEL_NAME} "pulse" "") endif() if(WITH_OPENSLES) - add_channel_client_subsystem(${MODULE_PREFIX} ${CHANNEL_NAME} "opensles" "") + add_channel_client_subsystem(${MODULE_PREFIX} ${CHANNEL_NAME} "opensles" "") endif() if(WITH_WINMM) - add_channel_client_subsystem(${MODULE_PREFIX} ${CHANNEL_NAME} "winmm" "") + add_channel_client_subsystem(${MODULE_PREFIX} ${CHANNEL_NAME} "winmm" "") endif() if(WITH_MACAUDIO) - add_channel_client_subsystem(${MODULE_PREFIX} ${CHANNEL_NAME} "mac" "") + add_channel_client_subsystem(${MODULE_PREFIX} ${CHANNEL_NAME} "mac" "") endif() if(WITH_SNDIO) - add_channel_client_subsystem(${MODULE_PREFIX} ${CHANNEL_NAME} "sndio" "") + add_channel_client_subsystem(${MODULE_PREFIX} ${CHANNEL_NAME} "sndio" "") endif() if(WITH_IOSAUDIO) - add_channel_client_subsystem(${MODULE_PREFIX} ${CHANNEL_NAME} "ios" "") - endif() + add_channel_client_subsystem(${MODULE_PREFIX} ${CHANNEL_NAME} "ios" "") +endif() diff --git a/channels/audin/client/alsa/CMakeLists.txt b/channels/audin/client/alsa/CMakeLists.txt index 2858fe3f1..432ff1b4f 100644 --- a/channels/audin/client/alsa/CMakeLists.txt +++ b/channels/audin/client/alsa/CMakeLists.txt @@ -19,15 +19,9 @@ define_channel_client_subsystem("audin" "alsa" "") find_package(ALSA REQUIRED) -set(${MODULE_PREFIX}_SRCS - audin_alsa.c -) +set(${MODULE_PREFIX}_SRCS audin_alsa.c) -set(${MODULE_PREFIX}_LIBS - winpr - freerdp - ${ALSA_LIBRARIES} -) +set(${MODULE_PREFIX}_LIBS winpr freerdp ${ALSA_LIBRARIES}) include_directories(..) include_directories(SYSTEM ${ALSA_INCLUDE_DIRS}) diff --git a/channels/audin/client/ios/CMakeLists.txt b/channels/audin/client/ios/CMakeLists.txt index 72d42da61..51228759a 100644 --- a/channels/audin/client/ios/CMakeLists.txt +++ b/channels/audin/client/ios/CMakeLists.txt @@ -1,37 +1,29 @@ # FreeRDP: A Remote Desktop Protocol Implementation - # FreeRDP cmake build script - # - # Copyright (c) 2015 Armin Novak - # Copyright (c) 2015 Thincast Technologies GmbH - # - # 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. +# FreeRDP cmake build script +# +# Copyright (c) 2015 Armin Novak +# Copyright (c) 2015 Thincast Technologies GmbH +# +# 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. - define_channel_client_subsystem("audin" "ios" "") - FIND_LIBRARY(CORE_AUDIO CoreAudio) - FIND_LIBRARY(AVFOUNDATION AVFoundation) - FIND_LIBRARY(AUDIO_TOOL AudioToolbox) +define_channel_client_subsystem("audin" "ios" "") +find_library(CORE_AUDIO CoreAudio) +find_library(AVFOUNDATION AVFoundation) +find_library(AUDIO_TOOL AudioToolbox) - set(${MODULE_PREFIX}_SRCS - audin_ios.m -) +set(${MODULE_PREFIX}_SRCS audin_ios.m) -set(${MODULE_PREFIX}_LIBS - winpr - freerdp - ${AVFOUNDATION} - ${CORE_AUDIO} - ${AUDIO_TOOL} -) +set(${MODULE_PREFIX}_LIBS winpr freerdp ${AVFOUNDATION} ${CORE_AUDIO} ${AUDIO_TOOL}) include_directories(..) include_directories(SYSTEM ${MAC_INCLUDE_DIRS}) diff --git a/channels/audin/client/mac/CMakeLists.txt b/channels/audin/client/mac/CMakeLists.txt index f57d11e07..a496f80de 100644 --- a/channels/audin/client/mac/CMakeLists.txt +++ b/channels/audin/client/mac/CMakeLists.txt @@ -17,23 +17,14 @@ # limitations under the License. define_channel_client_subsystem("audin" "mac" "") -FIND_LIBRARY(CORE_AUDIO CoreAudio) -FIND_LIBRARY(AVFOUNDATION AVFoundation) -FIND_LIBRARY(AUDIO_TOOL AudioToolbox) -FIND_LIBRARY(APP_SERVICES ApplicationServices) +find_library(CORE_AUDIO CoreAudio) +find_library(AVFOUNDATION AVFoundation) +find_library(AUDIO_TOOL AudioToolbox) +find_library(APP_SERVICES ApplicationServices) -set(${MODULE_PREFIX}_SRCS - audin_mac.m -) +set(${MODULE_PREFIX}_SRCS audin_mac.m) -set(${MODULE_PREFIX}_LIBS - winpr - freerdp - ${AVFOUNDATION} - ${CORE_AUDIO} - ${AUDIO_TOOL} - ${APP_SERVICES} -) +set(${MODULE_PREFIX}_LIBS winpr freerdp ${AVFOUNDATION} ${CORE_AUDIO} ${AUDIO_TOOL} ${APP_SERVICES}) include_directories(..) include_directories(SYSTEM ${MAC_INCLUDE_DIRS}) diff --git a/channels/audin/client/opensles/CMakeLists.txt b/channels/audin/client/opensles/CMakeLists.txt index 7a27fb725..2174996fd 100644 --- a/channels/audin/client/opensles/CMakeLists.txt +++ b/channels/audin/client/opensles/CMakeLists.txt @@ -19,16 +19,9 @@ define_channel_client_subsystem("audin" "opensles" "") find_package(OpenSLES REQUIRED) -set(${MODULE_PREFIX}_SRCS - opensl_io.c - audin_opensl_es.c -) +set(${MODULE_PREFIX}_SRCS opensl_io.c audin_opensl_es.c) -set(${MODULE_PREFIX}_LIBS - winpr - freerdp - ${OpenSLES_LIBRARIES} -) +set(${MODULE_PREFIX}_LIBS winpr freerdp ${OpenSLES_LIBRARIES}) include_directories(..) include_directories(SYSTEM ${OpenSLES_INCLUDE_DIRS}) diff --git a/channels/audin/client/oss/CMakeLists.txt b/channels/audin/client/oss/CMakeLists.txt index 9d1592dcc..3532c6312 100644 --- a/channels/audin/client/oss/CMakeLists.txt +++ b/channels/audin/client/oss/CMakeLists.txt @@ -19,24 +19,13 @@ define_channel_client_subsystem("audin" "oss" "") find_package(OSS REQUIRED) -set(${MODULE_PREFIX}_SRCS - audin_oss.c -) +set(${MODULE_PREFIX}_SRCS audin_oss.c) -set(${MODULE_PREFIX}_LIBS - winpr - freerdp - ${OSS_LIBRARIES} -) +set(${MODULE_PREFIX}_LIBS winpr freerdp ${OSS_LIBRARIES}) include_directories(..) include_directories(${CMAKE_CURRENT_BINARY_DIR}) include_directories(SYSTEM ${OSS_INCLUDE_DIRS}) -cleaning_configure_file( - ${CMAKE_SOURCE_DIR}/cmake/oss-includes.h.in - ${CMAKE_CURRENT_BINARY_DIR}/oss-includes.h - @ONLY -) +cleaning_configure_file(${CMAKE_SOURCE_DIR}/cmake/oss-includes.h.in ${CMAKE_CURRENT_BINARY_DIR}/oss-includes.h @ONLY) add_channel_client_subsystem_library(${MODULE_PREFIX} ${MODULE_NAME} ${CHANNEL_NAME} "" TRUE "") - diff --git a/channels/audin/client/pulse/CMakeLists.txt b/channels/audin/client/pulse/CMakeLists.txt index af7744d28..1cec9fab9 100644 --- a/channels/audin/client/pulse/CMakeLists.txt +++ b/channels/audin/client/pulse/CMakeLists.txt @@ -19,15 +19,9 @@ define_channel_client_subsystem("audin" "pulse" "") find_package(PulseAudio REQUIRED) -set(${MODULE_PREFIX}_SRCS - audin_pulse.c) +set(${MODULE_PREFIX}_SRCS audin_pulse.c) -set(${MODULE_PREFIX}_LIBS - winpr - freerdp - ${PULSEAUDIO_LIBRARY} - ${PULSEAUDIO_MAINLOOP_LIBRARY} -) +set(${MODULE_PREFIX}_LIBS winpr freerdp ${PULSEAUDIO_LIBRARY} ${PULSEAUDIO_MAINLOOP_LIBRARY}) include_directories(..) include_directories(SYSTEM ${PULSEAUDIO_INCLUDE_DIR}) diff --git a/channels/audin/client/sndio/CMakeLists.txt b/channels/audin/client/sndio/CMakeLists.txt index 1ec1bea35..93e595be0 100644 --- a/channels/audin/client/sndio/CMakeLists.txt +++ b/channels/audin/client/sndio/CMakeLists.txt @@ -20,17 +20,11 @@ define_channel_client_subsystem("audin" "sndio" "") find_package(SNDIO REQUIRED) -set(${MODULE_PREFIX}_SRCS - audin_sndio.c) +set(${MODULE_PREFIX}_SRCS audin_sndio.c) -set(${MODULE_PREFIX}_LIBS - winpr - freerdp - ${SNDIO_LIBRARIES} -) +set(${MODULE_PREFIX}_LIBS winpr freerdp ${SNDIO_LIBRARIES}) include_directories(..) include_directories(SYSTEM ${SNDIO_INCLUDE_DIRS}) add_channel_client_subsystem_library(${MODULE_PREFIX} ${MODULE_NAME} ${CHANNEL_NAME} "" TRUE "") - diff --git a/channels/audin/client/winmm/CMakeLists.txt b/channels/audin/client/winmm/CMakeLists.txt index 865794253..903d8499d 100644 --- a/channels/audin/client/winmm/CMakeLists.txt +++ b/channels/audin/client/winmm/CMakeLists.txt @@ -17,14 +17,9 @@ define_channel_client_subsystem("audin" "winmm" "") -set(${MODULE_PREFIX}_SRCS - audin_winmm.c) +set(${MODULE_PREFIX}_SRCS audin_winmm.c) -set(${MODULE_PREFIX}_LIBS - winpr - freerdp - winmm.lib -) +set(${MODULE_PREFIX}_LIBS winpr freerdp winmm.lib) include_directories(..) diff --git a/channels/audin/server/CMakeLists.txt b/channels/audin/server/CMakeLists.txt index 454d2a601..d081e2389 100644 --- a/channels/audin/server/CMakeLists.txt +++ b/channels/audin/server/CMakeLists.txt @@ -17,11 +17,7 @@ define_channel_server("audin") -set(${MODULE_PREFIX}_SRCS - audin.c -) +set(${MODULE_PREFIX}_SRCS audin.c) -set(${MODULE_PREFIX}_LIBS - freerdp -) +set(${MODULE_PREFIX}_LIBS freerdp) add_channel_server_library(${MODULE_PREFIX} ${MODULE_NAME} ${CHANNEL_NAME} FALSE "DVCPluginEntry") diff --git a/channels/client/CMakeLists.txt b/channels/client/CMakeLists.txt index add1a79f3..a5d596211 100644 --- a/channels/client/CMakeLists.txt +++ b/channels/client/CMakeLists.txt @@ -21,71 +21,75 @@ set(MODULE_NAME "freerdp-channels-client") set(MODULE_PREFIX "FREERDP_CHANNELS_CLIENT") set(${MODULE_PREFIX}_SRCS - ${CMAKE_CURRENT_BINARY_DIR}/tables.c - ${CMAKE_CURRENT_SOURCE_DIR}/tables.h - ${CMAKE_CURRENT_SOURCE_DIR}/addin.c - ${CMAKE_CURRENT_SOURCE_DIR}/addin.h - ${CMAKE_CURRENT_SOURCE_DIR}/generic_dynvc.c) + ${CMAKE_CURRENT_BINARY_DIR}/tables.c ${CMAKE_CURRENT_SOURCE_DIR}/tables.h ${CMAKE_CURRENT_SOURCE_DIR}/addin.c + ${CMAKE_CURRENT_SOURCE_DIR}/addin.h ${CMAKE_CURRENT_SOURCE_DIR}/generic_dynvc.c +) if(CHANNEL_STATIC_CLIENT_ENTRIES) - list(REMOVE_DUPLICATES CHANNEL_STATIC_CLIENT_ENTRIES) + list(REMOVE_DUPLICATES CHANNEL_STATIC_CLIENT_ENTRIES) endif() foreach(STATIC_ENTRY ${CHANNEL_STATIC_CLIENT_ENTRIES}) - foreach(STATIC_MODULE ${CHANNEL_STATIC_CLIENT_MODULES}) - foreach(ENTRY ${${STATIC_MODULE}_CLIENT_ENTRY}) - if(${ENTRY} STREQUAL ${STATIC_ENTRY}) - set(STATIC_MODULE_NAME ${${STATIC_MODULE}_CLIENT_NAME}) - set(STATIC_MODULE_CHANNEL ${${STATIC_MODULE}_CLIENT_CHANNEL}) - list(APPEND ${MODULE_PREFIX}_LIBS ${STATIC_MODULE_NAME}) + foreach(STATIC_MODULE ${CHANNEL_STATIC_CLIENT_MODULES}) + foreach(ENTRY ${${STATIC_MODULE}_CLIENT_ENTRY}) + if(${ENTRY} STREQUAL ${STATIC_ENTRY}) + set(STATIC_MODULE_NAME ${${STATIC_MODULE}_CLIENT_NAME}) + set(STATIC_MODULE_CHANNEL ${${STATIC_MODULE}_CLIENT_CHANNEL}) + list(APPEND ${MODULE_PREFIX}_LIBS ${STATIC_MODULE_NAME}) - set(ENTRY_POINT_NAME "${STATIC_MODULE_CHANNEL}_${ENTRY}") - if(${ENTRY} STREQUAL "VirtualChannelEntry") - set(ENTRY_POINT_IMPORT "extern BOOL VCAPITYPE ${ENTRY_POINT_NAME}(PCHANNEL_ENTRY_POINTS);") - elseif(${ENTRY} STREQUAL "VirtualChannelEntryEx") - set(ENTRY_POINT_IMPORT "extern BOOL VCAPITYPE ${ENTRY_POINT_NAME}(PCHANNEL_ENTRY_POINTS,PVOID);") - elseif(${ENTRY} MATCHES "DVCPluginEntry$") - set(ENTRY_POINT_IMPORT "extern UINT VCAPITYPE ${ENTRY_POINT_NAME}(IDRDYNVC_ENTRY_POINTS* pEntryPoints);") - elseif(${ENTRY} MATCHES "DeviceServiceEntry$") - set(ENTRY_POINT_IMPORT "extern UINT VCAPITYPE ${ENTRY_POINT_NAME}(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints);") - else() - set(ENTRY_POINT_IMPORT "extern UINT VCAPITYPE ${ENTRY_POINT_NAME}(void);") - endif() + set(ENTRY_POINT_NAME "${STATIC_MODULE_CHANNEL}_${ENTRY}") + if(${ENTRY} STREQUAL "VirtualChannelEntry") + set(ENTRY_POINT_IMPORT "extern BOOL VCAPITYPE ${ENTRY_POINT_NAME}(PCHANNEL_ENTRY_POINTS);") + elseif(${ENTRY} STREQUAL "VirtualChannelEntryEx") + set(ENTRY_POINT_IMPORT "extern BOOL VCAPITYPE ${ENTRY_POINT_NAME}(PCHANNEL_ENTRY_POINTS,PVOID);") + elseif(${ENTRY} MATCHES "DVCPluginEntry$") + set(ENTRY_POINT_IMPORT "extern UINT VCAPITYPE ${ENTRY_POINT_NAME}(IDRDYNVC_ENTRY_POINTS* pEntryPoints);") + elseif(${ENTRY} MATCHES "DeviceServiceEntry$") + set(ENTRY_POINT_IMPORT + "extern UINT VCAPITYPE ${ENTRY_POINT_NAME}(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints);" + ) + else() + set(ENTRY_POINT_IMPORT "extern UINT VCAPITYPE ${ENTRY_POINT_NAME}(void);") + endif() - string(APPEND ${STATIC_ENTRY}_IMPORTS "\n${ENTRY_POINT_IMPORT}") - string(APPEND ${STATIC_ENTRY}_TABLE "\n\t{ \"${STATIC_MODULE_CHANNEL}\", ${ENTRY_POINT_NAME} },") - endif() - endforeach() - endforeach() + string(APPEND ${STATIC_ENTRY}_IMPORTS "\n${ENTRY_POINT_IMPORT}") + string(APPEND ${STATIC_ENTRY}_TABLE "\n\t{ \"${STATIC_MODULE_CHANNEL}\", ${ENTRY_POINT_NAME} },") + endif() + endforeach() + endforeach() endforeach() string(APPEND CLIENT_STATIC_ENTRY_TABLES_LIST "\nextern const STATIC_ENTRY_TABLE CLIENT_STATIC_ENTRY_TABLES[];\n") string(APPEND CLIENT_STATIC_ENTRY_TABLES_LIST "const STATIC_ENTRY_TABLE CLIENT_STATIC_ENTRY_TABLES[] =\n{") foreach(STATIC_ENTRY ${CHANNEL_STATIC_CLIENT_ENTRIES}) - set(CLIENT_STATIC_ENTRY_IMPORTS "${CLIENT_STATIC_ENTRY_IMPORTS}\n${${STATIC_ENTRY}_IMPORTS}") - if(${STATIC_ENTRY} STREQUAL "VirtualChannelEntry") - set(CLIENT_STATIC_ENTRY_TYPE "STATIC_ENTRY_VC") - set(CLIENT_STATIC_ENTRY_INITIALIZER ".csevc") - elseif(${STATIC_ENTRY} STREQUAL "VirtualChannelEntryEx") - set(CLIENT_STATIC_ENTRY_TYPE "STATIC_ENTRY_VCEX") - set(CLIENT_STATIC_ENTRY_INITIALIZER ".csevcex") - elseif(${STATIC_ENTRY} MATCHES "DVCPluginEntry$") - set(CLIENT_STATIC_ENTRY_TYPE "STATIC_ENTRY_DVC") - set(CLIENT_STATIC_ENTRY_INITIALIZER ".csedvc") - elseif(${STATIC_ENTRY} MATCHES "DeviceServiceEntry$") - set(CLIENT_STATIC_ENTRY_TYPE "STATIC_ENTRY_DSE") - set(CLIENT_STATIC_ENTRY_INITIALIZER ".csedse") - else() - set(CLIENT_STATIC_ENTRY_TYPE "STATIC_ENTRY") - set(CLIENT_STATIC_ENTRY_INITIALIZER ".cse") - endif() + set(CLIENT_STATIC_ENTRY_IMPORTS "${CLIENT_STATIC_ENTRY_IMPORTS}\n${${STATIC_ENTRY}_IMPORTS}") + if(${STATIC_ENTRY} STREQUAL "VirtualChannelEntry") + set(CLIENT_STATIC_ENTRY_TYPE "STATIC_ENTRY_VC") + set(CLIENT_STATIC_ENTRY_INITIALIZER ".csevc") + elseif(${STATIC_ENTRY} STREQUAL "VirtualChannelEntryEx") + set(CLIENT_STATIC_ENTRY_TYPE "STATIC_ENTRY_VCEX") + set(CLIENT_STATIC_ENTRY_INITIALIZER ".csevcex") + elseif(${STATIC_ENTRY} MATCHES "DVCPluginEntry$") + set(CLIENT_STATIC_ENTRY_TYPE "STATIC_ENTRY_DVC") + set(CLIENT_STATIC_ENTRY_INITIALIZER ".csedvc") + elseif(${STATIC_ENTRY} MATCHES "DeviceServiceEntry$") + set(CLIENT_STATIC_ENTRY_TYPE "STATIC_ENTRY_DSE") + set(CLIENT_STATIC_ENTRY_INITIALIZER ".csedse") + else() + set(CLIENT_STATIC_ENTRY_TYPE "STATIC_ENTRY") + set(CLIENT_STATIC_ENTRY_INITIALIZER ".cse") + endif() - string(APPEND CLIENT_STATIC_ENTRY_TABLES "\nextern const ${CLIENT_STATIC_ENTRY_TYPE} CLIENT_${STATIC_ENTRY}_TABLE[];\n") - string(APPEND CLIENT_STATIC_ENTRY_TABLES "const ${CLIENT_STATIC_ENTRY_TYPE} CLIENT_${STATIC_ENTRY}_TABLE[] =\n{") - string(APPEND CLIENT_STATIC_ENTRY_TABLES "\n${${STATIC_ENTRY}_TABLE}") - string(APPEND CLIENT_STATIC_ENTRY_TABLES "\n\t{ NULL, NULL }\n};") - string(APPEND CLIENT_STATIC_ENTRY_TABLES_LIST "\n\t{ \"${STATIC_ENTRY}\", { ${CLIENT_STATIC_ENTRY_INITIALIZER} = CLIENT_${STATIC_ENTRY}_TABLE } },") + string(APPEND CLIENT_STATIC_ENTRY_TABLES + "\nextern const ${CLIENT_STATIC_ENTRY_TYPE} CLIENT_${STATIC_ENTRY}_TABLE[];\n" + ) + string(APPEND CLIENT_STATIC_ENTRY_TABLES "const ${CLIENT_STATIC_ENTRY_TYPE} CLIENT_${STATIC_ENTRY}_TABLE[] =\n{") + string(APPEND CLIENT_STATIC_ENTRY_TABLES "\n${${STATIC_ENTRY}_TABLE}") + string(APPEND CLIENT_STATIC_ENTRY_TABLES "\n\t{ NULL, NULL }\n};") + string(APPEND CLIENT_STATIC_ENTRY_TABLES_LIST + "\n\t{ \"${STATIC_ENTRY}\", { ${CLIENT_STATIC_ENTRY_INITIALIZER} = CLIENT_${STATIC_ENTRY}_TABLE } }," + ) endforeach() string(APPEND CLIENT_STATIC_ENTRY_TABLES_LIST "\n\t{ NULL, { .cse = NULL } }\n};") @@ -94,52 +98,62 @@ set(CLIENT_STATIC_ADDIN_TABLE "extern const STATIC_ADDIN_TABLE CLIENT_STATIC_ADD string(APPEND CLIENT_STATIC_ADDIN_TABLE "const STATIC_ADDIN_TABLE CLIENT_STATIC_ADDIN_TABLE[] =\n{") foreach(STATIC_MODULE ${CHANNEL_STATIC_CLIENT_MODULES}) - set(STATIC_MODULE_NAME ${${STATIC_MODULE}_CLIENT_NAME}) - set(STATIC_MODULE_CHANNEL ${${STATIC_MODULE}_CLIENT_CHANNEL}) - string(TOUPPER "CLIENT_${STATIC_MODULE_CHANNEL}_SUBSYSTEM_TABLE" SUBSYSTEM_TABLE_NAME) - set(SUBSYSTEM_TABLE "extern const STATIC_SUBSYSTEM_ENTRY ${SUBSYSTEM_TABLE_NAME}[];\nconst STATIC_SUBSYSTEM_ENTRY ${SUBSYSTEM_TABLE_NAME}[] =\n{") - get_target_property(CHANNEL_SUBSYSTEMS ${STATIC_MODULE_NAME} SUBSYSTEMS) - if(CHANNEL_SUBSYSTEMS MATCHES "NOTFOUND") - set(CHANNEL_SUBSYSTEMS "") - endif() - foreach(STATIC_SUBSYSTEM ${CHANNEL_SUBSYSTEMS}) - if(${STATIC_SUBSYSTEM} MATCHES "^([^-]*)-(.*)") - string(REGEX REPLACE "^([^-]*)-(.*)" "\\1" STATIC_SUBSYSTEM_NAME ${STATIC_SUBSYSTEM}) - string(REGEX REPLACE "^([^-]*)-(.*)" "\\2" STATIC_SUBSYSTEM_TYPE ${STATIC_SUBSYSTEM}) - else() - set(STATIC_SUBSYSTEM_NAME "${STATIC_SUBSYSTEM}") - set(STATIC_SUBSYSTEM_TYPE "") - endif() - string(LENGTH "${STATIC_SUBSYSTEM_TYPE}" _type_length) - set(SUBSYSTEM_MODULE_NAME "${STATIC_MODULE_NAME}-${STATIC_SUBSYSTEM}") - list(APPEND ${MODULE_PREFIX}_LIBS ${SUBSYSTEM_MODULE_NAME}) - if(_type_length GREATER 0) - set(STATIC_SUBSYSTEM_ENTRY "${STATIC_SUBSYSTEM_NAME}_freerdp_${STATIC_MODULE_CHANNEL}_client_${STATIC_SUBSYSTEM_TYPE}_subsystem_entry") - else() - set(STATIC_SUBSYSTEM_ENTRY "${STATIC_SUBSYSTEM_NAME}_freerdp_${STATIC_MODULE_CHANNEL}_client_subsystem_entry") - endif() - string(APPEND SUBSYSTEM_TABLE "\n\t{ \"${STATIC_SUBSYSTEM_NAME}\", \"${STATIC_SUBSYSTEM_TYPE}\", ${STATIC_SUBSYSTEM_ENTRY} },") - set(SUBSYSTEM_IMPORT "extern UINT VCAPITYPE ${STATIC_SUBSYSTEM_ENTRY}(void*);") - string(APPEND CLIENT_STATIC_SUBSYSTEM_IMPORTS "\n${SUBSYSTEM_IMPORT}") - endforeach() - string(APPEND SUBSYSTEM_TABLE "\n\t{ NULL, NULL, NULL }\n};") - string(APPEND CLIENT_STATIC_SUBSYSTEM_TABLES "\n${SUBSYSTEM_TABLE}") + set(STATIC_MODULE_NAME ${${STATIC_MODULE}_CLIENT_NAME}) + set(STATIC_MODULE_CHANNEL ${${STATIC_MODULE}_CLIENT_CHANNEL}) + string(TOUPPER "CLIENT_${STATIC_MODULE_CHANNEL}_SUBSYSTEM_TABLE" SUBSYSTEM_TABLE_NAME) + set(SUBSYSTEM_TABLE + "extern const STATIC_SUBSYSTEM_ENTRY ${SUBSYSTEM_TABLE_NAME}[];\nconst STATIC_SUBSYSTEM_ENTRY ${SUBSYSTEM_TABLE_NAME}[] =\n{" + ) + get_target_property(CHANNEL_SUBSYSTEMS ${STATIC_MODULE_NAME} SUBSYSTEMS) + if(CHANNEL_SUBSYSTEMS MATCHES "NOTFOUND") + set(CHANNEL_SUBSYSTEMS "") + endif() + foreach(STATIC_SUBSYSTEM ${CHANNEL_SUBSYSTEMS}) + if(${STATIC_SUBSYSTEM} MATCHES "^([^-]*)-(.*)") + string(REGEX REPLACE "^([^-]*)-(.*)" "\\1" STATIC_SUBSYSTEM_NAME ${STATIC_SUBSYSTEM}) + string(REGEX REPLACE "^([^-]*)-(.*)" "\\2" STATIC_SUBSYSTEM_TYPE ${STATIC_SUBSYSTEM}) + else() + set(STATIC_SUBSYSTEM_NAME "${STATIC_SUBSYSTEM}") + set(STATIC_SUBSYSTEM_TYPE "") + endif() + string(LENGTH "${STATIC_SUBSYSTEM_TYPE}" _type_length) + set(SUBSYSTEM_MODULE_NAME "${STATIC_MODULE_NAME}-${STATIC_SUBSYSTEM}") + list(APPEND ${MODULE_PREFIX}_LIBS ${SUBSYSTEM_MODULE_NAME}) + if(_type_length GREATER 0) + set(STATIC_SUBSYSTEM_ENTRY + "${STATIC_SUBSYSTEM_NAME}_freerdp_${STATIC_MODULE_CHANNEL}_client_${STATIC_SUBSYSTEM_TYPE}_subsystem_entry" + ) + else() + set(STATIC_SUBSYSTEM_ENTRY "${STATIC_SUBSYSTEM_NAME}_freerdp_${STATIC_MODULE_CHANNEL}_client_subsystem_entry") + endif() + string(APPEND SUBSYSTEM_TABLE + "\n\t{ \"${STATIC_SUBSYSTEM_NAME}\", \"${STATIC_SUBSYSTEM_TYPE}\", ${STATIC_SUBSYSTEM_ENTRY} }," + ) + set(SUBSYSTEM_IMPORT "extern UINT VCAPITYPE ${STATIC_SUBSYSTEM_ENTRY}(void*);") + string(APPEND CLIENT_STATIC_SUBSYSTEM_IMPORTS "\n${SUBSYSTEM_IMPORT}") + endforeach() + string(APPEND SUBSYSTEM_TABLE "\n\t{ NULL, NULL, NULL }\n};") + string(APPEND CLIENT_STATIC_SUBSYSTEM_TABLES "\n${SUBSYSTEM_TABLE}") - foreach(ENTRY ${${STATIC_MODULE}_CLIENT_ENTRY}) - set (ENTRY_POINT_NAME ${STATIC_MODULE_CHANNEL}_${ENTRY}) - if(${ENTRY} STREQUAL "VirtualChannelEntry") - set(ENTRY_INITIALIZER ".csevc") - elseif(${ENTRY} STREQUAL "VirtualChannelEntryEx") - set(ENTRY_INITIALIZER ".csevcex") - elseif(${ENTRY} MATCHES "DVCPluginEntry$") - set(ENTRY_INITIALIZER ".csedvc") - elseif(${ENTRY} MATCHES "DeviceServiceEntry$") - set(ENTRY_INITIALIZER ".csedse") - else() - set(ENTRY_INITIALIZER ".cse") - endif() - string(APPEND CLIENT_STATIC_ADDIN_TABLE "\n\t{ \"${STATIC_MODULE_CHANNEL}\", \"${ENTRY}\", { ${ENTRY_INITIALIZER} = ${ENTRY_POINT_NAME} }, ${SUBSYSTEM_TABLE_NAME} },") - endforeach() + foreach(ENTRY ${${STATIC_MODULE}_CLIENT_ENTRY}) + set(ENTRY_POINT_NAME ${STATIC_MODULE_CHANNEL}_${ENTRY}) + if(${ENTRY} STREQUAL "VirtualChannelEntry") + set(ENTRY_INITIALIZER ".csevc") + elseif(${ENTRY} STREQUAL "VirtualChannelEntryEx") + set(ENTRY_INITIALIZER ".csevcex") + elseif(${ENTRY} MATCHES "DVCPluginEntry$") + set(ENTRY_INITIALIZER ".csedvc") + elseif(${ENTRY} MATCHES "DeviceServiceEntry$") + set(ENTRY_INITIALIZER ".csedse") + else() + set(ENTRY_INITIALIZER ".cse") + endif() + string( + APPEND + CLIENT_STATIC_ADDIN_TABLE + "\n\t{ \"${STATIC_MODULE_CHANNEL}\", \"${ENTRY}\", { ${ENTRY_INITIALIZER} = ${ENTRY_POINT_NAME} }, ${SUBSYSTEM_TABLE_NAME} }," + ) + endforeach() endforeach() string(APPEND CLIENT_STATIC_ADDIN_TABLE "\n\t{ NULL, NULL, { .cse = NULL }, NULL }\n};") diff --git a/channels/cliprdr/CMakeLists.txt b/channels/cliprdr/CMakeLists.txt index c5cfd729e..fb9addd52 100644 --- a/channels/cliprdr/CMakeLists.txt +++ b/channels/cliprdr/CMakeLists.txt @@ -18,9 +18,9 @@ define_channel("cliprdr") if(WITH_CLIENT_CHANNELS) - add_channel_client(${MODULE_PREFIX} ${CHANNEL_NAME}) + add_channel_client(${MODULE_PREFIX} ${CHANNEL_NAME}) endif() if(WITH_SERVER_CHANNELS) - add_channel_server(${MODULE_PREFIX} ${CHANNEL_NAME}) + add_channel_server(${MODULE_PREFIX} ${CHANNEL_NAME}) endif() diff --git a/channels/cliprdr/ChannelOptions.cmake b/channels/cliprdr/ChannelOptions.cmake index f175f3f6a..9464817b6 100644 --- a/channels/cliprdr/ChannelOptions.cmake +++ b/channels/cliprdr/ChannelOptions.cmake @@ -1,13 +1,19 @@ - set(OPTION_DEFAULT OFF) set(OPTION_CLIENT_DEFAULT ON) set(OPTION_SERVER_DEFAULT ON) -define_channel_options(NAME "cliprdr" TYPE "static" - DESCRIPTION "Clipboard Virtual Channel Extension" - SPECIFICATIONS "[MS-RDPECLIP]" - DEFAULT ${OPTION_DEFAULT}) +define_channel_options( + NAME + "cliprdr" + TYPE + "static" + DESCRIPTION + "Clipboard Virtual Channel Extension" + SPECIFICATIONS + "[MS-RDPECLIP]" + DEFAULT + ${OPTION_DEFAULT} +) define_channel_client_options(${OPTION_CLIENT_DEFAULT}) define_channel_server_options(${OPTION_SERVER_DEFAULT}) - diff --git a/channels/cliprdr/client/CMakeLists.txt b/channels/cliprdr/client/CMakeLists.txt index 57819f0e2..956620d41 100644 --- a/channels/cliprdr/client/CMakeLists.txt +++ b/channels/cliprdr/client/CMakeLists.txt @@ -17,16 +17,9 @@ define_channel_client("cliprdr") -set(${MODULE_PREFIX}_SRCS - cliprdr_format.c - cliprdr_format.h - cliprdr_main.c - cliprdr_main.h - ../cliprdr_common.h - ../cliprdr_common.c +set(${MODULE_PREFIX}_SRCS cliprdr_format.c cliprdr_format.h cliprdr_main.c cliprdr_main.h ../cliprdr_common.h + ../cliprdr_common.c ) -set(${MODULE_PREFIX}_LIBS - winpr freerdp -) +set(${MODULE_PREFIX}_LIBS winpr freerdp) add_channel_client_library(${MODULE_PREFIX} ${MODULE_NAME} ${CHANNEL_NAME} FALSE "VirtualChannelEntryEx") diff --git a/channels/cliprdr/server/CMakeLists.txt b/channels/cliprdr/server/CMakeLists.txt index 09c6a7eaf..8b20b9dc8 100644 --- a/channels/cliprdr/server/CMakeLists.txt +++ b/channels/cliprdr/server/CMakeLists.txt @@ -17,14 +17,7 @@ define_channel_server("cliprdr") -set(${MODULE_PREFIX}_SRCS - cliprdr_main.c - cliprdr_main.h - ../cliprdr_common.h - ../cliprdr_common.c -) +set(${MODULE_PREFIX}_SRCS cliprdr_main.c cliprdr_main.h ../cliprdr_common.h ../cliprdr_common.c) -set(${MODULE_PREFIX}_LIBS - freerdp -) +set(${MODULE_PREFIX}_LIBS freerdp) add_channel_server_library(${MODULE_PREFIX} ${MODULE_NAME} ${CHANNEL_NAME} FALSE "VirtualChannelEntry") diff --git a/channels/disp/CMakeLists.txt b/channels/disp/CMakeLists.txt index 44afe99f8..04281c0f3 100644 --- a/channels/disp/CMakeLists.txt +++ b/channels/disp/CMakeLists.txt @@ -18,9 +18,9 @@ define_channel("disp") if(WITH_CLIENT_CHANNELS) - add_channel_client(${MODULE_PREFIX} ${CHANNEL_NAME}) + add_channel_client(${MODULE_PREFIX} ${CHANNEL_NAME}) endif() - + if(WITH_SERVER_CHANNELS) - add_channel_server(${MODULE_PREFIX} ${CHANNEL_NAME}) + add_channel_server(${MODULE_PREFIX} ${CHANNEL_NAME}) endif() diff --git a/channels/disp/ChannelOptions.cmake b/channels/disp/ChannelOptions.cmake index 121f555ce..51f035948 100644 --- a/channels/disp/ChannelOptions.cmake +++ b/channels/disp/ChannelOptions.cmake @@ -1,12 +1,19 @@ - set(OPTION_DEFAULT OFF) set(OPTION_CLIENT_DEFAULT ON) set(OPTION_SERVER_DEFAULT ON) -define_channel_options(NAME "disp" TYPE "dynamic" - DESCRIPTION "Display Update Virtual Channel Extension" - SPECIFICATIONS "[MS-RDPEDISP]" - DEFAULT ${OPTION_DEFAULT}) +define_channel_options( + NAME + "disp" + TYPE + "dynamic" + DESCRIPTION + "Display Update Virtual Channel Extension" + SPECIFICATIONS + "[MS-RDPEDISP]" + DEFAULT + ${OPTION_DEFAULT} +) define_channel_client_options(${OPTION_CLIENT_DEFAULT}) define_channel_server_options(${OPTION_SERVER_DEFAULT}) diff --git a/channels/disp/client/CMakeLists.txt b/channels/disp/client/CMakeLists.txt index d1e1f98f9..6287e09b1 100644 --- a/channels/disp/client/CMakeLists.txt +++ b/channels/disp/client/CMakeLists.txt @@ -17,16 +17,9 @@ define_channel_client("disp") -set(${MODULE_PREFIX}_SRCS - disp_main.c - disp_main.h - ../disp_common.c - ../disp_common.h -) +set(${MODULE_PREFIX}_SRCS disp_main.c disp_main.h ../disp_common.c ../disp_common.h) -set(${MODULE_PREFIX}_LIBS - winpr -) +set(${MODULE_PREFIX}_LIBS winpr) include_directories(..) add_channel_client_library(${MODULE_PREFIX} ${MODULE_NAME} ${CHANNEL_NAME} TRUE "DVCPluginEntry") diff --git a/channels/disp/server/CMakeLists.txt b/channels/disp/server/CMakeLists.txt index 3c0e3b68e..e39f886e8 100644 --- a/channels/disp/server/CMakeLists.txt +++ b/channels/disp/server/CMakeLists.txt @@ -17,16 +17,9 @@ define_channel_server("disp") -set(${MODULE_PREFIX}_SRCS - disp_main.c - disp_main.h - ../disp_common.c - ../disp_common.h -) +set(${MODULE_PREFIX}_SRCS disp_main.c disp_main.h ../disp_common.c ../disp_common.h) -set(${MODULE_PREFIX}_LIBS - freerdp -) +set(${MODULE_PREFIX}_LIBS freerdp) include_directories(..) add_channel_server_library(${MODULE_PREFIX} ${MODULE_NAME} ${CHANNEL_NAME} FALSE "DVCPluginEntry") diff --git a/channels/drdynvc/CMakeLists.txt b/channels/drdynvc/CMakeLists.txt index 9a6ee1ff6..eca79c772 100644 --- a/channels/drdynvc/CMakeLists.txt +++ b/channels/drdynvc/CMakeLists.txt @@ -18,9 +18,9 @@ define_channel("drdynvc") if(WITH_CLIENT_CHANNELS) - add_channel_client(${MODULE_PREFIX} ${CHANNEL_NAME}) + add_channel_client(${MODULE_PREFIX} ${CHANNEL_NAME}) endif() if(WITH_SERVER_CHANNELS) - add_channel_server(${MODULE_PREFIX} ${CHANNEL_NAME}) + add_channel_server(${MODULE_PREFIX} ${CHANNEL_NAME}) endif() diff --git a/channels/drdynvc/ChannelOptions.cmake b/channels/drdynvc/ChannelOptions.cmake index 76376b6bf..c2de24c77 100644 --- a/channels/drdynvc/ChannelOptions.cmake +++ b/channels/drdynvc/ChannelOptions.cmake @@ -1,13 +1,19 @@ - set(OPTION_DEFAULT OFF) set(OPTION_CLIENT_DEFAULT ON) set(OPTION_SERVER_DEFAULT ON) -define_channel_options(NAME "drdynvc" TYPE "static" - DESCRIPTION "Dynamic Virtual Channel Extension" - SPECIFICATIONS "[MS-RDPEDYC]" - DEFAULT ${OPTION_DEFAULT}) +define_channel_options( + NAME + "drdynvc" + TYPE + "static" + DESCRIPTION + "Dynamic Virtual Channel Extension" + SPECIFICATIONS + "[MS-RDPEDYC]" + DEFAULT + ${OPTION_DEFAULT} +) define_channel_client_options(${OPTION_CLIENT_DEFAULT}) define_channel_server_options(${OPTION_SERVER_DEFAULT}) - diff --git a/channels/drdynvc/client/CMakeLists.txt b/channels/drdynvc/client/CMakeLists.txt index 7f8f04a9e..b9cc206c4 100644 --- a/channels/drdynvc/client/CMakeLists.txt +++ b/channels/drdynvc/client/CMakeLists.txt @@ -17,9 +17,6 @@ define_channel_client("drdynvc") -set(${MODULE_PREFIX}_SRCS - drdynvc_main.c - drdynvc_main.h -) +set(${MODULE_PREFIX}_SRCS drdynvc_main.c drdynvc_main.h) add_channel_client_library(${MODULE_PREFIX} ${MODULE_NAME} ${CHANNEL_NAME} FALSE "VirtualChannelEntryEx") diff --git a/channels/drdynvc/server/CMakeLists.txt b/channels/drdynvc/server/CMakeLists.txt index 85b1bd62b..bea05db57 100644 --- a/channels/drdynvc/server/CMakeLists.txt +++ b/channels/drdynvc/server/CMakeLists.txt @@ -17,12 +17,7 @@ define_channel_server("drdynvc") -set(${MODULE_PREFIX}_SRCS - drdynvc_main.c - drdynvc_main.h -) +set(${MODULE_PREFIX}_SRCS drdynvc_main.c drdynvc_main.h) -set(${MODULE_PREFIX}_LIBS - freerdp -) +set(${MODULE_PREFIX}_LIBS freerdp) add_channel_server_library(${MODULE_PREFIX} ${MODULE_NAME} ${CHANNEL_NAME} FALSE "VirtualChannelEntry") diff --git a/channels/drive/CMakeLists.txt b/channels/drive/CMakeLists.txt index f2d2c5a52..b6af794ff 100644 --- a/channels/drive/CMakeLists.txt +++ b/channels/drive/CMakeLists.txt @@ -18,6 +18,5 @@ define_channel("drive") if(WITH_CLIENT_CHANNELS) - add_channel_client(${MODULE_PREFIX} ${CHANNEL_NAME}) + add_channel_client(${MODULE_PREFIX} ${CHANNEL_NAME}) endif() - diff --git a/channels/drive/ChannelOptions.cmake b/channels/drive/ChannelOptions.cmake index 0792c1e47..45b0f6dd5 100644 --- a/channels/drive/ChannelOptions.cmake +++ b/channels/drive/ChannelOptions.cmake @@ -1,13 +1,19 @@ - set(OPTION_DEFAULT OFF) set(OPTION_CLIENT_DEFAULT ON) set(OPTION_SERVER_DEFAULT OFF) -define_channel_options(NAME "drive" TYPE "device" - DESCRIPTION "Drive Redirection Virtual Channel Extension" - SPECIFICATIONS "[MS-RDPEFS]" - DEFAULT ${OPTION_DEFAULT}) +define_channel_options( + NAME + "drive" + TYPE + "device" + DESCRIPTION + "Drive Redirection Virtual Channel Extension" + SPECIFICATIONS + "[MS-RDPEFS]" + DEFAULT + ${OPTION_DEFAULT} +) define_channel_client_options(${OPTION_CLIENT_DEFAULT}) define_channel_server_options(${OPTION_SERVER_DEFAULT}) - diff --git a/channels/drive/client/CMakeLists.txt b/channels/drive/client/CMakeLists.txt index a236f7634..4e239823b 100644 --- a/channels/drive/client/CMakeLists.txt +++ b/channels/drive/client/CMakeLists.txt @@ -17,13 +17,7 @@ define_channel_client("drive") -set(${MODULE_PREFIX}_SRCS - drive_file.c - drive_file.h - drive_main.c -) +set(${MODULE_PREFIX}_SRCS drive_file.c drive_file.h drive_main.c) -set(${MODULE_PREFIX}_LIBS - winpr freerdp -) +set(${MODULE_PREFIX}_LIBS winpr freerdp) add_channel_client_library(${MODULE_PREFIX} ${MODULE_NAME} ${CHANNEL_NAME} TRUE "DeviceServiceEntry") diff --git a/channels/echo/CMakeLists.txt b/channels/echo/CMakeLists.txt index bfa8297c9..35b45a788 100644 --- a/channels/echo/CMakeLists.txt +++ b/channels/echo/CMakeLists.txt @@ -18,9 +18,9 @@ define_channel("echo") if(WITH_CLIENT_CHANNELS) - add_channel_client(${MODULE_PREFIX} ${CHANNEL_NAME}) + add_channel_client(${MODULE_PREFIX} ${CHANNEL_NAME}) endif() if(WITH_SERVER_CHANNELS) - add_channel_server(${MODULE_PREFIX} ${CHANNEL_NAME}) + add_channel_server(${MODULE_PREFIX} ${CHANNEL_NAME}) endif() diff --git a/channels/echo/ChannelOptions.cmake b/channels/echo/ChannelOptions.cmake index eb4950a15..28e761620 100644 --- a/channels/echo/ChannelOptions.cmake +++ b/channels/echo/ChannelOptions.cmake @@ -1,13 +1,19 @@ - set(OPTION_DEFAULT OFF) set(OPTION_CLIENT_DEFAULT ON) set(OPTION_SERVER_DEFAULT ON) -define_channel_options(NAME "echo" TYPE "dynamic" - DESCRIPTION "Echo Virtual Channel Extension" - SPECIFICATIONS "[MS-RDPEECO]" - DEFAULT ${OPTION_DEFAULT}) +define_channel_options( + NAME + "echo" + TYPE + "dynamic" + DESCRIPTION + "Echo Virtual Channel Extension" + SPECIFICATIONS + "[MS-RDPEECO]" + DEFAULT + ${OPTION_DEFAULT} +) define_channel_client_options(${OPTION_CLIENT_DEFAULT}) define_channel_server_options(${OPTION_SERVER_DEFAULT}) - diff --git a/channels/echo/client/CMakeLists.txt b/channels/echo/client/CMakeLists.txt index a66443dd4..777beaf23 100644 --- a/channels/echo/client/CMakeLists.txt +++ b/channels/echo/client/CMakeLists.txt @@ -17,14 +17,9 @@ define_channel_client("echo") -set(${MODULE_PREFIX}_SRCS - echo_main.c - echo_main.h -) +set(${MODULE_PREFIX}_SRCS echo_main.c echo_main.h) -set(${MODULE_PREFIX}_LIBS - winpr -) +set(${MODULE_PREFIX}_LIBS winpr) include_directories(..) add_channel_client_library(${MODULE_PREFIX} ${MODULE_NAME} ${CHANNEL_NAME} TRUE "DVCPluginEntry") diff --git a/channels/echo/server/CMakeLists.txt b/channels/echo/server/CMakeLists.txt index 2d13946b9..b894fb06a 100644 --- a/channels/echo/server/CMakeLists.txt +++ b/channels/echo/server/CMakeLists.txt @@ -17,11 +17,7 @@ define_channel_server("echo") -set(${MODULE_PREFIX}_SRCS - echo_main.c -) +set(${MODULE_PREFIX}_SRCS echo_main.c) -set(${MODULE_PREFIX}_LIBS - freerdp -) +set(${MODULE_PREFIX}_LIBS freerdp) add_channel_server_library(${MODULE_PREFIX} ${MODULE_NAME} ${CHANNEL_NAME} FALSE "DVCPluginEntry") diff --git a/channels/encomsp/CMakeLists.txt b/channels/encomsp/CMakeLists.txt index be2d3748d..f6463049e 100644 --- a/channels/encomsp/CMakeLists.txt +++ b/channels/encomsp/CMakeLists.txt @@ -18,9 +18,9 @@ define_channel("encomsp") if(WITH_CLIENT_CHANNELS) - add_channel_client(${MODULE_PREFIX} ${CHANNEL_NAME}) + add_channel_client(${MODULE_PREFIX} ${CHANNEL_NAME}) endif() if(WITH_SERVER_CHANNELS) - add_channel_server(${MODULE_PREFIX} ${CHANNEL_NAME}) + add_channel_server(${MODULE_PREFIX} ${CHANNEL_NAME}) endif() diff --git a/channels/encomsp/ChannelOptions.cmake b/channels/encomsp/ChannelOptions.cmake index 82ef07eab..3197aa0a5 100644 --- a/channels/encomsp/ChannelOptions.cmake +++ b/channels/encomsp/ChannelOptions.cmake @@ -1,13 +1,19 @@ - set(OPTION_DEFAULT OFF) set(OPTION_CLIENT_DEFAULT ON) set(OPTION_SERVER_DEFAULT ON) -define_channel_options(NAME "encomsp" TYPE "static" - DESCRIPTION "Multiparty Virtual Channel Extension" - SPECIFICATIONS "[MS-RDPEMC]" - DEFAULT ${OPTION_DEFAULT}) +define_channel_options( + NAME + "encomsp" + TYPE + "static" + DESCRIPTION + "Multiparty Virtual Channel Extension" + SPECIFICATIONS + "[MS-RDPEMC]" + DEFAULT + ${OPTION_DEFAULT} +) define_channel_client_options(${OPTION_CLIENT_DEFAULT}) define_channel_server_options(${OPTION_SERVER_DEFAULT}) - diff --git a/channels/encomsp/client/CMakeLists.txt b/channels/encomsp/client/CMakeLists.txt index 59eaa8f16..4bc27e200 100644 --- a/channels/encomsp/client/CMakeLists.txt +++ b/channels/encomsp/client/CMakeLists.txt @@ -19,9 +19,6 @@ define_channel_client("encomsp") include_directories(..) -set(${MODULE_PREFIX}_SRCS - encomsp_main.c - encomsp_main.h -) +set(${MODULE_PREFIX}_SRCS encomsp_main.c encomsp_main.h) add_channel_client_library(${MODULE_PREFIX} ${MODULE_NAME} ${CHANNEL_NAME} FALSE "VirtualChannelEntryEx") diff --git a/channels/encomsp/server/CMakeLists.txt b/channels/encomsp/server/CMakeLists.txt index 096e6d0d2..c23795a33 100644 --- a/channels/encomsp/server/CMakeLists.txt +++ b/channels/encomsp/server/CMakeLists.txt @@ -19,12 +19,7 @@ define_channel_server("encomsp") include_directories(..) -set(${MODULE_PREFIX}_SRCS - encomsp_main.c - encomsp_main.h -) +set(${MODULE_PREFIX}_SRCS encomsp_main.c encomsp_main.h) -set(${MODULE_PREFIX}_LIBS - winpr -) +set(${MODULE_PREFIX}_LIBS winpr) add_channel_server_library(${MODULE_PREFIX} ${MODULE_NAME} ${CHANNEL_NAME} FALSE "VirtualChannelEntry") diff --git a/channels/geometry/CMakeLists.txt b/channels/geometry/CMakeLists.txt index 7ddea6d5e..cf1e76262 100644 --- a/channels/geometry/CMakeLists.txt +++ b/channels/geometry/CMakeLists.txt @@ -18,5 +18,5 @@ define_channel("geometry") if(WITH_CLIENT_CHANNELS) - add_channel_client(${MODULE_PREFIX} ${CHANNEL_NAME}) + add_channel_client(${MODULE_PREFIX} ${CHANNEL_NAME}) endif() diff --git a/channels/geometry/ChannelOptions.cmake b/channels/geometry/ChannelOptions.cmake index 8e8163b4f..681ca15c1 100644 --- a/channels/geometry/ChannelOptions.cmake +++ b/channels/geometry/ChannelOptions.cmake @@ -1,11 +1,18 @@ - set(OPTION_DEFAULT OFF) set(OPTION_CLIENT_DEFAULT ON) set(OPTION_SERVER_DEFAULT OFF) -define_channel_options(NAME "geometry" TYPE "dynamic" - DESCRIPTION "Geometry tracking Virtual Channel Extension" - SPECIFICATIONS "[MS-RDPEGT]" - DEFAULT ${OPTION_DEFAULT}) +define_channel_options( + NAME + "geometry" + TYPE + "dynamic" + DESCRIPTION + "Geometry tracking Virtual Channel Extension" + SPECIFICATIONS + "[MS-RDPEGT]" + DEFAULT + ${OPTION_DEFAULT} +) define_channel_client_options(${OPTION_CLIENT_DEFAULT}) diff --git a/channels/geometry/client/CMakeLists.txt b/channels/geometry/client/CMakeLists.txt index b069bb17e..04908389a 100644 --- a/channels/geometry/client/CMakeLists.txt +++ b/channels/geometry/client/CMakeLists.txt @@ -17,14 +17,9 @@ define_channel_client("geometry") -set(${MODULE_PREFIX}_SRCS - geometry_main.c - geometry_main.h -) +set(${MODULE_PREFIX}_SRCS geometry_main.c geometry_main.h) -set(${MODULE_PREFIX}_LIBS - winpr -) +set(${MODULE_PREFIX}_LIBS winpr) include_directories(..) diff --git a/channels/gfxredir/CMakeLists.txt b/channels/gfxredir/CMakeLists.txt index bfea7571c..5a3027296 100644 --- a/channels/gfxredir/CMakeLists.txt +++ b/channels/gfxredir/CMakeLists.txt @@ -16,8 +16,8 @@ # limitations under the License. if(WITH_CHANNEL_GFXREDIR) - define_channel("gfxredir") - if(WITH_SERVER_CHANNELS) - add_channel_server(${MODULE_PREFIX} ${CHANNEL_NAME}) - endif() + define_channel("gfxredir") + if(WITH_SERVER_CHANNELS) + add_channel_server(${MODULE_PREFIX} ${CHANNEL_NAME}) + endif() endif() diff --git a/channels/gfxredir/ChannelOptions.cmake b/channels/gfxredir/ChannelOptions.cmake index 62cdceba6..e96871e91 100644 --- a/channels/gfxredir/ChannelOptions.cmake +++ b/channels/gfxredir/ChannelOptions.cmake @@ -1,12 +1,20 @@ if(WITH_CHANNEL_GFXREDIR) - set(OPTION_DEFAULT OFF) - set(OPTION_CLIENT_DEFAULT OFF) - set(OPTION_SERVER_DEFAULT ON) + set(OPTION_DEFAULT OFF) + set(OPTION_CLIENT_DEFAULT OFF) + set(OPTION_SERVER_DEFAULT ON) - define_channel_options(NAME "gfxredir" TYPE "dynamic" - DESCRIPTION "Graphics Redirection Virtual Channel Extension" - SPECIFICATIONS "[MS-RDPXXXX]" - DEFAULT ${OPTION_DEFAULT}) + define_channel_options( + NAME + "gfxredir" + TYPE + "dynamic" + DESCRIPTION + "Graphics Redirection Virtual Channel Extension" + SPECIFICATIONS + "[MS-RDPXXXX]" + DEFAULT + ${OPTION_DEFAULT} + ) - define_channel_server_options(${OPTION_SERVER_DEFAULT}) + define_channel_server_options(${OPTION_SERVER_DEFAULT}) endif() diff --git a/channels/gfxredir/server/CMakeLists.txt b/channels/gfxredir/server/CMakeLists.txt index 19a57afcd..49f94fb26 100644 --- a/channels/gfxredir/server/CMakeLists.txt +++ b/channels/gfxredir/server/CMakeLists.txt @@ -17,16 +17,9 @@ define_channel_server("gfxredir") -set(${MODULE_PREFIX}_SRCS - gfxredir_main.c - gfxredir_main.h - ../gfxredir_common.c - ../gfxredir_common.h -) +set(${MODULE_PREFIX}_SRCS gfxredir_main.c gfxredir_main.h ../gfxredir_common.c ../gfxredir_common.h) -set(${MODULE_PREFIX}_LIBS - freerdp -) +set(${MODULE_PREFIX}_LIBS freerdp) include_directories(..) add_channel_server_library(${MODULE_PREFIX} ${MODULE_NAME} ${CHANNEL_NAME} FALSE "DVCPluginEntry") diff --git a/channels/location/CMakeLists.txt b/channels/location/CMakeLists.txt index fbf920cf1..bdeceafa2 100644 --- a/channels/location/CMakeLists.txt +++ b/channels/location/CMakeLists.txt @@ -18,9 +18,9 @@ define_channel("location") if(WITH_CLIENT_CHANNELS) - add_channel_client(${MODULE_PREFIX} ${CHANNEL_NAME}) + add_channel_client(${MODULE_PREFIX} ${CHANNEL_NAME}) endif() if(WITH_SERVER_CHANNELS) - add_channel_server(${MODULE_PREFIX} ${CHANNEL_NAME}) + add_channel_server(${MODULE_PREFIX} ${CHANNEL_NAME}) endif() diff --git a/channels/location/ChannelOptions.cmake b/channels/location/ChannelOptions.cmake index acffc2609..47f9c9eef 100644 --- a/channels/location/ChannelOptions.cmake +++ b/channels/location/ChannelOptions.cmake @@ -1,13 +1,19 @@ - set(OPTION_DEFAULT ON) set(OPTION_CLIENT_DEFAULT ON) set(OPTION_SERVER_DEFAULT ON) -define_channel_options(NAME "location" TYPE "dynamic" - DESCRIPTION "Location Virtual Channel Extension" - SPECIFICATIONS "[MS-RDPEL]" - DEFAULT ${OPTION_DEFAULT}) +define_channel_options( + NAME + "location" + TYPE + "dynamic" + DESCRIPTION + "Location Virtual Channel Extension" + SPECIFICATIONS + "[MS-RDPEL]" + DEFAULT + ${OPTION_DEFAULT} +) define_channel_client_options(${OPTION_CLIENT_DEFAULT}) define_channel_server_options(${OPTION_SERVER_DEFAULT}) - diff --git a/channels/location/client/CMakeLists.txt b/channels/location/client/CMakeLists.txt index 3c5a05aae..57fbd5aa3 100644 --- a/channels/location/client/CMakeLists.txt +++ b/channels/location/client/CMakeLists.txt @@ -18,13 +18,9 @@ define_channel_client("location") -set(${MODULE_PREFIX}_SRCS - location_main.c -) +set(${MODULE_PREFIX}_SRCS location_main.c) -set(${MODULE_PREFIX}_LIBS - winpr -) +set(${MODULE_PREFIX}_LIBS winpr) include_directories(..) add_channel_client_library(${MODULE_PREFIX} ${MODULE_NAME} ${CHANNEL_NAME} TRUE "DVCPluginEntry") diff --git a/channels/location/server/CMakeLists.txt b/channels/location/server/CMakeLists.txt index d37dc75a0..7870016c3 100644 --- a/channels/location/server/CMakeLists.txt +++ b/channels/location/server/CMakeLists.txt @@ -17,12 +17,8 @@ define_channel_server("location") -set(${MODULE_PREFIX}_SRCS - location_main.c -) +set(${MODULE_PREFIX}_SRCS location_main.c) -set(${MODULE_PREFIX}_LIBS - freerdp -) +set(${MODULE_PREFIX}_LIBS freerdp) add_channel_server_library(${MODULE_PREFIX} ${MODULE_NAME} ${CHANNEL_NAME} FALSE "DVCPluginEntry") diff --git a/channels/parallel/CMakeLists.txt b/channels/parallel/CMakeLists.txt index 0faabb527..9475c56af 100644 --- a/channels/parallel/CMakeLists.txt +++ b/channels/parallel/CMakeLists.txt @@ -18,5 +18,5 @@ define_channel("parallel") if(WITH_CLIENT_CHANNELS) - add_channel_client(${MODULE_PREFIX} ${CHANNEL_NAME}) + add_channel_client(${MODULE_PREFIX} ${CHANNEL_NAME}) endif() diff --git a/channels/parallel/ChannelOptions.cmake b/channels/parallel/ChannelOptions.cmake index d3c70ec4f..dff863cca 100644 --- a/channels/parallel/ChannelOptions.cmake +++ b/channels/parallel/ChannelOptions.cmake @@ -1,31 +1,37 @@ - set(OPTION_DEFAULT OFF) set(OPTION_CLIENT_DEFAULT ON) set(OPTION_SERVER_DEFAULT OFF) if(WIN32) - set(OPTION_CLIENT_DEFAULT OFF) - set(OPTION_SERVER_DEFAULT OFF) - message("Serial redirection not supported on windows") + set(OPTION_CLIENT_DEFAULT OFF) + set(OPTION_SERVER_DEFAULT OFF) + message("Serial redirection not supported on windows") endif() if(APPLE) - set(OPTION_CLIENT_DEFAULT OFF) - set(OPTION_SERVER_DEFAULT OFF) - message("Serial redirection not supported on apple") + set(OPTION_CLIENT_DEFAULT OFF) + set(OPTION_SERVER_DEFAULT OFF) + message("Serial redirection not supported on apple") endif() if(ANDROID) - set(OPTION_CLIENT_DEFAULT OFF) - set(OPTION_SERVER_DEFAULT OFF) - message("Serial redirection not supported on android") + set(OPTION_CLIENT_DEFAULT OFF) + set(OPTION_SERVER_DEFAULT OFF) + message("Serial redirection not supported on android") endif() -define_channel_options(NAME "parallel" TYPE "device" - DESCRIPTION "Parallel Port Virtual Channel Extension" - SPECIFICATIONS "[MS-RDPESP]" - DEFAULT ${OPTION_DEFAULT}) +define_channel_options( + NAME + "parallel" + TYPE + "device" + DESCRIPTION + "Parallel Port Virtual Channel Extension" + SPECIFICATIONS + "[MS-RDPESP]" + DEFAULT + ${OPTION_DEFAULT} +) define_channel_client_options(${OPTION_CLIENT_DEFAULT}) define_channel_server_options(${OPTION_SERVER_DEFAULT}) - diff --git a/channels/parallel/client/CMakeLists.txt b/channels/parallel/client/CMakeLists.txt index d783ead53..35da0e6d1 100644 --- a/channels/parallel/client/CMakeLists.txt +++ b/channels/parallel/client/CMakeLists.txt @@ -17,11 +17,7 @@ define_channel_client("parallel") -set(${MODULE_PREFIX}_SRCS - parallel_main.c -) +set(${MODULE_PREFIX}_SRCS parallel_main.c) -set(${MODULE_PREFIX}_LIBS - winpr freerdp -) +set(${MODULE_PREFIX}_LIBS winpr freerdp) add_channel_client_library(${MODULE_PREFIX} ${MODULE_NAME} ${CHANNEL_NAME} TRUE "DeviceServiceEntry") diff --git a/channels/printer/CMakeLists.txt b/channels/printer/CMakeLists.txt index 73cb415a4..39a20992e 100644 --- a/channels/printer/CMakeLists.txt +++ b/channels/printer/CMakeLists.txt @@ -18,5 +18,5 @@ define_channel("printer") if(WITH_CLIENT_CHANNELS) - add_channel_client(${MODULE_PREFIX} ${CHANNEL_NAME}) -endif() \ No newline at end of file + add_channel_client(${MODULE_PREFIX} ${CHANNEL_NAME}) +endif() diff --git a/channels/printer/ChannelOptions.cmake b/channels/printer/ChannelOptions.cmake index 2989ba532..fbca61bcd 100644 --- a/channels/printer/ChannelOptions.cmake +++ b/channels/printer/ChannelOptions.cmake @@ -1,33 +1,39 @@ - set(OPTION_DEFAULT OFF) set(OPTION_CLIENT_DEFAULT ON) set(OPTION_SERVER_DEFAULT OFF) if(WIN32) - set(OPTION_CLIENT_DEFAULT ON) - set(OPTION_SERVER_DEFAULT OFF) + set(OPTION_CLIENT_DEFAULT ON) + set(OPTION_SERVER_DEFAULT OFF) else() - # cups is available on mac os and linux by default, on android it is optional. - if (NOT IOS AND NOT ANDROID) - set(CUPS_DEFAULT ON) - else() - set(CUPS_DEFAULT OFF) - endif() - option(WITH_CUPS "CUPS printer support" ${CUPS_DEFAULT}) - if(WITH_CUPS) - set(OPTION_CLIENT_DEFAULT ON) - set(OPTION_SERVER_DEFAULT OFF) - else() - set(OPTION_CLIENT_DEFAULT OFF) - set(OPTION_SERVER_DEFAULT OFF) - endif() + # cups is available on mac os and linux by default, on android it is optional. + if(NOT IOS AND NOT ANDROID) + set(CUPS_DEFAULT ON) + else() + set(CUPS_DEFAULT OFF) + endif() + option(WITH_CUPS "CUPS printer support" ${CUPS_DEFAULT}) + if(WITH_CUPS) + set(OPTION_CLIENT_DEFAULT ON) + set(OPTION_SERVER_DEFAULT OFF) + else() + set(OPTION_CLIENT_DEFAULT OFF) + set(OPTION_SERVER_DEFAULT OFF) + endif() endif() -define_channel_options(NAME "printer" TYPE "device" - DESCRIPTION "Print Virtual Channel Extension" - SPECIFICATIONS "[MS-RDPEPC]" - DEFAULT ${OPTION_DEFAULT}) +define_channel_options( + NAME + "printer" + TYPE + "device" + DESCRIPTION + "Print Virtual Channel Extension" + SPECIFICATIONS + "[MS-RDPEPC]" + DEFAULT + ${OPTION_DEFAULT} +) define_channel_client_options(${OPTION_CLIENT_DEFAULT}) define_channel_server_options(${OPTION_SERVER_DEFAULT}) - diff --git a/channels/printer/client/CMakeLists.txt b/channels/printer/client/CMakeLists.txt index e7bab091d..c3769a781 100644 --- a/channels/printer/client/CMakeLists.txt +++ b/channels/printer/client/CMakeLists.txt @@ -17,19 +17,15 @@ define_channel_client("printer") -set(${MODULE_PREFIX}_SRCS - printer_main.c -) +set(${MODULE_PREFIX}_SRCS printer_main.c) -set(${MODULE_PREFIX}_LIBS - winpr freerdp -) +set(${MODULE_PREFIX}_LIBS winpr freerdp) add_channel_client_library(${MODULE_PREFIX} ${MODULE_NAME} ${CHANNEL_NAME} TRUE "DeviceServiceEntry") if(WITH_CUPS) - add_channel_client_subsystem(${MODULE_PREFIX} ${CHANNEL_NAME} "cups" "") + add_channel_client_subsystem(${MODULE_PREFIX} ${CHANNEL_NAME} "cups" "") endif() if(WIN32 AND NOT UWP) - add_channel_client_subsystem(${MODULE_PREFIX} ${CHANNEL_NAME} "win" "") + add_channel_client_subsystem(${MODULE_PREFIX} ${CHANNEL_NAME} "win" "") endif() diff --git a/channels/printer/client/cups/CMakeLists.txt b/channels/printer/client/cups/CMakeLists.txt index 9181b3003..cde1ce4a6 100644 --- a/channels/printer/client/cups/CMakeLists.txt +++ b/channels/printer/client/cups/CMakeLists.txt @@ -18,14 +18,9 @@ define_channel_client_subsystem("printer" "cups" "") find_package(Cups 2.0 REQUIRED) -set(${MODULE_PREFIX}_SRCS - printer_cups.c) +set(${MODULE_PREFIX}_SRCS printer_cups.c) -set(${MODULE_PREFIX}_LIBS - winpr - freerdp - ${CUPS_LIBRARIES} -) +set(${MODULE_PREFIX}_LIBS winpr freerdp ${CUPS_LIBRARIES}) include_directories(..) include_directories(SYSTEM ${CUPS_INCLUDE_DIRS}) diff --git a/channels/printer/client/win/CMakeLists.txt b/channels/printer/client/win/CMakeLists.txt index 7f0960a19..454683b22 100644 --- a/channels/printer/client/win/CMakeLists.txt +++ b/channels/printer/client/win/CMakeLists.txt @@ -17,13 +17,9 @@ # limitations under the License. define_channel_client_subsystem("printer" "win" "") -set(${MODULE_PREFIX}_SRCS - printer_win.c) +set(${MODULE_PREFIX}_SRCS printer_win.c) -set(${MODULE_PREFIX}_LIBS - winpr - freerdp -) +set(${MODULE_PREFIX}_LIBS winpr freerdp) include_directories(..) diff --git a/channels/rail/CMakeLists.txt b/channels/rail/CMakeLists.txt index d372dda35..2d0c07320 100644 --- a/channels/rail/CMakeLists.txt +++ b/channels/rail/CMakeLists.txt @@ -18,9 +18,9 @@ define_channel("rail") if(WITH_CLIENT_CHANNELS) - add_channel_client(${MODULE_PREFIX} ${CHANNEL_NAME}) + add_channel_client(${MODULE_PREFIX} ${CHANNEL_NAME}) endif() if(WITH_SERVER_CHANNELS) - add_channel_server(${MODULE_PREFIX} ${CHANNEL_NAME}) + add_channel_server(${MODULE_PREFIX} ${CHANNEL_NAME}) endif() diff --git a/channels/rail/ChannelOptions.cmake b/channels/rail/ChannelOptions.cmake index 4284cfedb..0b1170e82 100644 --- a/channels/rail/ChannelOptions.cmake +++ b/channels/rail/ChannelOptions.cmake @@ -1,13 +1,19 @@ - set(OPTION_DEFAULT OFF) set(OPTION_CLIENT_DEFAULT ON) set(OPTION_SERVER_DEFAULT ON) -define_channel_options(NAME "rail" TYPE "static" - DESCRIPTION "Remote Programs Virtual Channel Extension" - SPECIFICATIONS "[MS-RDPERP]" - DEFAULT ${OPTION_DEFAULT}) +define_channel_options( + NAME + "rail" + TYPE + "static" + DESCRIPTION + "Remote Programs Virtual Channel Extension" + SPECIFICATIONS + "[MS-RDPERP]" + DEFAULT + ${OPTION_DEFAULT} +) define_channel_client_options(${OPTION_CLIENT_DEFAULT}) define_channel_server_options(${OPTION_SERVER_DEFAULT}) - diff --git a/channels/rail/client/CMakeLists.txt b/channels/rail/client/CMakeLists.txt index ad274b0f2..5227766fa 100644 --- a/channels/rail/client/CMakeLists.txt +++ b/channels/rail/client/CMakeLists.txt @@ -18,16 +18,14 @@ define_channel_client("rail") set(${MODULE_PREFIX}_SRCS - ../rail_common.h - ../rail_common.c - client_rails.c - rail_main.c - rail_main.h - rail_orders.c - rail_orders.h + ../rail_common.h + ../rail_common.c + client_rails.c + rail_main.c + rail_main.h + rail_orders.c + rail_orders.h ) -set(${MODULE_PREFIX}_LIBS - freerdp -) +set(${MODULE_PREFIX}_LIBS freerdp) add_channel_client_library(${MODULE_PREFIX} ${MODULE_NAME} ${CHANNEL_NAME} FALSE "VirtualChannelEntryEx") diff --git a/channels/rail/server/CMakeLists.txt b/channels/rail/server/CMakeLists.txt index f8f64be92..76734b05f 100644 --- a/channels/rail/server/CMakeLists.txt +++ b/channels/rail/server/CMakeLists.txt @@ -17,16 +17,9 @@ define_channel_server("rail") -set(${MODULE_PREFIX}_SRCS - ../rail_common.c - ../rail_common.h - rail_main.c - rail_main.h -) +set(${MODULE_PREFIX}_SRCS ../rail_common.c ../rail_common.h rail_main.c rail_main.h) -set(${MODULE_PREFIX}_LIBS - freerdp -) +set(${MODULE_PREFIX}_LIBS freerdp) include_directories(..) diff --git a/channels/rdp2tcp/CMakeLists.txt b/channels/rdp2tcp/CMakeLists.txt index 31de127c7..3d0bf4667 100644 --- a/channels/rdp2tcp/CMakeLists.txt +++ b/channels/rdp2tcp/CMakeLists.txt @@ -18,5 +18,5 @@ define_channel("rdp2tcp") if(WITH_CLIENT_CHANNELS) - add_channel_client(${MODULE_PREFIX} ${CHANNEL_NAME}) + add_channel_client(${MODULE_PREFIX} ${CHANNEL_NAME}) endif() diff --git a/channels/rdp2tcp/ChannelOptions.cmake b/channels/rdp2tcp/ChannelOptions.cmake index 3cad9b1ad..502510da9 100644 --- a/channels/rdp2tcp/ChannelOptions.cmake +++ b/channels/rdp2tcp/ChannelOptions.cmake @@ -2,9 +2,16 @@ set(OPTION_DEFAULT OFF) set(OPTION_CLIENT_DEFAULT ON) set(OPTION_SERVER_DEFAULT OFF) -define_channel_options(NAME "rdp2tcp" TYPE "static" - DESCRIPTION "Tunneling TCP over RDP" - DEFAULT ${OPTION_DEFAULT}) +define_channel_options( + NAME + "rdp2tcp" + TYPE + "static" + DESCRIPTION + "Tunneling TCP over RDP" + DEFAULT + ${OPTION_DEFAULT} +) define_channel_client_options(${OPTION_CLIENT_DEFAULT}) define_channel_server_options(${OPTION_SERVER_DEFAULT}) diff --git a/channels/rdp2tcp/client/CMakeLists.txt b/channels/rdp2tcp/client/CMakeLists.txt index f7bdd20e2..1c9c03bda 100644 --- a/channels/rdp2tcp/client/CMakeLists.txt +++ b/channels/rdp2tcp/client/CMakeLists.txt @@ -17,11 +17,7 @@ define_channel_client("rdp2tcp") -set(${MODULE_PREFIX}_SRCS - rdp2tcp_main.c -) +set(${MODULE_PREFIX}_SRCS rdp2tcp_main.c) -set(${MODULE_PREFIX}_LIBS - freerdp -) +set(${MODULE_PREFIX}_LIBS freerdp) add_channel_client_library(${MODULE_PREFIX} ${MODULE_NAME} ${CHANNEL_NAME} TRUE "VirtualChannelEntryEx") diff --git a/channels/rdpdr/CMakeLists.txt b/channels/rdpdr/CMakeLists.txt index e9b418159..76326be05 100644 --- a/channels/rdpdr/CMakeLists.txt +++ b/channels/rdpdr/CMakeLists.txt @@ -18,9 +18,9 @@ define_channel("rdpdr") if(WITH_CLIENT_CHANNELS) - add_channel_client(${MODULE_PREFIX} ${CHANNEL_NAME}) + add_channel_client(${MODULE_PREFIX} ${CHANNEL_NAME}) endif() if(WITH_SERVER_CHANNELS) - add_channel_server(${MODULE_PREFIX} ${CHANNEL_NAME}) + add_channel_server(${MODULE_PREFIX} ${CHANNEL_NAME}) endif() diff --git a/channels/rdpdr/ChannelOptions.cmake b/channels/rdpdr/ChannelOptions.cmake index 9a966768c..3a4792fd4 100644 --- a/channels/rdpdr/ChannelOptions.cmake +++ b/channels/rdpdr/ChannelOptions.cmake @@ -1,13 +1,19 @@ - set(OPTION_DEFAULT OFF) set(OPTION_CLIENT_DEFAULT ON) set(OPTION_SERVER_DEFAULT ON) -define_channel_options(NAME "rdpdr" TYPE "static" - DESCRIPTION "Device Redirection Virtual Channel Extension" - SPECIFICATIONS "[MS-RDPEFS] [MS-RDPEPC] [MS-RDPESC] [MS-RDPESP]" - DEFAULT ${OPTION_DEFAULT}) +define_channel_options( + NAME + "rdpdr" + TYPE + "static" + DESCRIPTION + "Device Redirection Virtual Channel Extension" + SPECIFICATIONS + "[MS-RDPEFS] [MS-RDPEPC] [MS-RDPESC] [MS-RDPESP]" + DEFAULT + ${OPTION_DEFAULT} +) define_channel_client_options(${OPTION_CLIENT_DEFAULT}) define_channel_server_options(${OPTION_SERVER_DEFAULT}) - diff --git a/channels/rdpdr/client/CMakeLists.txt b/channels/rdpdr/client/CMakeLists.txt index e2e589356..3e60c2b46 100644 --- a/channels/rdpdr/client/CMakeLists.txt +++ b/channels/rdpdr/client/CMakeLists.txt @@ -19,30 +19,26 @@ define_channel_client("rdpdr") -include (CheckFunctionExists) +include(CheckFunctionExists) check_function_exists(getmntent_r FREERDP_HAVE_GETMNTENT_R) -if (FREERDP_HAVE_GETMNTENT_R) - add_definitions(-DFREERDP_HAVE_GETMNTENT_R) +if(FREERDP_HAVE_GETMNTENT_R) + add_definitions(-DFREERDP_HAVE_GETMNTENT_R) endif() set(${MODULE_PREFIX}_SRCS - irp.c - irp.h - devman.c - devman.h - rdpdr_main.c - rdpdr_main.h - rdpdr_capabilities.c - rdpdr_capabilities.h + irp.c + irp.h + devman.c + devman.h + rdpdr_main.c + rdpdr_main.h + rdpdr_capabilities.c + rdpdr_capabilities.h ) -set(${MODULE_PREFIX}_LIBS - winpr freerdp -) +set(${MODULE_PREFIX}_LIBS winpr freerdp) if(APPLE AND (NOT IOS)) - find_library(CORESERVICES_LIBRARY CoreServices) - list(APPEND ${MODULE_PREFIX}_LIBS - ${CORESERVICES_LIBRARY} - ) + find_library(CORESERVICES_LIBRARY CoreServices) + list(APPEND ${MODULE_PREFIX}_LIBS ${CORESERVICES_LIBRARY}) endif() add_channel_client_library(${MODULE_PREFIX} ${MODULE_NAME} ${CHANNEL_NAME} FALSE "VirtualChannelEntryEx") diff --git a/channels/rdpdr/server/CMakeLists.txt b/channels/rdpdr/server/CMakeLists.txt index 7d1f7e5bf..96112aef0 100644 --- a/channels/rdpdr/server/CMakeLists.txt +++ b/channels/rdpdr/server/CMakeLists.txt @@ -17,13 +17,8 @@ define_channel_server("rdpdr") -set(${MODULE_PREFIX}_SRCS - rdpdr_main.c - rdpdr_main.h -) +set(${MODULE_PREFIX}_SRCS rdpdr_main.c rdpdr_main.h) -set(${MODULE_PREFIX}_LIBS - freerdp -) +set(${MODULE_PREFIX}_LIBS freerdp) add_channel_server_library(${MODULE_PREFIX} ${MODULE_NAME} ${CHANNEL_NAME} FALSE "VirtualChannelEntry") diff --git a/channels/rdpear/CMakeLists.txt b/channels/rdpear/CMakeLists.txt index 8d0766200..7de40d6c1 100644 --- a/channels/rdpear/CMakeLists.txt +++ b/channels/rdpear/CMakeLists.txt @@ -15,24 +15,24 @@ # See the License for the specific language governing permissions and # limitations under the License. -if (NOT IOS AND NOT WIN32 AND NOT ANDROID) - find_package(KRB5) +if(NOT IOS AND NOT WIN32 AND NOT ANDROID) + find_package(KRB5) - if(KRB5_FOUND) - define_channel("rdpear") + if(KRB5_FOUND) + define_channel("rdpear") - include_directories(common) + include_directories(common) - if(WITH_CLIENT_CHANNELS OR WITH_SERVER_CHANNELS) - add_subdirectory(common) - endif() - - if(WITH_CLIENT_CHANNELS) - add_channel_client(${MODULE_PREFIX} ${CHANNEL_NAME}) - endif() - - #if(WITH_SERVER_CHANNELS) - # add_channel_server(${MODULE_PREFIX} ${CHANNEL_NAME}) - #endif() + if(WITH_CLIENT_CHANNELS OR WITH_SERVER_CHANNELS) + add_subdirectory(common) endif() + + if(WITH_CLIENT_CHANNELS) + add_channel_client(${MODULE_PREFIX} ${CHANNEL_NAME}) + endif() + + #if(WITH_SERVER_CHANNELS) + # add_channel_server(${MODULE_PREFIX} ${CHANNEL_NAME}) + #endif() + endif() endif() diff --git a/channels/rdpear/ChannelOptions.cmake b/channels/rdpear/ChannelOptions.cmake index f48a0eab3..3ee004b78 100644 --- a/channels/rdpear/ChannelOptions.cmake +++ b/channels/rdpear/ChannelOptions.cmake @@ -1,13 +1,19 @@ - set(OPTION_DEFAULT OFF) set(OPTION_CLIENT_DEFAULT OFF) set(OPTION_SERVER_DEFAULT OFF) -define_channel_options(NAME "rdpear" TYPE "dynamic" - DESCRIPTION "Authentication redirection Virtual Channel Extension" - SPECIFICATIONS "[MS-RDPEAR]" - DEFAULT ${OPTION_DEFAULT}) +define_channel_options( + NAME + "rdpear" + TYPE + "dynamic" + DESCRIPTION + "Authentication redirection Virtual Channel Extension" + SPECIFICATIONS + "[MS-RDPEAR]" + DEFAULT + ${OPTION_DEFAULT} +) define_channel_client_options(${OPTION_CLIENT_DEFAULT}) define_channel_server_options(${OPTION_SERVER_DEFAULT}) - diff --git a/channels/rdpear/client/CMakeLists.txt b/channels/rdpear/client/CMakeLists.txt index 29d66f59b..6f5d1bb8f 100644 --- a/channels/rdpear/client/CMakeLists.txt +++ b/channels/rdpear/client/CMakeLists.txt @@ -17,15 +17,8 @@ define_channel_client("rdpear") -set(${MODULE_PREFIX}_SRCS - rdpear_main.c -) +set(${MODULE_PREFIX}_SRCS rdpear_main.c) -set(${MODULE_PREFIX}_LIBS - winpr - freerdp - rdpear-common -) +set(${MODULE_PREFIX}_LIBS winpr freerdp rdpear-common) add_channel_client_library(${MODULE_PREFIX} ${MODULE_NAME} ${CHANNEL_NAME} TRUE "DVCPluginEntry") - diff --git a/channels/rdpear/common/CMakeLists.txt b/channels/rdpear/common/CMakeLists.txt index 53ea034c4..654940b01 100644 --- a/channels/rdpear/common/CMakeLists.txt +++ b/channels/rdpear/common/CMakeLists.txt @@ -16,43 +16,22 @@ # limitations under the License. add_library(rdpear-common INTERFACE) -add_library(rdpear-common-obj OBJECT - ndr.c - rdpear_asn1.c - rdpear_common.c - rdpear-common/ndr.h - rdpear-common/rdpear_asn1.h - rdpear-common/rdpear_common.h +add_library( + rdpear-common-obj OBJECT ndr.c rdpear_asn1.c rdpear_common.c rdpear-common/ndr.h rdpear-common/rdpear_asn1.h + rdpear-common/rdpear_common.h ) -target_include_directories(rdpear-common - SYSTEM - INTERFACE ${KRB5_INCLUDE_DIRS} -) -target_compile_options(rdpear-common - INTERFACE - ${KRB5_CFLAGS} -) -target_link_options(rdpear-common - INTERFACE - ${KRB5_LDFLAGS} -) +target_include_directories(rdpear-common SYSTEM INTERFACE ${KRB5_INCLUDE_DIRS}) +target_compile_options(rdpear-common INTERFACE ${KRB5_CFLAGS}) +target_link_options(rdpear-common INTERFACE ${KRB5_LDFLAGS}) -target_include_directories(rdpear-common-obj - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} -) -target_include_directories(rdpear-common-obj - SYSTEM - PRIVATE ${KRB5_INCLUDE_DIRS} -) +target_include_directories(rdpear-common-obj PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) +target_include_directories(rdpear-common-obj SYSTEM PRIVATE ${KRB5_INCLUDE_DIRS}) target_link_directories(rdpear-common INTERFACE ${KRB5_LIBRARY_DIRS}) -target_link_libraries(rdpear-common INTERFACE - ${KRB5_LIBRARIES} - $ -) +target_link_libraries(rdpear-common INTERFACE ${KRB5_LIBRARIES} $) channel_install(rdpear-common ${FREERDP_ADDIN_PATH} "FreeRDPTargets") -if (BUILD_TESTING_INTERNAL OR BUILD_TESTING) - add_subdirectory(test) +if(BUILD_TESTING_INTERNAL OR BUILD_TESTING) + add_subdirectory(test) endif() diff --git a/channels/rdpear/common/test/CMakeLists.txt b/channels/rdpear/common/test/CMakeLists.txt index ce0c4cb23..c5751f2b9 100644 --- a/channels/rdpear/common/test/CMakeLists.txt +++ b/channels/rdpear/common/test/CMakeLists.txt @@ -1,4 +1,3 @@ - set(MODULE_NAME "TestRdpear") set(MODULE_PREFIX "TEST_RDPEAR") @@ -6,20 +5,13 @@ set(TEST_RDPEAR_DRIVER TestRdpear.c) disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR}) -set(TEST_RDPEAR_TESTS - TestNdr.c -) +set(TEST_RDPEAR_TESTS TestNdr.c) -if (BUILD_TESTING_INTERNAL) - list(APPEND TEST_RDPEAR_TESTS - TestNdrEar.c - ) +if(BUILD_TESTING_INTERNAL) + list(APPEND TEST_RDPEAR_TESTS TestNdrEar.c) endif() -create_test_sourcelist(TEST_RDPEAR_SRCS - TestRdpear.c - ${TEST_RDPEAR_TESTS} -) +create_test_sourcelist(TEST_RDPEAR_SRCS TestRdpear.c ${TEST_RDPEAR_TESTS}) add_executable(${MODULE_NAME} ${TEST_RDPEAR_SRCS}) @@ -28,13 +20,11 @@ add_definitions(-DTESTING_SRC_DIRECTORY="${PROJECT_SOURCE_DIR}") target_link_libraries(${MODULE_NAME} freerdp winpr freerdp-client) - set_target_properties(${MODULE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TESTING_OUTPUT_DIRECTORY}") foreach(test ${${MODULE_PREFIX}_TESTS}) - get_filename_component(TestName ${test} NAME_WE) - add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) + get_filename_component(TestName ${test} NAME_WE) + add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) endforeach() set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "FreeRDP/Rdpear/Test") - diff --git a/channels/rdpecam/CMakeLists.txt b/channels/rdpecam/CMakeLists.txt index 1df57afc3..525d8d041 100644 --- a/channels/rdpecam/CMakeLists.txt +++ b/channels/rdpecam/CMakeLists.txt @@ -18,12 +18,12 @@ define_channel("rdpecam") if(WITH_SERVER_CHANNELS) - add_channel_server(${MODULE_PREFIX} ${CHANNEL_NAME}) + add_channel_server(${MODULE_PREFIX} ${CHANNEL_NAME}) endif() if(WITH_CLIENT_CHANNELS) - option(RDPECAM_CLIENT_CHANNEL_STUB "Only build [MS-RDPECAM] channel stub" OFF) - if (NOT RDPECAM_CLIENT_CHANNEL_STUB) - add_channel_client(${MODULE_PREFIX} ${CHANNEL_NAME}) - endif() + option(RDPECAM_CLIENT_CHANNEL_STUB "Only build [MS-RDPECAM] channel stub" OFF) + if(NOT RDPECAM_CLIENT_CHANNEL_STUB) + add_channel_client(${MODULE_PREFIX} ${CHANNEL_NAME}) + endif() endif() diff --git a/channels/rdpecam/ChannelOptions.cmake b/channels/rdpecam/ChannelOptions.cmake index b094e03a0..42ae2bd28 100644 --- a/channels/rdpecam/ChannelOptions.cmake +++ b/channels/rdpecam/ChannelOptions.cmake @@ -1,13 +1,19 @@ - set(OPTION_DEFAULT ON) set(OPTION_CLIENT_DEFAULT OFF) set(OPTION_SERVER_DEFAULT ON) -define_channel_options(NAME "rdpecam" TYPE "dynamic" - DESCRIPTION "Video Capture Virtual Channel Extension" - SPECIFICATIONS "[MS-RDPECAM]" - DEFAULT ${OPTION_DEFAULT}) +define_channel_options( + NAME + "rdpecam" + TYPE + "dynamic" + DESCRIPTION + "Video Capture Virtual Channel Extension" + SPECIFICATIONS + "[MS-RDPECAM]" + DEFAULT + ${OPTION_DEFAULT} +) define_channel_server_options(${OPTION_SERVER_DEFAULT}) define_channel_client_options(${OPTION_CLIENT_DEFAULT}) - diff --git a/channels/rdpecam/client/CMakeLists.txt b/channels/rdpecam/client/CMakeLists.txt index 2fa73255f..6e67d955e 100644 --- a/channels/rdpecam/client/CMakeLists.txt +++ b/channels/rdpecam/client/CMakeLists.txt @@ -18,46 +18,37 @@ define_channel_client("rdpecam") if(NOT WITH_SWSCALE OR NOT WITH_FFMPEG) - message(FATAL_ERROR "WITH_FFMPEG and WITH_SWSCALE required for CHANNEL_RDPECAM_CLIENT") + message(FATAL_ERROR "WITH_FFMPEG and WITH_SWSCALE required for CHANNEL_RDPECAM_CLIENT") endif() # currently camera redirect client supported for platforms with Video4Linux only find_package(FFmpeg REQUIRED COMPONENTS SWSCALE) find_package(V4L) if(V4L_FOUND) - set(WITH_V4L ON) - add_definitions("-DWITH_V4L") + set(WITH_V4L ON) + add_definitions("-DWITH_V4L") else() - message(FATAL_ERROR "libv4l-dev required for CHANNEL_RDPECAM_CLIENT") + message(FATAL_ERROR "libv4l-dev required for CHANNEL_RDPECAM_CLIENT") endif() option(RDPECAM_INPUT_FORMAT_H264 "[MS-RDPECAM] Enable H264 camera format (passthrough)" ON) if(RDPECAM_INPUT_FORMAT_H264) - add_definitions("-DWITH_INPUT_FORMAT_H264") + add_definitions("-DWITH_INPUT_FORMAT_H264") endif() option(RDPECAM_INPUT_FORMAT_MJPG "[MS-RDPECAM] Enable MJPG camera format" ON) if(RDPECAM_INPUT_FORMAT_MJPG) - add_definitions("-DWITH_INPUT_FORMAT_MJPG") + add_definitions("-DWITH_INPUT_FORMAT_MJPG") endif() include_directories(SYSTEM ${SWSCALE_INCLUDE_DIRS}) -set(${MODULE_PREFIX}_SRCS - camera_device_enum_main.c - camera_device_main.c - encoding.c -) +set(${MODULE_PREFIX}_SRCS camera_device_enum_main.c camera_device_main.c encoding.c) -set(${MODULE_PREFIX}_LIBS - freerdp - winpr - ${SWSCALE_LIBRARIES} - ${FFMPEG_LIBRARIES} -) +set(${MODULE_PREFIX}_LIBS freerdp winpr ${SWSCALE_LIBRARIES} ${FFMPEG_LIBRARIES}) add_channel_client_library(${MODULE_PREFIX} ${MODULE_NAME} ${CHANNEL_NAME} TRUE "DVCPluginEntry") if(V4L_FOUND) - add_channel_client_subsystem(${MODULE_PREFIX} ${CHANNEL_NAME} "v4l" "") + add_channel_client_subsystem(${MODULE_PREFIX} ${CHANNEL_NAME} "v4l" "") endif() diff --git a/channels/rdpecam/client/v4l/CMakeLists.txt b/channels/rdpecam/client/v4l/CMakeLists.txt index 016bbde89..4b102caa5 100644 --- a/channels/rdpecam/client/v4l/CMakeLists.txt +++ b/channels/rdpecam/client/v4l/CMakeLists.txt @@ -17,20 +17,14 @@ if(WITH_V4L) - define_channel_client_subsystem("rdpecam" "v4l" "") + define_channel_client_subsystem("rdpecam" "v4l" "") - set(${MODULE_PREFIX}_SRCS - camera_v4l.c - ) + set(${MODULE_PREFIX}_SRCS camera_v4l.c) - set(${MODULE_PREFIX}_LIBS - winpr - freerdp - ${V4L_TARGETS} - ) + set(${MODULE_PREFIX}_LIBS winpr freerdp ${V4L_TARGETS}) - include_directories(..) + include_directories(..) - add_channel_client_subsystem_library(${MODULE_PREFIX} ${MODULE_NAME} ${CHANNEL_NAME} "" TRUE "") + add_channel_client_subsystem_library(${MODULE_PREFIX} ${MODULE_NAME} ${CHANNEL_NAME} "" TRUE "") endif() diff --git a/channels/rdpecam/server/CMakeLists.txt b/channels/rdpecam/server/CMakeLists.txt index 2f824284d..bd843379f 100644 --- a/channels/rdpecam/server/CMakeLists.txt +++ b/channels/rdpecam/server/CMakeLists.txt @@ -17,13 +17,8 @@ define_channel_server("rdpecam") -set(${MODULE_PREFIX}_SRCS - camera_device_enumerator_main.c - camera_device_main.c -) +set(${MODULE_PREFIX}_SRCS camera_device_enumerator_main.c camera_device_main.c) -set(${MODULE_PREFIX}_LIBS - freerdp -) +set(${MODULE_PREFIX}_LIBS freerdp) add_channel_server_library(${MODULE_PREFIX} ${MODULE_NAME} ${CHANNEL_NAME} FALSE "DVCPluginEntry") diff --git a/channels/rdpei/CMakeLists.txt b/channels/rdpei/CMakeLists.txt index a93af67c5..5ddabd7aa 100644 --- a/channels/rdpei/CMakeLists.txt +++ b/channels/rdpei/CMakeLists.txt @@ -18,9 +18,9 @@ define_channel("rdpei") if(WITH_CLIENT_CHANNELS) - add_channel_client(${MODULE_PREFIX} ${CHANNEL_NAME}) + add_channel_client(${MODULE_PREFIX} ${CHANNEL_NAME}) endif() if(WITH_SERVER_CHANNELS) - add_channel_server(${MODULE_PREFIX} ${CHANNEL_NAME}) -endif() \ No newline at end of file + add_channel_server(${MODULE_PREFIX} ${CHANNEL_NAME}) +endif() diff --git a/channels/rdpei/ChannelOptions.cmake b/channels/rdpei/ChannelOptions.cmake index 61864612f..cf5e96a27 100644 --- a/channels/rdpei/ChannelOptions.cmake +++ b/channels/rdpei/ChannelOptions.cmake @@ -1,13 +1,19 @@ - set(OPTION_DEFAULT OFF) set(OPTION_CLIENT_DEFAULT ON) set(OPTION_SERVER_DEFAULT ON) -define_channel_options(NAME "rdpei" TYPE "dynamic" - DESCRIPTION "Input Virtual Channel Extension" - SPECIFICATIONS "[MS-RDPEI]" - DEFAULT ${OPTION_DEFAULT}) +define_channel_options( + NAME + "rdpei" + TYPE + "dynamic" + DESCRIPTION + "Input Virtual Channel Extension" + SPECIFICATIONS + "[MS-RDPEI]" + DEFAULT + ${OPTION_DEFAULT} +) define_channel_client_options(${OPTION_CLIENT_DEFAULT}) define_channel_server_options(${OPTION_SERVER_DEFAULT}) - diff --git a/channels/rdpei/client/CMakeLists.txt b/channels/rdpei/client/CMakeLists.txt index 67a61bb42..1b153a794 100644 --- a/channels/rdpei/client/CMakeLists.txt +++ b/channels/rdpei/client/CMakeLists.txt @@ -17,17 +17,9 @@ define_channel_client("rdpei") -set(${MODULE_PREFIX}_SRCS - rdpei_main.c - rdpei_main.h - ../rdpei_common.c - ../rdpei_common.h -) +set(${MODULE_PREFIX}_SRCS rdpei_main.c rdpei_main.h ../rdpei_common.c ../rdpei_common.h) -set(${MODULE_PREFIX}_LIBS - winpr freerdp -) +set(${MODULE_PREFIX}_LIBS winpr freerdp) include_directories(..) add_channel_client_library(${MODULE_PREFIX} ${MODULE_NAME} ${CHANNEL_NAME} TRUE "DVCPluginEntry") - diff --git a/channels/rdpei/server/CMakeLists.txt b/channels/rdpei/server/CMakeLists.txt index 21c96eed6..346c2ffd7 100644 --- a/channels/rdpei/server/CMakeLists.txt +++ b/channels/rdpei/server/CMakeLists.txt @@ -18,15 +18,8 @@ define_channel_server("rdpei") -set(${MODULE_PREFIX}_SRCS - rdpei_main.c - rdpei_main.h - ../rdpei_common.c - ../rdpei_common.h -) +set(${MODULE_PREFIX}_SRCS rdpei_main.c rdpei_main.h ../rdpei_common.c ../rdpei_common.h) -set(${MODULE_PREFIX}_LIBS - winpr -) +set(${MODULE_PREFIX}_LIBS winpr) add_channel_server_library(${MODULE_PREFIX} ${MODULE_NAME} ${CHANNEL_NAME} FALSE "VirtualChannelEntry") diff --git a/channels/rdpemsc/CMakeLists.txt b/channels/rdpemsc/CMakeLists.txt index 0b5f46bb5..b17d26e29 100644 --- a/channels/rdpemsc/CMakeLists.txt +++ b/channels/rdpemsc/CMakeLists.txt @@ -18,5 +18,5 @@ define_channel("rdpemsc") if(WITH_SERVER_CHANNELS) - add_channel_server(${MODULE_PREFIX} ${CHANNEL_NAME}) + add_channel_server(${MODULE_PREFIX} ${CHANNEL_NAME}) endif() diff --git a/channels/rdpemsc/ChannelOptions.cmake b/channels/rdpemsc/ChannelOptions.cmake index d89f37ed4..fb4214537 100644 --- a/channels/rdpemsc/ChannelOptions.cmake +++ b/channels/rdpemsc/ChannelOptions.cmake @@ -1,12 +1,18 @@ - set(OPTION_DEFAULT ON) set(OPTION_CLIENT_DEFAULT OFF) set(OPTION_SERVER_DEFAULT ON) -define_channel_options(NAME "rdpemsc" TYPE "dynamic" - DESCRIPTION "Mouse Cursor Virtual Channel Extension" - SPECIFICATIONS "[MS-RDPEMSC]" - DEFAULT ${OPTION_DEFAULT}) +define_channel_options( + NAME + "rdpemsc" + TYPE + "dynamic" + DESCRIPTION + "Mouse Cursor Virtual Channel Extension" + SPECIFICATIONS + "[MS-RDPEMSC]" + DEFAULT + ${OPTION_DEFAULT} +) define_channel_server_options(${OPTION_SERVER_DEFAULT}) - diff --git a/channels/rdpemsc/server/CMakeLists.txt b/channels/rdpemsc/server/CMakeLists.txt index 3384d70db..5844b5d32 100644 --- a/channels/rdpemsc/server/CMakeLists.txt +++ b/channels/rdpemsc/server/CMakeLists.txt @@ -17,12 +17,8 @@ define_channel_server("rdpemsc") -set(${MODULE_PREFIX}_SRCS - mouse_cursor_main.c -) +set(${MODULE_PREFIX}_SRCS mouse_cursor_main.c) -set(${MODULE_PREFIX}_LIBS - freerdp -) +set(${MODULE_PREFIX}_LIBS freerdp) add_channel_server_library(${MODULE_PREFIX} ${MODULE_NAME} ${CHANNEL_NAME} FALSE "DVCPluginEntry") diff --git a/channels/rdpgfx/CMakeLists.txt b/channels/rdpgfx/CMakeLists.txt index 04820de9d..4745eb804 100644 --- a/channels/rdpgfx/CMakeLists.txt +++ b/channels/rdpgfx/CMakeLists.txt @@ -18,9 +18,9 @@ define_channel("rdpgfx") if(WITH_CLIENT_CHANNELS) - add_channel_client(${MODULE_PREFIX} ${CHANNEL_NAME}) + add_channel_client(${MODULE_PREFIX} ${CHANNEL_NAME}) endif() if(WITH_SERVER_CHANNELS) - add_channel_server(${MODULE_PREFIX} ${CHANNEL_NAME}) + add_channel_server(${MODULE_PREFIX} ${CHANNEL_NAME}) endif() diff --git a/channels/rdpgfx/ChannelOptions.cmake b/channels/rdpgfx/ChannelOptions.cmake index f29f019da..b2591dc23 100644 --- a/channels/rdpgfx/ChannelOptions.cmake +++ b/channels/rdpgfx/ChannelOptions.cmake @@ -1,13 +1,19 @@ - set(OPTION_DEFAULT OFF) set(OPTION_CLIENT_DEFAULT ON) set(OPTION_SERVER_DEFAULT ON) -define_channel_options(NAME "rdpgfx" TYPE "dynamic" - DESCRIPTION "Graphics Pipeline Extension" - SPECIFICATIONS "[MS-RDPEGFX]" - DEFAULT ${OPTION_DEFAULT}) +define_channel_options( + NAME + "rdpgfx" + TYPE + "dynamic" + DESCRIPTION + "Graphics Pipeline Extension" + SPECIFICATIONS + "[MS-RDPEGFX]" + DEFAULT + ${OPTION_DEFAULT} +) define_channel_client_options(${OPTION_CLIENT_DEFAULT}) define_channel_server_options(${OPTION_SERVER_DEFAULT}) - diff --git a/channels/rdpgfx/client/CMakeLists.txt b/channels/rdpgfx/client/CMakeLists.txt index 3338f981b..69cec9beb 100644 --- a/channels/rdpgfx/client/CMakeLists.txt +++ b/channels/rdpgfx/client/CMakeLists.txt @@ -17,19 +17,11 @@ define_channel_client("rdpgfx") -set(${MODULE_PREFIX}_SRCS - rdpgfx_main.c - rdpgfx_main.h - rdpgfx_codec.c - rdpgfx_codec.h - ../rdpgfx_common.c - ../rdpgfx_common.h +set(${MODULE_PREFIX}_SRCS rdpgfx_main.c rdpgfx_main.h rdpgfx_codec.c rdpgfx_codec.h ../rdpgfx_common.c + ../rdpgfx_common.h ) -set(${MODULE_PREFIX}_LIBS - winpr freerdp -) +set(${MODULE_PREFIX}_LIBS winpr freerdp) include_directories(..) add_channel_client_library(${MODULE_PREFIX} ${MODULE_NAME} ${CHANNEL_NAME} TRUE "DVCPluginEntry") - diff --git a/channels/rdpgfx/server/CMakeLists.txt b/channels/rdpgfx/server/CMakeLists.txt index d33b7101a..3c47952f7 100644 --- a/channels/rdpgfx/server/CMakeLists.txt +++ b/channels/rdpgfx/server/CMakeLists.txt @@ -17,16 +17,9 @@ define_channel_server("rdpgfx") -set(${MODULE_PREFIX}_SRCS - rdpgfx_main.c - rdpgfx_main.h - ../rdpgfx_common.c - ../rdpgfx_common.h -) +set(${MODULE_PREFIX}_SRCS rdpgfx_main.c rdpgfx_main.h ../rdpgfx_common.c ../rdpgfx_common.h) -set(${MODULE_PREFIX}_LIBS - freerdp -) +set(${MODULE_PREFIX}_LIBS freerdp) include_directories(..) diff --git a/channels/rdpsnd/CMakeLists.txt b/channels/rdpsnd/CMakeLists.txt index 08b68365a..c749552ba 100644 --- a/channels/rdpsnd/CMakeLists.txt +++ b/channels/rdpsnd/CMakeLists.txt @@ -21,9 +21,9 @@ include_directories(common) add_subdirectory(common) if(WITH_CLIENT_CHANNELS) - add_channel_client(${MODULE_PREFIX} ${CHANNEL_NAME}) + add_channel_client(${MODULE_PREFIX} ${CHANNEL_NAME}) endif() if(WITH_SERVER_CHANNELS) - add_channel_server(${MODULE_PREFIX} ${CHANNEL_NAME}) + add_channel_server(${MODULE_PREFIX} ${CHANNEL_NAME}) endif() diff --git a/channels/rdpsnd/ChannelOptions.cmake b/channels/rdpsnd/ChannelOptions.cmake index 948ba9799..71b9033a3 100644 --- a/channels/rdpsnd/ChannelOptions.cmake +++ b/channels/rdpsnd/ChannelOptions.cmake @@ -1,13 +1,19 @@ - set(OPTION_DEFAULT OFF) set(OPTION_CLIENT_DEFAULT ON) set(OPTION_SERVER_DEFAULT ON) -define_channel_options(NAME "rdpsnd" TYPE "static;dynamic" - DESCRIPTION "Audio Output Virtual Channel Extension" - SPECIFICATIONS "[MS-RDPEA]" - DEFAULT ${OPTION_DEFAULT}) +define_channel_options( + NAME + "rdpsnd" + TYPE + "static;dynamic" + DESCRIPTION + "Audio Output Virtual Channel Extension" + SPECIFICATIONS + "[MS-RDPEA]" + DEFAULT + ${OPTION_DEFAULT} +) define_channel_client_options(${OPTION_CLIENT_DEFAULT}) define_channel_server_options(${OPTION_SERVER_DEFAULT}) - diff --git a/channels/rdpsnd/client/CMakeLists.txt b/channels/rdpsnd/client/CMakeLists.txt index fc8cae22d..760f82694 100644 --- a/channels/rdpsnd/client/CMakeLists.txt +++ b/channels/rdpsnd/client/CMakeLists.txt @@ -17,50 +17,42 @@ define_channel_client("rdpsnd") -set(${MODULE_PREFIX}_SRCS - rdpsnd_main.c - rdpsnd_main.h -) +set(${MODULE_PREFIX}_SRCS rdpsnd_main.c rdpsnd_main.h) -set(${MODULE_PREFIX}_LIBS - winpr - freerdp - ${CMAKE_THREAD_LIBS_INIT} - rdpsnd-common -) +set(${MODULE_PREFIX}_LIBS winpr freerdp ${CMAKE_THREAD_LIBS_INIT} rdpsnd-common) add_channel_client_library(${MODULE_PREFIX} ${MODULE_NAME} ${CHANNEL_NAME} FALSE "VirtualChannelEntryEx;DVCPluginEntry") if(WITH_OSS) - add_channel_client_subsystem(${MODULE_PREFIX} ${CHANNEL_NAME} "oss" "") + add_channel_client_subsystem(${MODULE_PREFIX} ${CHANNEL_NAME} "oss" "") endif() if(WITH_ALSA) - add_channel_client_subsystem(${MODULE_PREFIX} ${CHANNEL_NAME} "alsa" "") + add_channel_client_subsystem(${MODULE_PREFIX} ${CHANNEL_NAME} "alsa" "") endif() if(WITH_IOSAUDIO) - add_channel_client_subsystem(${MODULE_PREFIX} ${CHANNEL_NAME} "ios" "") + add_channel_client_subsystem(${MODULE_PREFIX} ${CHANNEL_NAME} "ios" "") endif() if(WITH_PULSE) - add_channel_client_subsystem(${MODULE_PREFIX} ${CHANNEL_NAME} "pulse" "") + add_channel_client_subsystem(${MODULE_PREFIX} ${CHANNEL_NAME} "pulse" "") endif() if(WITH_MACAUDIO) - add_channel_client_subsystem(${MODULE_PREFIX} ${CHANNEL_NAME} "mac" "") + add_channel_client_subsystem(${MODULE_PREFIX} ${CHANNEL_NAME} "mac" "") endif() if(WITH_WINMM) - add_channel_client_subsystem(${MODULE_PREFIX} ${CHANNEL_NAME} "winmm" "") + add_channel_client_subsystem(${MODULE_PREFIX} ${CHANNEL_NAME} "winmm" "") endif() if(WITH_OPENSLES) - add_channel_client_subsystem(${MODULE_PREFIX} ${CHANNEL_NAME} "opensles" "") + add_channel_client_subsystem(${MODULE_PREFIX} ${CHANNEL_NAME} "opensles" "") endif() if(WITH_SNDIO) - add_channel_client_subsystem(${MODULE_PREFIX} ${CHANNEL_NAME} "sndio" "") + add_channel_client_subsystem(${MODULE_PREFIX} ${CHANNEL_NAME} "sndio" "") endif() add_channel_client_subsystem(${MODULE_PREFIX} ${CHANNEL_NAME} "fake" "") diff --git a/channels/rdpsnd/client/alsa/CMakeLists.txt b/channels/rdpsnd/client/alsa/CMakeLists.txt index 59e39a508..63c2db3f2 100644 --- a/channels/rdpsnd/client/alsa/CMakeLists.txt +++ b/channels/rdpsnd/client/alsa/CMakeLists.txt @@ -19,14 +19,9 @@ define_channel_client_subsystem("rdpsnd" "alsa" "") find_package(ALSA REQUIRED) -set(${MODULE_PREFIX}_SRCS - rdpsnd_alsa.c) +set(${MODULE_PREFIX}_SRCS rdpsnd_alsa.c) -set(${MODULE_PREFIX}_LIBS - winpr - freerdp - ${ALSA_LIBRARIES} -) +set(${MODULE_PREFIX}_LIBS winpr freerdp ${ALSA_LIBRARIES}) include_directories(..) include_directories(SYSTEM ${ALSA_INCLUDE_DIRS}) diff --git a/channels/rdpsnd/client/fake/CMakeLists.txt b/channels/rdpsnd/client/fake/CMakeLists.txt index a41b41f36..8a307854d 100644 --- a/channels/rdpsnd/client/fake/CMakeLists.txt +++ b/channels/rdpsnd/client/fake/CMakeLists.txt @@ -18,14 +18,9 @@ define_channel_client_subsystem("rdpsnd" "fake" "") -set(${MODULE_PREFIX}_SRCS - rdpsnd_fake.c -) +set(${MODULE_PREFIX}_SRCS rdpsnd_fake.c) -set(${MODULE_PREFIX}_LIBS - winpr - freerdp -) +set(${MODULE_PREFIX}_LIBS winpr freerdp) include_directories(..) diff --git a/channels/rdpsnd/client/ios/CMakeLists.txt b/channels/rdpsnd/client/ios/CMakeLists.txt index bfb390355..16491c232 100644 --- a/channels/rdpsnd/client/ios/CMakeLists.txt +++ b/channels/rdpsnd/client/ios/CMakeLists.txt @@ -19,21 +19,13 @@ define_channel_client_subsystem("rdpsnd" "ios" "") -FIND_LIBRARY(CORE_AUDIO CoreAudio) -FIND_LIBRARY(AUDIO_TOOL AudioToolbox) -FIND_LIBRARY(CORE_FOUNDATION CoreFoundation) +find_library(CORE_AUDIO CoreAudio) +find_library(AUDIO_TOOL AudioToolbox) +find_library(CORE_FOUNDATION CoreFoundation) -set(${MODULE_PREFIX}_SRCS - rdpsnd_ios.c - TPCircularBuffer.c) +set(${MODULE_PREFIX}_SRCS rdpsnd_ios.c TPCircularBuffer.c) -set(${MODULE_PREFIX}_LIBS - winpr - freerdp - ${AUDIO_TOOL} - ${CORE_AUDIO} - ${CORE_FOUNDATION} -) +set(${MODULE_PREFIX}_LIBS winpr freerdp ${AUDIO_TOOL} ${CORE_AUDIO} ${CORE_FOUNDATION}) include_directories(..) diff --git a/channels/rdpsnd/client/mac/CMakeLists.txt b/channels/rdpsnd/client/mac/CMakeLists.txt index 0a0746f34..57c15589b 100644 --- a/channels/rdpsnd/client/mac/CMakeLists.txt +++ b/channels/rdpsnd/client/mac/CMakeLists.txt @@ -20,16 +20,15 @@ define_channel_client_subsystem("rdpsnd" "mac" "") find_library(COCOA_LIBRARY Cocoa REQUIRED) -FIND_LIBRARY(CORE_FOUNDATION CoreFoundation) -FIND_LIBRARY(CORE_AUDIO CoreAudio REQUIRED) -FIND_LIBRARY(AUDIO_TOOL AudioToolbox REQUIRED) -FIND_LIBRARY(AV_FOUNDATION AVFoundation REQUIRED) +find_library(CORE_FOUNDATION CoreFoundation) +find_library(CORE_AUDIO CoreAudio REQUIRED) +find_library(AUDIO_TOOL AudioToolbox REQUIRED) +find_library(AV_FOUNDATION AVFoundation REQUIRED) -set(${MODULE_PREFIX}_SRCS - rdpsnd_mac.m) +set(${MODULE_PREFIX}_SRCS rdpsnd_mac.m) set(${MODULE_PREFIX}_LIBS - winpr + winpr freerdp ${AUDIO_TOOL} ${AV_FOUNDATION} diff --git a/channels/rdpsnd/client/opensles/CMakeLists.txt b/channels/rdpsnd/client/opensles/CMakeLists.txt index 991fb5486..5a93720e5 100644 --- a/channels/rdpsnd/client/opensles/CMakeLists.txt +++ b/channels/rdpsnd/client/opensles/CMakeLists.txt @@ -19,15 +19,9 @@ define_channel_client_subsystem("rdpsnd" "opensles" "") find_package(OpenSLES REQUIRED) -set(${MODULE_PREFIX}_SRCS - opensl_io.c - rdpsnd_opensles.c) +set(${MODULE_PREFIX}_SRCS opensl_io.c rdpsnd_opensles.c) -set(${MODULE_PREFIX}_LIBS - winpr - freerdp - ${OpenSLES_LIBRARIES} -) +set(${MODULE_PREFIX}_LIBS winpr freerdp ${OpenSLES_LIBRARIES}) include_directories(..) include_directories(SYSTEM ${OpenSLES_INCLUDE_DIRS}) diff --git a/channels/rdpsnd/client/oss/CMakeLists.txt b/channels/rdpsnd/client/oss/CMakeLists.txt index 95f9a242e..e97d183c1 100644 --- a/channels/rdpsnd/client/oss/CMakeLists.txt +++ b/channels/rdpsnd/client/oss/CMakeLists.txt @@ -19,23 +19,13 @@ define_channel_client_subsystem("rdpsnd" "oss" "") find_package(OSS REQUIRED) -set(${MODULE_PREFIX}_SRCS - rdpsnd_oss.c -) +set(${MODULE_PREFIX}_SRCS rdpsnd_oss.c) -set(${MODULE_PREFIX}_LIBS - winpr - freerdp - ${OSS_LIBRARIES} -) +set(${MODULE_PREFIX}_LIBS winpr freerdp ${OSS_LIBRARIES}) include_directories(..) include_directories(${CMAKE_CURRENT_BINARY_DIR}) include_directories(SYSTEM ${OSS_INCLUDE_DIRS}) -cleaning_configure_file( - ${CMAKE_SOURCE_DIR}/cmake/oss-includes.h.in - ${CMAKE_CURRENT_BINARY_DIR}/oss-includes.h - @ONLY -) +cleaning_configure_file(${CMAKE_SOURCE_DIR}/cmake/oss-includes.h.in ${CMAKE_CURRENT_BINARY_DIR}/oss-includes.h @ONLY) add_channel_client_subsystem_library(${MODULE_PREFIX} ${MODULE_NAME} ${CHANNEL_NAME} "" TRUE "") diff --git a/channels/rdpsnd/client/pulse/CMakeLists.txt b/channels/rdpsnd/client/pulse/CMakeLists.txt index a48baab25..e08491e01 100644 --- a/channels/rdpsnd/client/pulse/CMakeLists.txt +++ b/channels/rdpsnd/client/pulse/CMakeLists.txt @@ -19,16 +19,9 @@ define_channel_client_subsystem("rdpsnd" "pulse" "") find_package(PulseAudio REQUIRED) -set(${MODULE_PREFIX}_SRCS - rdpsnd_pulse.c -) +set(${MODULE_PREFIX}_SRCS rdpsnd_pulse.c) -set(${MODULE_PREFIX}_LIBS - winpr - freerdp - ${PULSEAUDIO_LIBRARY} - ${PULSEAUDIO_MAINLOOP_LIBRARY} -) +set(${MODULE_PREFIX}_LIBS winpr freerdp ${PULSEAUDIO_LIBRARY} ${PULSEAUDIO_MAINLOOP_LIBRARY}) include_directories(..) include_directories(SYSTEM ${PULSEAUDIO_INCLUDE_DIR}) diff --git a/channels/rdpsnd/client/sndio/CMakeLists.txt b/channels/rdpsnd/client/sndio/CMakeLists.txt index 1bc6e7063..ba42fa194 100644 --- a/channels/rdpsnd/client/sndio/CMakeLists.txt +++ b/channels/rdpsnd/client/sndio/CMakeLists.txt @@ -20,15 +20,9 @@ define_channel_client_subsystem("rdpsnd" "sndio" "") find_package(SNDIO REQUIRED) -set(${MODULE_PREFIX}_SRCS - rdpsnd_sndio.c -) +set(${MODULE_PREFIX}_SRCS rdpsnd_sndio.c) -set(${MODULE_PREFIX}_LIBS - winpr - freerdp - ${SNDIO_LIBRARIES} -) +set(${MODULE_PREFIX}_LIBS winpr freerdp ${SNDIO_LIBRARIES}) include_directories(..) include_directories(SYSTEM ${SNDIO_INCLUDE_DIRS}) diff --git a/channels/rdpsnd/client/winmm/CMakeLists.txt b/channels/rdpsnd/client/winmm/CMakeLists.txt index 6e9d8d143..a58138e15 100644 --- a/channels/rdpsnd/client/winmm/CMakeLists.txt +++ b/channels/rdpsnd/client/winmm/CMakeLists.txt @@ -17,15 +17,9 @@ define_channel_client_subsystem("rdpsnd" "winmm" "") -set(${MODULE_PREFIX}_SRCS - rdpsnd_winmm.c -) +set(${MODULE_PREFIX}_SRCS rdpsnd_winmm.c) -set(${MODULE_PREFIX}_LIBS - winpr - freerdp - winmm.lib -) +set(${MODULE_PREFIX}_LIBS winpr freerdp winmm.lib) include_directories(..) diff --git a/channels/rdpsnd/common/CMakeLists.txt b/channels/rdpsnd/common/CMakeLists.txt index 763cb71ab..08a9e91d7 100644 --- a/channels/rdpsnd/common/CMakeLists.txt +++ b/channels/rdpsnd/common/CMakeLists.txt @@ -16,12 +16,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -set(SRCS - rdpsnd_common.h - rdpsnd_common.c) +set(SRCS rdpsnd_common.h rdpsnd_common.c) # Library currently header only add_library(rdpsnd-common STATIC ${SRCS}) -channel_install(rdpsnd-common ${FREERDP_ADDIN_PATH} "FreeRDPTargets") - +channel_install(rdpsnd-common ${FREERDP_ADDIN_PATH} "FreeRDPTargets") diff --git a/channels/rdpsnd/server/CMakeLists.txt b/channels/rdpsnd/server/CMakeLists.txt index 881b479fc..0282c01b4 100644 --- a/channels/rdpsnd/server/CMakeLists.txt +++ b/channels/rdpsnd/server/CMakeLists.txt @@ -17,13 +17,8 @@ define_channel_server("rdpsnd") -set(${MODULE_PREFIX}_SRCS - rdpsnd_main.c - rdpsnd_main.h -) +set(${MODULE_PREFIX}_SRCS rdpsnd_main.c rdpsnd_main.h) -set(${MODULE_PREFIX}_LIBS - rdpsnd-common -) +set(${MODULE_PREFIX}_LIBS rdpsnd-common) add_channel_server_library(${MODULE_PREFIX} ${MODULE_NAME} ${CHANNEL_NAME} FALSE "VirtualChannelEntry") diff --git a/channels/remdesk/CMakeLists.txt b/channels/remdesk/CMakeLists.txt index 85bb0fb5f..c95204121 100644 --- a/channels/remdesk/CMakeLists.txt +++ b/channels/remdesk/CMakeLists.txt @@ -21,9 +21,9 @@ include_directories(common) add_subdirectory(common) if(WITH_CLIENT_CHANNELS) - add_channel_client(${MODULE_PREFIX} ${CHANNEL_NAME}) + add_channel_client(${MODULE_PREFIX} ${CHANNEL_NAME}) endif() if(WITH_SERVER_CHANNELS) - add_channel_server(${MODULE_PREFIX} ${CHANNEL_NAME}) + add_channel_server(${MODULE_PREFIX} ${CHANNEL_NAME}) endif() diff --git a/channels/remdesk/ChannelOptions.cmake b/channels/remdesk/ChannelOptions.cmake index 17518e619..2644a8c74 100644 --- a/channels/remdesk/ChannelOptions.cmake +++ b/channels/remdesk/ChannelOptions.cmake @@ -1,12 +1,19 @@ - set(OPTION_DEFAULT OFF) set(OPTION_CLIENT_DEFAULT ON) set(OPTION_SERVER_DEFAULT ON) -define_channel_options(NAME "remdesk" TYPE "static" - DESCRIPTION "Remote Assistance Virtual Channel Extension" - SPECIFICATIONS "[MS-RA]" - DEFAULT ${OPTION_DEFAULT}) +define_channel_options( + NAME + "remdesk" + TYPE + "static" + DESCRIPTION + "Remote Assistance Virtual Channel Extension" + SPECIFICATIONS + "[MS-RA]" + DEFAULT + ${OPTION_DEFAULT} +) define_channel_client_options(${OPTION_CLIENT_DEFAULT}) define_channel_server_options(${OPTION_SERVER_DEFAULT}) diff --git a/channels/remdesk/client/CMakeLists.txt b/channels/remdesk/client/CMakeLists.txt index 1660d5018..005b21744 100644 --- a/channels/remdesk/client/CMakeLists.txt +++ b/channels/remdesk/client/CMakeLists.txt @@ -17,13 +17,8 @@ define_channel_client("remdesk") -set(${MODULE_PREFIX}_SRCS - remdesk_main.c - remdesk_main.h -) +set(${MODULE_PREFIX}_SRCS remdesk_main.c remdesk_main.h) -set(${MODULE_PREFIX}_LIBS - winpr freerdp remdesk-common -) +set(${MODULE_PREFIX}_LIBS winpr freerdp remdesk-common) add_channel_client_library(${MODULE_PREFIX} ${MODULE_NAME} ${CHANNEL_NAME} FALSE "VirtualChannelEntryEx") diff --git a/channels/remdesk/common/CMakeLists.txt b/channels/remdesk/common/CMakeLists.txt index f1006c7fd..afd7b62bc 100644 --- a/channels/remdesk/common/CMakeLists.txt +++ b/channels/remdesk/common/CMakeLists.txt @@ -16,11 +16,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -set(SRCS - remdesk_common.h - remdesk_common.c) +set(SRCS remdesk_common.h remdesk_common.c) add_library(remdesk-common STATIC ${SRCS}) -channel_install(remdesk-common ${FREERDP_ADDIN_PATH} "FreeRDPTargets") - +channel_install(remdesk-common ${FREERDP_ADDIN_PATH} "FreeRDPTargets") diff --git a/channels/remdesk/server/CMakeLists.txt b/channels/remdesk/server/CMakeLists.txt index e868a0205..7725e6677 100644 --- a/channels/remdesk/server/CMakeLists.txt +++ b/channels/remdesk/server/CMakeLists.txt @@ -17,13 +17,8 @@ define_channel_server("remdesk") -set(${MODULE_PREFIX}_SRCS - remdesk_main.c - remdesk_main.h -) +set(${MODULE_PREFIX}_SRCS remdesk_main.c remdesk_main.h) -set(${MODULE_PREFIX}_LIBS - winpr remdesk-common -) +set(${MODULE_PREFIX}_LIBS winpr remdesk-common) add_channel_server_library(${MODULE_PREFIX} ${MODULE_NAME} ${CHANNEL_NAME} FALSE "VirtualChannelEntry") diff --git a/channels/serial/CMakeLists.txt b/channels/serial/CMakeLists.txt index aa5cd8589..41b312aa9 100644 --- a/channels/serial/CMakeLists.txt +++ b/channels/serial/CMakeLists.txt @@ -18,6 +18,5 @@ define_channel("serial") if(WITH_CLIENT_CHANNELS) - add_channel_client(${MODULE_PREFIX} ${CHANNEL_NAME}) + add_channel_client(${MODULE_PREFIX} ${CHANNEL_NAME}) endif() - diff --git a/channels/serial/ChannelOptions.cmake b/channels/serial/ChannelOptions.cmake index 980c37ddb..359e1f21c 100644 --- a/channels/serial/ChannelOptions.cmake +++ b/channels/serial/ChannelOptions.cmake @@ -1,31 +1,37 @@ - set(OPTION_DEFAULT OFF) set(OPTION_CLIENT_DEFAULT ON) set(OPTION_SERVER_DEFAULT OFF) if(WIN32) - set(OPTION_CLIENT_DEFAULT OFF) - set(OPTION_SERVER_DEFAULT OFF) - message("Serial redirection not supported on windows") + set(OPTION_CLIENT_DEFAULT OFF) + set(OPTION_SERVER_DEFAULT OFF) + message("Serial redirection not supported on windows") endif() if(ANDROID) - set(OPTION_CLIENT_DEFAULT OFF) - set(OPTION_SERVER_DEFAULT OFF) - message("Serial redirection not supported on android") + set(OPTION_CLIENT_DEFAULT OFF) + set(OPTION_SERVER_DEFAULT OFF) + message("Serial redirection not supported on android") endif() -if (APPLE) - set(OPTION_CLIENT_DEFAULT OFF) - set(OPTION_SERVER_DEFAULT OFF) - message("Serial redirection not supported on apple") +if(APPLE) + set(OPTION_CLIENT_DEFAULT OFF) + set(OPTION_SERVER_DEFAULT OFF) + message("Serial redirection not supported on apple") endif() -define_channel_options(NAME "serial" TYPE "device" - DESCRIPTION "Serial Port Virtual Channel Extension" - SPECIFICATIONS "[MS-RDPESP]" - DEFAULT ${OPTION_DEFAULT}) +define_channel_options( + NAME + "serial" + TYPE + "device" + DESCRIPTION + "Serial Port Virtual Channel Extension" + SPECIFICATIONS + "[MS-RDPESP]" + DEFAULT + ${OPTION_DEFAULT} +) define_channel_client_options(${OPTION_CLIENT_DEFAULT}) define_channel_server_options(${OPTION_SERVER_DEFAULT}) - diff --git a/channels/serial/client/CMakeLists.txt b/channels/serial/client/CMakeLists.txt index 6549dce22..dffd98562 100644 --- a/channels/serial/client/CMakeLists.txt +++ b/channels/serial/client/CMakeLists.txt @@ -17,15 +17,11 @@ define_channel_client("serial") -set(${MODULE_PREFIX}_SRCS - serial_main.c -) +set(${MODULE_PREFIX}_SRCS serial_main.c) -set(${MODULE_PREFIX}_LIBS - winpr freerdp -) +set(${MODULE_PREFIX}_LIBS winpr freerdp) # Serial implementation is currently linux only. BSD* might also work but untested -if (UNIX AND NOT APPLE AND NOT ANDROID) - add_channel_client_library(${MODULE_PREFIX} ${MODULE_NAME} ${CHANNEL_NAME} TRUE "DeviceServiceEntry") +if(UNIX AND NOT APPLE AND NOT ANDROID) + add_channel_client_library(${MODULE_PREFIX} ${MODULE_NAME} ${CHANNEL_NAME} TRUE "DeviceServiceEntry") endif() diff --git a/channels/server/CMakeLists.txt b/channels/server/CMakeLists.txt index 8ffb18468..5b55d1456 100644 --- a/channels/server/CMakeLists.txt +++ b/channels/server/CMakeLists.txt @@ -18,14 +18,12 @@ set(MODULE_NAME "freerdp-channels-server") set(MODULE_PREFIX "FREERDP_CHANNELS_SERVER") -set(${MODULE_PREFIX}_SRCS - ${CMAKE_CURRENT_SOURCE_DIR}/channels.c - ${CMAKE_CURRENT_SOURCE_DIR}/channels.h) - +set(${MODULE_PREFIX}_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/channels.c ${CMAKE_CURRENT_SOURCE_DIR}/channels.h) + foreach(STATIC_MODULE ${CHANNEL_STATIC_SERVER_MODULES}) - set(STATIC_MODULE_NAME ${${STATIC_MODULE}_SERVER_NAME}) - set(STATIC_MODULE_CHANNEL ${${STATIC_MODULE}_SERVER_CHANNEL}) - set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} ${STATIC_MODULE_NAME}) + set(STATIC_MODULE_NAME ${${STATIC_MODULE}_SERVER_NAME}) + set(STATIC_MODULE_CHANNEL ${${STATIC_MODULE}_SERVER_CHANNEL}) + set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} ${STATIC_MODULE_NAME}) endforeach() add_library(${MODULE_NAME} STATIC ${${MODULE_PREFIX}_SRCS}) diff --git a/channels/smartcard/CMakeLists.txt b/channels/smartcard/CMakeLists.txt index 98c6c7259..00ad99eea 100644 --- a/channels/smartcard/CMakeLists.txt +++ b/channels/smartcard/CMakeLists.txt @@ -18,5 +18,5 @@ define_channel("smartcard") if(WITH_CLIENT_CHANNELS) - add_channel_client(${MODULE_PREFIX} ${CHANNEL_NAME}) + add_channel_client(${MODULE_PREFIX} ${CHANNEL_NAME}) endif() diff --git a/channels/smartcard/ChannelOptions.cmake b/channels/smartcard/ChannelOptions.cmake index 7af6e3131..83f0176b3 100644 --- a/channels/smartcard/ChannelOptions.cmake +++ b/channels/smartcard/ChannelOptions.cmake @@ -1,12 +1,19 @@ - set(OPTION_DEFAULT OFF) set(OPTION_CLIENT_DEFAULT ON) set(OPTION_SERVER_DEFAULT OFF) -define_channel_options(NAME "smartcard" TYPE "device" - DESCRIPTION "Smart Card Virtual Channel Extension" - SPECIFICATIONS "[MS-RDPESC]" - DEFAULT ${OPTION_DEFAULT}) +define_channel_options( + NAME + "smartcard" + TYPE + "device" + DESCRIPTION + "Smart Card Virtual Channel Extension" + SPECIFICATIONS + "[MS-RDPESC]" + DEFAULT + ${OPTION_DEFAULT} +) define_channel_client_options(${OPTION_CLIENT_DEFAULT}) define_channel_server_options(${OPTION_SERVER_DEFAULT}) diff --git a/channels/smartcard/client/CMakeLists.txt b/channels/smartcard/client/CMakeLists.txt index 08ce6af27..473f3d987 100644 --- a/channels/smartcard/client/CMakeLists.txt +++ b/channels/smartcard/client/CMakeLists.txt @@ -17,17 +17,10 @@ define_channel_client("smartcard") -set(${MODULE_PREFIX}_SRCS - smartcard_main.c - smartcard_main.h -) +set(${MODULE_PREFIX}_SRCS smartcard_main.c smartcard_main.h) -set(${MODULE_PREFIX}_LIBS - winpr freerdp ${OPENSSL_LIBRARIES} -) -if (WITH_SMARTCARD_EMULATE) - list(APPEND ${MODULE_PREFIX}_LIBS - ZLIB::ZLIB - ) +set(${MODULE_PREFIX}_LIBS winpr freerdp ${OPENSSL_LIBRARIES}) +if(WITH_SMARTCARD_EMULATE) + list(APPEND ${MODULE_PREFIX}_LIBS ZLIB::ZLIB) endif() add_channel_client_library(${MODULE_PREFIX} ${MODULE_NAME} ${CHANNEL_NAME} FALSE "DeviceServiceEntry") diff --git a/channels/sshagent/CMakeLists.txt b/channels/sshagent/CMakeLists.txt index 71aab99a6..d0e7c1250 100644 --- a/channels/sshagent/CMakeLists.txt +++ b/channels/sshagent/CMakeLists.txt @@ -19,5 +19,5 @@ define_channel("sshagent") if(WITH_CLIENT_CHANNELS) - add_channel_client(${MODULE_PREFIX} ${CHANNEL_NAME}) + add_channel_client(${MODULE_PREFIX} ${CHANNEL_NAME}) endif() diff --git a/channels/sshagent/ChannelOptions.cmake b/channels/sshagent/ChannelOptions.cmake index 41b5a2103..c27ca52f8 100644 --- a/channels/sshagent/ChannelOptions.cmake +++ b/channels/sshagent/ChannelOptions.cmake @@ -1,12 +1,18 @@ - set(OPTION_DEFAULT OFF) set(OPTION_CLIENT_DEFAULT OFF) set(OPTION_SERVER_DEFAULT OFF) -define_channel_options(NAME "sshagent" TYPE "dynamic" - DESCRIPTION "SSH Agent Forwarding (experimental)" - SPECIFICATIONS "" - DEFAULT ${OPTION_DEFAULT}) +define_channel_options( + NAME + "sshagent" + TYPE + "dynamic" + DESCRIPTION + "SSH Agent Forwarding (experimental)" + SPECIFICATIONS + "" + DEFAULT + ${OPTION_DEFAULT} +) define_channel_client_options(${OPTION_CLIENT_DEFAULT}) - diff --git a/channels/sshagent/client/CMakeLists.txt b/channels/sshagent/client/CMakeLists.txt index daad10647..b09c4f6b5 100644 --- a/channels/sshagent/client/CMakeLists.txt +++ b/channels/sshagent/client/CMakeLists.txt @@ -18,14 +18,9 @@ define_channel_client("sshagent") -set(${MODULE_PREFIX}_SRCS - sshagent_main.c - sshagent_main.h -) +set(${MODULE_PREFIX}_SRCS sshagent_main.c sshagent_main.h) -set(${MODULE_PREFIX}_LIBS - winpr -) +set(${MODULE_PREFIX}_LIBS winpr) include_directories(..) diff --git a/channels/telemetry/CMakeLists.txt b/channels/telemetry/CMakeLists.txt index d2b4f24e3..ddef6f7aa 100644 --- a/channels/telemetry/CMakeLists.txt +++ b/channels/telemetry/CMakeLists.txt @@ -18,5 +18,5 @@ define_channel("telemetry") if(WITH_SERVER_CHANNELS) - add_channel_server(${MODULE_PREFIX} ${CHANNEL_NAME}) + add_channel_server(${MODULE_PREFIX} ${CHANNEL_NAME}) endif() diff --git a/channels/telemetry/ChannelOptions.cmake b/channels/telemetry/ChannelOptions.cmake index 1b9e3917c..73aca3e38 100644 --- a/channels/telemetry/ChannelOptions.cmake +++ b/channels/telemetry/ChannelOptions.cmake @@ -1,12 +1,18 @@ - set(OPTION_DEFAULT OFF) set(OPTION_CLIENT_DEFAULT OFF) set(OPTION_SERVER_DEFAULT ON) -define_channel_options(NAME "telemetry" TYPE "dynamic" - DESCRIPTION "Telemetry Virtual Channel Extension" - SPECIFICATIONS "[MS-RDPET]" - DEFAULT ${OPTION_DEFAULT}) +define_channel_options( + NAME + "telemetry" + TYPE + "dynamic" + DESCRIPTION + "Telemetry Virtual Channel Extension" + SPECIFICATIONS + "[MS-RDPET]" + DEFAULT + ${OPTION_DEFAULT} +) define_channel_server_options(${OPTION_SERVER_DEFAULT}) - diff --git a/channels/telemetry/server/CMakeLists.txt b/channels/telemetry/server/CMakeLists.txt index 6977b63f9..ea023cb61 100644 --- a/channels/telemetry/server/CMakeLists.txt +++ b/channels/telemetry/server/CMakeLists.txt @@ -17,12 +17,8 @@ define_channel_server("telemetry") -set(${MODULE_PREFIX}_SRCS - telemetry_main.c -) +set(${MODULE_PREFIX}_SRCS telemetry_main.c) -set(${MODULE_PREFIX}_LIBS - freerdp -) +set(${MODULE_PREFIX}_LIBS freerdp) add_channel_server_library(${MODULE_PREFIX} ${MODULE_NAME} ${CHANNEL_NAME} FALSE "DVCPluginEntry") diff --git a/channels/tsmf/CMakeLists.txt b/channels/tsmf/CMakeLists.txt index 8b4073eb0..762a74739 100644 --- a/channels/tsmf/CMakeLists.txt +++ b/channels/tsmf/CMakeLists.txt @@ -18,5 +18,5 @@ define_channel("tsmf") if(WITH_CLIENT_CHANNELS) - add_channel_client(${MODULE_PREFIX} ${CHANNEL_NAME}) + add_channel_client(${MODULE_PREFIX} ${CHANNEL_NAME}) endif() diff --git a/channels/tsmf/ChannelOptions.cmake b/channels/tsmf/ChannelOptions.cmake index b5252eafd..0610f182f 100644 --- a/channels/tsmf/ChannelOptions.cmake +++ b/channels/tsmf/ChannelOptions.cmake @@ -1,23 +1,29 @@ - set(OPTION_DEFAULT OFF) set(OPTION_CLIENT_DEFAULT OFF) set(OPTION_SERVER_DEFAULT OFF) if(WIN32) - set(OPTION_CLIENT_DEFAULT OFF) - set(OPTION_SERVER_DEFAULT OFF) + set(OPTION_CLIENT_DEFAULT OFF) + set(OPTION_SERVER_DEFAULT OFF) endif() if(ANDROID) - set(OPTION_CLIENT_DEFAULT OFF) - set(OPTION_SERVER_DEFAULT OFF) + set(OPTION_CLIENT_DEFAULT OFF) + set(OPTION_SERVER_DEFAULT OFF) endif() -define_channel_options(NAME "tsmf" TYPE "dynamic" - DESCRIPTION "[DEPRECATED] Video Redirection Virtual Channel Extension" - SPECIFICATIONS "[MS-RDPEV]" - DEFAULT ${OPTION_DEFAULT}) +define_channel_options( + NAME + "tsmf" + TYPE + "dynamic" + DESCRIPTION + "[DEPRECATED] Video Redirection Virtual Channel Extension" + SPECIFICATIONS + "[MS-RDPEV]" + DEFAULT + ${OPTION_DEFAULT} +) define_channel_client_options(${OPTION_CLIENT_DEFAULT}) define_channel_server_options(${OPTION_SERVER_DEFAULT}) - diff --git a/channels/tsmf/client/CMakeLists.txt b/channels/tsmf/client/CMakeLists.txt index ea8e2f052..567875922 100644 --- a/channels/tsmf/client/CMakeLists.txt +++ b/channels/tsmf/client/CMakeLists.txt @@ -20,65 +20,62 @@ define_channel_client("tsmf") message(DEPRECATION "TSMF channel is no longer maintained. Use [MS-RDPEVOR] (/video) instead.") - find_package(PkgConfig) -if (PkgConfig_FOUND) - pkg_check_modules(gstreamer gstreamer-1.0) +if(PkgConfig_FOUND) + pkg_check_modules(gstreamer gstreamer-1.0) endif() -if (WITH_GSTREAMER_1_0) - if(gstreamer_FOUND) - add_definitions(-DWITH_GSTREAMER_1_0) - else() - message(WARNING "gstreamer not detected, disabling support") - endif() +if(WITH_GSTREAMER_1_0) + if(gstreamer_FOUND) + add_definitions(-DWITH_GSTREAMER_1_0) + else() + message(WARNING "gstreamer not detected, disabling support") + endif() endif() set(${MODULE_PREFIX}_SRCS - tsmf_audio.c - tsmf_audio.h - tsmf_codec.c - tsmf_codec.h - tsmf_constants.h - tsmf_decoder.c - tsmf_decoder.h - tsmf_ifman.c - tsmf_ifman.h - tsmf_main.c - tsmf_main.h - tsmf_media.c - tsmf_media.h - tsmf_types.h + tsmf_audio.c + tsmf_audio.h + tsmf_codec.c + tsmf_codec.h + tsmf_constants.h + tsmf_decoder.c + tsmf_decoder.h + tsmf_ifman.c + tsmf_ifman.h + tsmf_main.c + tsmf_main.h + tsmf_media.c + tsmf_media.h + tsmf_types.h ) -set(${MODULE_PREFIX}_LIBS - winpr freerdp -) +set(${MODULE_PREFIX}_LIBS winpr freerdp) include_directories(..) add_channel_client_library(${MODULE_PREFIX} ${MODULE_NAME} ${CHANNEL_NAME} TRUE "DVCPluginEntry") if(WITH_VIDEO_FFMPEG) - add_channel_client_subsystem(${MODULE_PREFIX} ${CHANNEL_NAME} "ffmpeg" "decoder") + add_channel_client_subsystem(${MODULE_PREFIX} ${CHANNEL_NAME} "ffmpeg" "decoder") endif() if(WITH_GSTREAMER_1_0) - find_package(X11) - if (X11_Xrandr_FOUND) - add_channel_client_subsystem(${MODULE_PREFIX} ${CHANNEL_NAME} "gstreamer" "decoder") - else() - message(WARNING "Disabling tsmf gstreamer because XRandR wasn't found") - endif() + find_package(X11) + if(X11_Xrandr_FOUND) + add_channel_client_subsystem(${MODULE_PREFIX} ${CHANNEL_NAME} "gstreamer" "decoder") + else() + message(WARNING "Disabling tsmf gstreamer because XRandR wasn't found") + endif() endif() if(WITH_OSS) - add_channel_client_subsystem(${MODULE_PREFIX} ${CHANNEL_NAME} "oss" "audio") + add_channel_client_subsystem(${MODULE_PREFIX} ${CHANNEL_NAME} "oss" "audio") endif() if(WITH_ALSA) - add_channel_client_subsystem(${MODULE_PREFIX} ${CHANNEL_NAME} "alsa" "audio") + add_channel_client_subsystem(${MODULE_PREFIX} ${CHANNEL_NAME} "alsa" "audio") endif() if(WITH_PULSE) - add_channel_client_subsystem(${MODULE_PREFIX} ${CHANNEL_NAME} "pulse" "audio") + add_channel_client_subsystem(${MODULE_PREFIX} ${CHANNEL_NAME} "pulse" "audio") endif() diff --git a/channels/tsmf/client/alsa/CMakeLists.txt b/channels/tsmf/client/alsa/CMakeLists.txt index 8e46523c6..3e9d74eec 100644 --- a/channels/tsmf/client/alsa/CMakeLists.txt +++ b/channels/tsmf/client/alsa/CMakeLists.txt @@ -19,15 +19,9 @@ define_channel_client_subsystem("tsmf" "alsa" "audio") find_package(ALSA REQUIRED) -set(${MODULE_PREFIX}_SRCS - tsmf_alsa.c -) +set(${MODULE_PREFIX}_SRCS tsmf_alsa.c) -set(${MODULE_PREFIX}_LIBS - winpr - freerdp - ${ALSA_LIBRARIES} -) +set(${MODULE_PREFIX}_LIBS winpr freerdp ${ALSA_LIBRARIES}) include_directories(..) include_directories(SYSTEM ${ALSA_INCLUDE_DIRS}) diff --git a/channels/tsmf/client/ffmpeg/CMakeLists.txt b/channels/tsmf/client/ffmpeg/CMakeLists.txt index 2fbedd2c1..717cdde46 100644 --- a/channels/tsmf/client/ffmpeg/CMakeLists.txt +++ b/channels/tsmf/client/ffmpeg/CMakeLists.txt @@ -17,26 +17,19 @@ define_channel_client_subsystem("tsmf" "ffmpeg" "decoder") -set(${MODULE_PREFIX}_SRCS - tsmf_ffmpeg.c -) +set(${MODULE_PREFIX}_SRCS tsmf_ffmpeg.c) -set(${MODULE_PREFIX}_LIBS - freerdp - ${FFMPEG_LIBRARIES} -) +set(${MODULE_PREFIX}_LIBS freerdp ${FFMPEG_LIBRARIES}) if(APPLE) - # For this to work on apple, we need to add some frameworks - FIND_LIBRARY(COREFOUNDATION_LIBRARY CoreFoundation) - FIND_LIBRARY(COREVIDEO_LIBRARY CoreVideo) - FIND_LIBRARY(COREVIDEODECODE_LIBRARY VideoDecodeAcceleration) + # For this to work on apple, we need to add some frameworks + find_library(COREFOUNDATION_LIBRARY CoreFoundation) + find_library(COREVIDEO_LIBRARY CoreVideo) + find_library(COREVIDEODECODE_LIBRARY VideoDecodeAcceleration) - list(APPEND ${MODULE_PREFIX}_LIBS ${COREFOUNDATION_LIBRARY} ${COREVIDEO_LIBRARY} ${COREVIDEODECODE_LIBRARY}) + list(APPEND ${MODULE_PREFIX}_LIBS ${COREFOUNDATION_LIBRARY} ${COREVIDEO_LIBRARY} ${COREVIDEODECODE_LIBRARY}) endif() include_directories(..) include_directories(SYSTEM ${FFMPEG_INCLUDE_DIRS}) add_channel_client_subsystem_library(${MODULE_PREFIX} ${MODULE_NAME} ${CHANNEL_NAME} "" TRUE "") - - diff --git a/channels/tsmf/client/gstreamer/CMakeLists.txt b/channels/tsmf/client/gstreamer/CMakeLists.txt index c696edb6d..1f724399e 100644 --- a/channels/tsmf/client/gstreamer/CMakeLists.txt +++ b/channels/tsmf/client/gstreamer/CMakeLists.txt @@ -18,7 +18,7 @@ define_channel_client_subsystem("tsmf" "gstreamer" "decoder") if(NOT gstreamer_FOUND) - message(FATAL_ERROR "GStreamer library not found, but required for TSMF module.") + message(FATAL_ERROR "GStreamer library not found, but required for TSMF module.") endif() set(SRC "tsmf_gstreamer.c") @@ -27,49 +27,32 @@ pkg_check_modules(gstreamerbase gstreamer-base-1.0 REQUIRED) pkg_check_modules(gstreamervideo gstreamer-video-1.0 REQUIRED) pkg_check_modules(gstreamerapp gstreamer-app-1.0 REQUIRED) -set(LIBS - ${gstreamer_LIBRARIES} - ${gstreamerbase_LIBRARIES} - ${gstreamervideo_LIBRARIES} - ${gstreamerapp_LIBRARIES} +set(LIBS ${gstreamer_LIBRARIES} ${gstreamerbase_LIBRARIES} ${gstreamervideo_LIBRARIES} ${gstreamerapp_LIBRARIES}) +include_directories( + SYSTEM ${gstreamer_INCLUDE_DIRS} ${gstreamerbase_INCLUDE_DIRS} ${gstreamervideo_INCLUDE_DIRS} + ${gstreamerapp_INCLUDE_DIRS} ) -include_directories(SYSTEM - ${gstreamer_INCLUDE_DIRS} - ${gstreamerbase_INCLUDE_DIRS} - ${gstreamervideo_INCLUDE_DIRS} - ${gstreamerapp_INCLUDE_DIRS} -) - if(ANDROID) - set(SRC ${SRC} - tsmf_android.c) + set(SRC ${SRC} tsmf_android.c) else() - find_package(X11 REQUIRED) + find_package(X11 REQUIRED) - list(APPEND SRC - tsmf_X11.c) - list(APPEND LIBS - ${X11_LIBRARIES} - ${X11_Xext_LIB}) - if (NOT APPLE) - list(APPEND LIBS rt) - endif() + list(APPEND SRC tsmf_X11.c) + list(APPEND LIBS ${X11_LIBRARIES} ${X11_Xext_LIB}) + if(NOT APPLE) + list(APPEND LIBS rt) + endif() - if(X11_Xext_FOUND) - add_definitions(-DWITH_XEXT=1) - endif() + if(X11_Xext_FOUND) + add_definitions(-DWITH_XEXT=1) + endif() endif() -set(${MODULE_PREFIX}_SRCS - "${SRC}" -) +set(${MODULE_PREFIX}_SRCS "${SRC}") -set(${MODULE_PREFIX}_LIBS - ${LIBS} - winpr -) +set(${MODULE_PREFIX}_LIBS ${LIBS} winpr) include_directories(..) diff --git a/channels/tsmf/client/oss/CMakeLists.txt b/channels/tsmf/client/oss/CMakeLists.txt index c10647879..20c384ed8 100644 --- a/channels/tsmf/client/oss/CMakeLists.txt +++ b/channels/tsmf/client/oss/CMakeLists.txt @@ -19,17 +19,11 @@ define_channel_client_subsystem("tsmf" "oss" "audio") find_package(OSS REQUIRED) -set(${MODULE_PREFIX}_SRCS - tsmf_oss.c -) +set(${MODULE_PREFIX}_SRCS tsmf_oss.c) -set(${MODULE_PREFIX}_LIBS - winpr - ${OSS_LIBRARIES} -) +set(${MODULE_PREFIX}_LIBS winpr ${OSS_LIBRARIES}) include_directories(..) include_directories(SYSTEM ${OSS_INCLUDE_DIRS}) add_channel_client_subsystem_library(${MODULE_PREFIX} ${MODULE_NAME} ${CHANNEL_NAME} "" TRUE "") - diff --git a/channels/tsmf/client/pulse/CMakeLists.txt b/channels/tsmf/client/pulse/CMakeLists.txt index 0d39d93ee..b9f54c28a 100644 --- a/channels/tsmf/client/pulse/CMakeLists.txt +++ b/channels/tsmf/client/pulse/CMakeLists.txt @@ -19,15 +19,9 @@ define_channel_client_subsystem("tsmf" "pulse" "audio") find_package(PulseAudio REQUIRED) -set(${MODULE_PREFIX}_SRCS - tsmf_pulse.c -) +set(${MODULE_PREFIX}_SRCS tsmf_pulse.c) -set(${MODULE_PREFIX}_LIBS - winpr - ${PULSEAUDIO_LIBRARY} - ${PULSEAUDIO_MAINLOOP_LIBRARY} -) +set(${MODULE_PREFIX}_LIBS winpr ${PULSEAUDIO_LIBRARY} ${PULSEAUDIO_MAINLOOP_LIBRARY}) include_directories(..) include_directories(SYSTEM ${PULSEAUDIO_INCLUDE_DIR}) diff --git a/channels/urbdrc/CMakeLists.txt b/channels/urbdrc/CMakeLists.txt index e60d45550..f7443f421 100644 --- a/channels/urbdrc/CMakeLists.txt +++ b/channels/urbdrc/CMakeLists.txt @@ -21,10 +21,10 @@ include_directories(common) add_subdirectory(common) if(WITH_CLIENT_CHANNELS) - option(WITH_DEBUG_URBDRC "Dump data send/received in URBDRC channel" ${DEFAULT_DEBUG_OPTION}) + option(WITH_DEBUG_URBDRC "Dump data send/received in URBDRC channel" ${DEFAULT_DEBUG_OPTION}) - find_package(libusb-1.0 REQUIRED) - include_directories(SYSTEM ${LIBUSB_1_INCLUDE_DIRS}) + find_package(libusb-1.0 REQUIRED) + include_directories(SYSTEM ${LIBUSB_1_INCLUDE_DIRS}) - add_channel_client(${MODULE_PREFIX} ${CHANNEL_NAME}) + add_channel_client(${MODULE_PREFIX} ${CHANNEL_NAME}) endif() diff --git a/channels/urbdrc/ChannelOptions.cmake b/channels/urbdrc/ChannelOptions.cmake index 770ba5e7b..1770dbbd2 100644 --- a/channels/urbdrc/ChannelOptions.cmake +++ b/channels/urbdrc/ChannelOptions.cmake @@ -1,18 +1,25 @@ - -if (IOS OR ANDROID) - set(OPTION_DEFAULT OFF) - set(OPTION_CLIENT_DEFAULT OFF) - set(OPTION_SERVER_DEFAULT OFF) +if(IOS OR ANDROID) + set(OPTION_DEFAULT OFF) + set(OPTION_CLIENT_DEFAULT OFF) + set(OPTION_SERVER_DEFAULT OFF) else() - set(OPTION_DEFAULT ON) - set(OPTION_CLIENT_DEFAULT ON) - set(OPTION_SERVER_DEFAULT OFF) + set(OPTION_DEFAULT ON) + set(OPTION_CLIENT_DEFAULT ON) + set(OPTION_SERVER_DEFAULT OFF) endif() -define_channel_options(NAME "urbdrc" TYPE "dynamic" - DESCRIPTION "USB Devices Virtual Channel Extension" - SPECIFICATIONS "[MS-RDPEUSB]" - DEFAULT ${OPTION_DEFAULT}) +define_channel_options( + NAME + "urbdrc" + TYPE + "dynamic" + DESCRIPTION + "USB Devices Virtual Channel Extension" + SPECIFICATIONS + "[MS-RDPEUSB]" + DEFAULT + ${OPTION_DEFAULT} +) define_channel_client_options(${OPTION_CLIENT_DEFAULT}) define_channel_server_options(${OPTION_SERVER_DEFAULT}) diff --git a/channels/urbdrc/client/CMakeLists.txt b/channels/urbdrc/client/CMakeLists.txt index 178702475..9f9c8e72b 100644 --- a/channels/urbdrc/client/CMakeLists.txt +++ b/channels/urbdrc/client/CMakeLists.txt @@ -18,20 +18,11 @@ define_channel_client("urbdrc") -set(${MODULE_PREFIX}_SRCS - data_transfer.c - data_transfer.h - urbdrc_main.c - urbdrc_main.h -) +set(${MODULE_PREFIX}_SRCS data_transfer.c data_transfer.h urbdrc_main.c urbdrc_main.h) -set(${MODULE_PREFIX}_LIBS - winpr - freerdp - urbdrc-common -) -if (UDEV_FOUND AND UDEV_LIBRARIES) - list(APPEND ${MODULE_PREFIX}_LIBS ${UDEV_LIBRARIES}) +set(${MODULE_PREFIX}_LIBS winpr freerdp urbdrc-common) +if(UDEV_FOUND AND UDEV_LIBRARIES) + list(APPEND ${MODULE_PREFIX}_LIBS ${UDEV_LIBRARIES}) endif() add_channel_client_library(${MODULE_PREFIX} ${MODULE_NAME} ${CHANNEL_NAME} TRUE "DVCPluginEntry") diff --git a/channels/urbdrc/client/libusb/CMakeLists.txt b/channels/urbdrc/client/libusb/CMakeLists.txt index 4e219de8d..5de9381db 100644 --- a/channels/urbdrc/client/libusb/CMakeLists.txt +++ b/channels/urbdrc/client/libusb/CMakeLists.txt @@ -18,19 +18,10 @@ define_channel_client_subsystem("urbdrc" "libusb" "") -set(${MODULE_PREFIX}_SRCS - libusb_udevman.c - libusb_udevice.c - libusb_udevice.h -) +set(${MODULE_PREFIX}_SRCS libusb_udevman.c libusb_udevice.c libusb_udevice.h) -set(${MODULE_PREFIX}_LIBS - ${CMAKE_THREAD_LIBS_INIT} - ${LIBUSB_1_LIBRARIES} - winpr freerdp -) +set(${MODULE_PREFIX}_LIBS ${CMAKE_THREAD_LIBS_INIT} ${LIBUSB_1_LIBRARIES} winpr freerdp) include_directories(..) add_channel_client_subsystem_library(${MODULE_PREFIX} ${MODULE_NAME} ${CHANNEL_NAME} "" TRUE "") - diff --git a/channels/urbdrc/common/CMakeLists.txt b/channels/urbdrc/common/CMakeLists.txt index df9a8a920..efe28060a 100644 --- a/channels/urbdrc/common/CMakeLists.txt +++ b/channels/urbdrc/common/CMakeLists.txt @@ -16,14 +16,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -set(SRCS - urbdrc_types.h - urbdrc_helpers.h - urbdrc_helpers.c - msusb.h - msusb.c) +set(SRCS urbdrc_types.h urbdrc_helpers.h urbdrc_helpers.c msusb.h msusb.c) add_library(urbdrc-common STATIC ${SRCS}) -channel_install(urbdrc-common ${FREERDP_ADDIN_PATH} "FreeRDPTargets") - +channel_install(urbdrc-common ${FREERDP_ADDIN_PATH} "FreeRDPTargets") diff --git a/channels/video/CMakeLists.txt b/channels/video/CMakeLists.txt index f03c85189..389a884ae 100644 --- a/channels/video/CMakeLists.txt +++ b/channels/video/CMakeLists.txt @@ -18,5 +18,5 @@ define_channel("video") if(WITH_CLIENT_CHANNELS) - add_channel_client(${MODULE_PREFIX} ${CHANNEL_NAME}) + add_channel_client(${MODULE_PREFIX} ${CHANNEL_NAME}) endif() diff --git a/channels/video/ChannelOptions.cmake b/channels/video/ChannelOptions.cmake index e7f9ce86d..50caf00a1 100644 --- a/channels/video/ChannelOptions.cmake +++ b/channels/video/ChannelOptions.cmake @@ -1,12 +1,18 @@ - set(OPTION_DEFAULT OFF) set(OPTION_CLIENT_DEFAULT ON) set(OPTION_SERVER_DEFAULT OFF) -define_channel_options(NAME "video" TYPE "dynamic" - DESCRIPTION "Video optimized remoting Virtual Channel Extension" - SPECIFICATIONS "[MS-RDPEVOR]" - DEFAULT ${OPTION_DEFAULT}) +define_channel_options( + NAME + "video" + TYPE + "dynamic" + DESCRIPTION + "Video optimized remoting Virtual Channel Extension" + SPECIFICATIONS + "[MS-RDPEVOR]" + DEFAULT + ${OPTION_DEFAULT} +) define_channel_client_options(${OPTION_CLIENT_DEFAULT}) - diff --git a/channels/video/client/CMakeLists.txt b/channels/video/client/CMakeLists.txt index 68d3e3181..41e371dea 100644 --- a/channels/video/client/CMakeLists.txt +++ b/channels/video/client/CMakeLists.txt @@ -17,14 +17,9 @@ define_channel_client("video") -set(${MODULE_PREFIX}_SRCS - video_main.c - video_main.h -) +set(${MODULE_PREFIX}_SRCS video_main.c video_main.h) -set(${MODULE_PREFIX}_LIBS - winpr -) +set(${MODULE_PREFIX}_LIBS winpr) include_directories(..) add_channel_client_library(${MODULE_PREFIX} ${MODULE_NAME} ${CHANNEL_NAME} TRUE "DVCPluginEntry") diff --git a/ci/cmake-preloads/config-oss-fuzz.cmake b/ci/cmake-preloads/config-oss-fuzz.cmake index 05d04e452..b088346c9 100644 --- a/ci/cmake-preloads/config-oss-fuzz.cmake +++ b/ci/cmake-preloads/config-oss-fuzz.cmake @@ -1,28 +1,28 @@ message("PRELOADING cache") -set (CMAKE_VERBOSE_MAKEFILE ON CACHE BOOL "preload") -set (WITH_VERBOSE_WINPR_ASSERT ON CACHE BOOL "oss fuzz") +set(CMAKE_VERBOSE_MAKEFILE ON CACHE BOOL "preload") +set(WITH_VERBOSE_WINPR_ASSERT ON CACHE BOOL "oss fuzz") -set (WITH_SERVER ON CACHE BOOL "oss fuzz") -set (WITH_SAMPLE OFF CACHE BOOL "oss fuzz") -set (WITH_PROXY OFF CACHE BOOL "oss fuzz") -set (WITH_SHADOW OFF CACHE BOOL "oss fuzz") -set (WITH_CLIENT OFF CACHE BOOL "oss fuzz") -set (WITH_ALSA OFF CACHE BOOL "oss fuzz") -set (WITH_X11 OFF CACHE BOOL "oss fuzz") -set (WITH_FUSE OFF CACHE BOOL "oss fuzz") -set (WITH_AAD OFF CACHE BOOL "oss fuzz") -set (WITH_FFMPEG OFF CACHE BOOL "oss fuzz") -set (CHANNEL_RDPECAM_CLIENT OFF CACHE BOOL "oss fuzz") -set (WITH_SWSCALE OFF CACHE BOOL "oss fuzz") -set (WITH_LIBSYSTEMD OFF CACHE BOOL "oss fuzz") -set (WITH_UNICODE_BUILTIN ON CACHE BOOL "oss fuzz") -set (WITH_OPUS OFF CACHE BOOL "oss fuzz") -set (WITH_CUPS OFF CACHE BOOL "oss fuzz") -set (CHANNEL_URBDRC OFF CACHE BOOL "oss fuzz") +set(WITH_SERVER ON CACHE BOOL "oss fuzz") +set(WITH_SAMPLE OFF CACHE BOOL "oss fuzz") +set(WITH_PROXY OFF CACHE BOOL "oss fuzz") +set(WITH_SHADOW OFF CACHE BOOL "oss fuzz") +set(WITH_CLIENT OFF CACHE BOOL "oss fuzz") +set(WITH_ALSA OFF CACHE BOOL "oss fuzz") +set(WITH_X11 OFF CACHE BOOL "oss fuzz") +set(WITH_FUSE OFF CACHE BOOL "oss fuzz") +set(WITH_AAD OFF CACHE BOOL "oss fuzz") +set(WITH_FFMPEG OFF CACHE BOOL "oss fuzz") +set(CHANNEL_RDPECAM_CLIENT OFF CACHE BOOL "oss fuzz") +set(WITH_SWSCALE OFF CACHE BOOL "oss fuzz") +set(WITH_LIBSYSTEMD OFF CACHE BOOL "oss fuzz") +set(WITH_UNICODE_BUILTIN ON CACHE BOOL "oss fuzz") +set(WITH_OPUS OFF CACHE BOOL "oss fuzz") +set(WITH_CUPS OFF CACHE BOOL "oss fuzz") +set(CHANNEL_URBDRC OFF CACHE BOOL "oss fuzz") -set (BUILD_SHARED_LIBS OFF CACHE BOOL "oss fuzz") +set(BUILD_SHARED_LIBS OFF CACHE BOOL "oss fuzz") -set (BUILD_WITH_CLANG_TIDY OFF CACHE BOOL "oss fuzz") -set (OSS_FUZZ ON CACHE BOOL "oss fuzz") -set (BUILD_FUZZERS ON CACHE BOOL "oss fuzz") -set (BUILD_TESTING_INTERNAL ON CACHE BOOL "oss fuzz") +set(BUILD_WITH_CLANG_TIDY OFF CACHE BOOL "oss fuzz") +set(OSS_FUZZ ON CACHE BOOL "oss fuzz") +set(BUILD_FUZZERS ON CACHE BOOL "oss fuzz") +set(BUILD_TESTING_INTERNAL ON CACHE BOOL "oss fuzz") diff --git a/ci/cmake-preloads/config-qa-static.cmake b/ci/cmake-preloads/config-qa-static.cmake index cee70a5fd..ce0cfd98f 100644 --- a/ci/cmake-preloads/config-qa-static.cmake +++ b/ci/cmake-preloads/config-qa-static.cmake @@ -1,19 +1,19 @@ message("PRELOADING cache") -set (CMAKE_VERBOSE_MAKEFILE ON CACHE BOOL "preload") -set (WITH_SERVER ON CACHE BOOL "qa default") -set (WITH_SAMPLE ON CACHE BOOL "qa default") -set (WITH_SSE2 ON CACHE BOOL "qa default") -set (WITH_NEON ON CACHE BOOL "qa default") -set (WITH_VERBOSE_WINPR_ASSERT OFF CACHE BOOL "qa default") -set (ENABLE_WARNING_VERBOSE ON CACHE BOOL "preload") -set (BUILD_SHARED_LIBS OFF CACHE BOOL "qa default") +set(CMAKE_VERBOSE_MAKEFILE ON CACHE BOOL "preload") +set(WITH_SERVER ON CACHE BOOL "qa default") +set(WITH_SAMPLE ON CACHE BOOL "qa default") +set(WITH_SSE2 ON CACHE BOOL "qa default") +set(WITH_NEON ON CACHE BOOL "qa default") +set(WITH_VERBOSE_WINPR_ASSERT OFF CACHE BOOL "qa default") +set(ENABLE_WARNING_VERBOSE ON CACHE BOOL "preload") +set(BUILD_SHARED_LIBS OFF CACHE BOOL "qa default") -set (BUILD_WITH_CLANG_TIDY OFF CACHE BOOL "qa default") +set(BUILD_WITH_CLANG_TIDY OFF CACHE BOOL "qa default") include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/ClangDetectTool.cmake) clang_detect_tool(CLANG_EXE clang REQUIRED) clang_detect_tool(CLANG_XX_EXE clang++ REQUIRED) -set (CMAKE_C_COMPILER "${CLANG_EXE}" CACHE STRING "qa default") -set (CMAKE_CXX_COMPILER "${CLANG_XX_EXE}" CACHE STRING "qa default") -set (CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++" CACHE STRING "qa-default") +set(CMAKE_C_COMPILER "${CLANG_EXE}" CACHE STRING "qa default") +set(CMAKE_CXX_COMPILER "${CLANG_XX_EXE}" CACHE STRING "qa default") +set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++" CACHE STRING "qa-default") diff --git a/ci/cmake-preloads/config-qa.cmake b/ci/cmake-preloads/config-qa.cmake index 7686da851..99e07faf9 100644 --- a/ci/cmake-preloads/config-qa.cmake +++ b/ci/cmake-preloads/config-qa.cmake @@ -1,38 +1,38 @@ -set (BUILD_TESTING_INTERNAL ON CACHE BOOL "qa default") -set (CMAKE_VERBOSE_MAKEFILE ON CACHE BOOL "preload") -set (ENABLE_WARNING_VERBOSE ON CACHE BOOL "preload") -set (WITH_MANPAGES ON CACHE BOOL "qa default") -set (WITH_SAMPLE ON CACHE BOOL "qa default") -set (WITH_SERVER ON CACHE BOOL "qa default") -set (WITH_SHADOW ON CACHE BOOL "qa default") -set (WITH_PROXY ON CACHE BOOL "qa default") -set (WITH_PULSE ON CACHE BOOL "qa default") -set (WITH_CUPS ON CACHE BOOL "qa default") -set (WITH_OPENCL ON CACHE BOOL "qa default") -set (WITH_PCSC ON CACHE BOOL "qa default") -set (WITH_SOXR ON CACHE BOOL "qa default") -set (WITH_SSE2 ON CACHE BOOL "qa default") -set (WITH_NEON ON CACHE BOOL "qa default") -set (WITH_SWSCALE ON CACHE BOOL "qa default") -set (WITH_DSP_FFMPEG ON CACHE BOOL "qa default") -set (WITH_FFMPEG ON CACHE BOOL "qa default") -set (WITH_SANITIZE_ADDRESS ON CACHE BOOL "qa default") -set (WITH_WINPR_UTILS_IMAGE_JPEG ON CACHE BOOL "qa default") -set (WITH_WINPR_UTILS_IMAGE_WEBP ON CACHE BOOL "qa default") -set (WITH_WINPR_UTILS_IMAGE_PNG ON CACHE BOOL "qa default") -set (WITH_INTERNAL_RC4 ON CACHE BOOL "qa default") -set (WITH_INTERNAL_MD4 ON CACHE BOOL "qa default") -set (WITH_INTERNAL_MD5 ON CACHE BOOL "qa default") -set (CHANNEL_RDPECAM ON CACHE BOOL "qa default") -set (CHANNEL_RDPECAM_CLIENT ON CACHE BOOL "qa default") -set (CHANNEL_RDPEAR ON CACHE BOOL "qa default") -set (CHANNEL_RDPEAR_CLIENT ON CACHE BOOL "qa default") +set(BUILD_TESTING_INTERNAL ON CACHE BOOL "qa default") +set(CMAKE_VERBOSE_MAKEFILE ON CACHE BOOL "preload") +set(ENABLE_WARNING_VERBOSE ON CACHE BOOL "preload") +set(WITH_MANPAGES ON CACHE BOOL "qa default") +set(WITH_SAMPLE ON CACHE BOOL "qa default") +set(WITH_SERVER ON CACHE BOOL "qa default") +set(WITH_SHADOW ON CACHE BOOL "qa default") +set(WITH_PROXY ON CACHE BOOL "qa default") +set(WITH_PULSE ON CACHE BOOL "qa default") +set(WITH_CUPS ON CACHE BOOL "qa default") +set(WITH_OPENCL ON CACHE BOOL "qa default") +set(WITH_PCSC ON CACHE BOOL "qa default") +set(WITH_SOXR ON CACHE BOOL "qa default") +set(WITH_SSE2 ON CACHE BOOL "qa default") +set(WITH_NEON ON CACHE BOOL "qa default") +set(WITH_SWSCALE ON CACHE BOOL "qa default") +set(WITH_DSP_FFMPEG ON CACHE BOOL "qa default") +set(WITH_FFMPEG ON CACHE BOOL "qa default") +set(WITH_SANITIZE_ADDRESS ON CACHE BOOL "qa default") +set(WITH_WINPR_UTILS_IMAGE_JPEG ON CACHE BOOL "qa default") +set(WITH_WINPR_UTILS_IMAGE_WEBP ON CACHE BOOL "qa default") +set(WITH_WINPR_UTILS_IMAGE_PNG ON CACHE BOOL "qa default") +set(WITH_INTERNAL_RC4 ON CACHE BOOL "qa default") +set(WITH_INTERNAL_MD4 ON CACHE BOOL "qa default") +set(WITH_INTERNAL_MD5 ON CACHE BOOL "qa default") +set(CHANNEL_RDPECAM ON CACHE BOOL "qa default") +set(CHANNEL_RDPECAM_CLIENT ON CACHE BOOL "qa default") +set(CHANNEL_RDPEAR ON CACHE BOOL "qa default") +set(CHANNEL_RDPEAR_CLIENT ON CACHE BOOL "qa default") -set (BUILD_WITH_CLANG_TIDY ON CACHE BOOL "qa default") +set(BUILD_WITH_CLANG_TIDY ON CACHE BOOL "qa default") include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/ClangDetectTool.cmake) clang_detect_tool(CLANG_EXE clang REQUIRED) clang_detect_tool(CLANG_XX_EXE clang++ REQUIRED) -set (CMAKE_C_COMPILER "${CLANG_EXE}" CACHE STRING "qa default") -set (CMAKE_CXX_COMPILER "${CLANG_XX_EXE}" CACHE STRING "qa default") +set(CMAKE_C_COMPILER "${CLANG_EXE}" CACHE STRING "qa default") +set(CMAKE_CXX_COMPILER "${CLANG_XX_EXE}" CACHE STRING "qa default") diff --git a/client/Android/Studio/freeRDPCore/src/main/cpp/CMakeLists.txt b/client/Android/Studio/freeRDPCore/src/main/cpp/CMakeLists.txt index c986eed58..ee3f6ae69 100644 --- a/client/Android/Studio/freeRDPCore/src/main/cpp/CMakeLists.txt +++ b/client/Android/Studio/freeRDPCore/src/main/cpp/CMakeLists.txt @@ -19,14 +19,11 @@ cmake_minimum_required(VERSION 3.13) -if (NOT FREERDP_DEFAULT_PROJECT_VERSION) - set(FREERDP_DEFAULT_PROJECT_VERSION "1.0.0.0") +if(NOT FREERDP_DEFAULT_PROJECT_VERSION) + set(FREERDP_DEFAULT_PROJECT_VERSION "1.0.0.0") endif() -project("freerdp-android" - LANGUAGES C - VERSION ${FREERDP_DEFAULT_PROJECT_VERSION} -) +project("freerdp-android" LANGUAGES C VERSION ${FREERDP_DEFAULT_PROJECT_VERSION}) message("project ${PROJECT_NAME} is using version ${PROJECT_VERSION}") @@ -36,26 +33,24 @@ set(MODULE_PREFIX "FREERDP_CLIENT_ANDROID") set(FREERDP_IMPORT_DIR_RELATIVE ../jniLibs/${CMAKE_ANDROID_ARCH_ABI}) get_filename_component(FREERDP_IMPORT_DIR ${FREERDP_IMPORT_DIR_RELATIVE} ABSOLUTE) -include_directories(SYSTEM - ${FREERDP_IMPORT_DIR}/include/freerdp3 - ${FREERDP_IMPORT_DIR}/include/winpr3 - ${FREERDP_IMPORT_DIR}/include/openssl +include_directories( + SYSTEM ${FREERDP_IMPORT_DIR}/include/freerdp3 ${FREERDP_IMPORT_DIR}/include/winpr3 + ${FREERDP_IMPORT_DIR}/include/openssl ) set(${MODULE_PREFIX}_SRCS - android_event.c - android_event.h - android_freerdp.c - android_freerdp.h - android_jni_utils.c - android_jni_utils.h - android_jni_callback.c - android_jni_callback.h) + android_event.c + android_event.h + android_freerdp.c + android_freerdp.h + android_jni_utils.c + android_jni_utils.h + android_jni_callback.c + android_jni_callback.h +) if(WITH_CLIENT_CHANNELS) - set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} - android_cliprdr.c - android_cliprdr.h) + set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} android_cliprdr.c android_cliprdr.h) endif() add_library(${MODULE_NAME} SHARED ${${MODULE_PREFIX}_SRCS}) @@ -78,12 +73,11 @@ find_library(jnigraphics-lib jnigraphics) # build script, prebuilt third-party libraries, or system libraries. target_link_libraries( - ${MODULE_NAME} - - freerdp3-lib - freerdp-client3-lib - winpr3-lib - - ${log-lib} - ${dl-lib} - ${jnigraphics-lib} ) + ${MODULE_NAME} + freerdp3-lib + freerdp-client3-lib + winpr3-lib + ${log-lib} + ${dl-lib} + ${jnigraphics-lib} +) diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt index 75bf0cdfd..761c6247f 100644 --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -21,96 +21,106 @@ include(CMakeDependentOption) include(InstallFreeRDPDesktop) if(WITH_CLIENT_COMMON) - add_subdirectory(common) + add_subdirectory(common) endif() if(FREERDP_VENDOR AND WITH_CLIENT) - if(WIN32 AND NOT UWP) - add_subdirectory(Windows) - else() - if(WITH_SAMPLE) - add_subdirectory(Sample) - endif() - endif() - - if (WITH_CLIENT_SDL) - add_subdirectory(SDL) + if(WIN32 AND NOT UWP) + add_subdirectory(Windows) + else() + if(WITH_SAMPLE) + add_subdirectory(Sample) endif() + endif() - if(WITH_X11) - add_subdirectory(X11) - endif() + if(WITH_CLIENT_SDL) + add_subdirectory(SDL) + endif() - if(WITH_WAYLAND AND WAYLAND_FOUND) - add_subdirectory(Wayland) - endif() + if(WITH_X11) + add_subdirectory(X11) + endif() - if(APPLE) - if(IOS) - if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/iOS") - message(STATUS "Adding iOS client") - add_subdirectory(iOS) - endif() - else() - option(WITH_CLIENT_MAC "Build native mac client" ON) - if (WITH_CLIENT_MAC) - add_subdirectory(Mac) - endif() - endif() - endif() + if(WITH_WAYLAND AND WAYLAND_FOUND) + add_subdirectory(Wayland) + endif() - if(ANDROID) - message(STATUS "Android client module is built with Android Studio project") - endif() + if(APPLE) + if(IOS) + if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/iOS") + message(STATUS "Adding iOS client") + add_subdirectory(iOS) + endif() + else() + option(WITH_CLIENT_MAC "Build native mac client" ON) + if(WITH_CLIENT_MAC) + add_subdirectory(Mac) + endif() + endif() + endif() + + if(ANDROID) + message(STATUS "Android client module is built with Android Studio project") + endif() endif() # Pick up other clients if(WITH_CLIENT) - set(FILENAME "ModuleOptions.cmake") - file(GLOB FILEPATHS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*/${FILENAME}") + set(FILENAME "ModuleOptions.cmake") + file(GLOB FILEPATHS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*/${FILENAME}") - foreach(FILEPATH ${FILEPATHS}) - if(${FILEPATH} MATCHES "^([^/]*)/+${FILENAME}") - string(REGEX REPLACE "^([^/]*)/+${FILENAME}" "\\1" FREERDP_CLIENT ${FILEPATH}) - set(FREERDP_CLIENT_ENABLED 0) - include(${FILEPATH}) - if(FREERDP_CLIENT_ENABLED) - if(NOT (${FREERDP_CLIENT_VENDOR} MATCHES "FreeRDP")) - list(APPEND FREERDP_EXTRA_CLIENTS ${FREERDP_CLIENT}) - if(${FREERDP_CLIENT_VENDOR} MATCHES "${VENDOR}") - set(CLIENT_VENDOR_PATH "client/${FREERDP_CLIENT}" PARENT_SCOPE) - endif() - endif() - endif() - endif() - endforeach() + foreach(FILEPATH ${FILEPATHS}) + if(${FILEPATH} MATCHES "^([^/]*)/+${FILENAME}") + string(REGEX REPLACE "^([^/]*)/+${FILENAME}" "\\1" FREERDP_CLIENT ${FILEPATH}) + set(FREERDP_CLIENT_ENABLED 0) + include(${FILEPATH}) + if(FREERDP_CLIENT_ENABLED) + if(NOT (${FREERDP_CLIENT_VENDOR} MATCHES "FreeRDP")) + list(APPEND FREERDP_EXTRA_CLIENTS ${FREERDP_CLIENT}) + if(${FREERDP_CLIENT_VENDOR} MATCHES "${VENDOR}") + set(CLIENT_VENDOR_PATH "client/${FREERDP_CLIENT}" PARENT_SCOPE) + endif() + endif() + endif() + endif() + endforeach() - foreach(FREERDP_CLIENT ${FREERDP_EXTRA_CLIENTS}) - add_subdirectory(${FREERDP_CLIENT}) - endforeach() + foreach(FREERDP_CLIENT ${FREERDP_EXTRA_CLIENTS}) + add_subdirectory(${FREERDP_CLIENT}) + endforeach() endif() -if (WITH_FUSE) - list(APPEND FREERDP_CLIENT_PC_PRIVATE_LIBS "-lfuse3") +if(WITH_FUSE) + list(APPEND FREERDP_CLIENT_PC_PRIVATE_LIBS "-lfuse3") endif() list(JOIN FREERDP_CLIENT_PC_PRIVATE_LIBS " " FREERDP_CLIENT_PC_PRIVATE_LIBS) include(pkg-config-install-prefix) -cleaning_configure_file(${CMAKE_CURRENT_SOURCE_DIR}/freerdp-client.pc.in ${CMAKE_CURRENT_BINARY_DIR}/freerdp-client${FREERDP_VERSION_MAJOR}.pc @ONLY) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/freerdp-client${FREERDP_VERSION_MAJOR}.pc DESTINATION ${PKG_CONFIG_PC_INSTALL_DIR}) +cleaning_configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/freerdp-client.pc.in + ${CMAKE_CURRENT_BINARY_DIR}/freerdp-client${FREERDP_VERSION_MAJOR}.pc @ONLY +) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/freerdp-client${FREERDP_VERSION_MAJOR}.pc + DESTINATION ${PKG_CONFIG_PC_INSTALL_DIR} +) export(PACKAGE freerdp-client) -SetFreeRDPCMakeInstallDir(FREERDP_CLIENT_CMAKE_INSTALL_DIR "FreeRDP-Client${FREERDP_VERSION_MAJOR}") +setfreerdpcmakeinstalldir(FREERDP_CLIENT_CMAKE_INSTALL_DIR "FreeRDP-Client${FREERDP_VERSION_MAJOR}") -configure_package_config_file(FreeRDP-ClientConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/FreeRDP-ClientConfig.cmake - INSTALL_DESTINATION ${FREERDP_CLIENT_CMAKE_INSTALL_DIR} - PATH_VARS FREERDP_INCLUDE_DIR) +configure_package_config_file( + FreeRDP-ClientConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/FreeRDP-ClientConfig.cmake + INSTALL_DESTINATION ${FREERDP_CLIENT_CMAKE_INSTALL_DIR} PATH_VARS FREERDP_INCLUDE_DIR +) -write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/FreeRDP-ClientConfigVersion.cmake - VERSION ${FREERDP_VERSION} COMPATIBILITY SameMajorVersion) +write_basic_package_version_file( + ${CMAKE_CURRENT_BINARY_DIR}/FreeRDP-ClientConfigVersion.cmake VERSION ${FREERDP_VERSION} + COMPATIBILITY SameMajorVersion +) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/FreeRDP-ClientConfig.cmake ${CMAKE_CURRENT_BINARY_DIR}/FreeRDP-ClientConfigVersion.cmake - DESTINATION ${FREERDP_CLIENT_CMAKE_INSTALL_DIR}) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/FreeRDP-ClientConfig.cmake + ${CMAKE_CURRENT_BINARY_DIR}/FreeRDP-ClientConfigVersion.cmake + DESTINATION ${FREERDP_CLIENT_CMAKE_INSTALL_DIR} +) install(EXPORT FreeRDP-ClientTargets DESTINATION ${FREERDP_CLIENT_CMAKE_INSTALL_DIR}) diff --git a/client/Mac/CMakeLists.txt b/client/Mac/CMakeLists.txt index 6b1d5f8eb..f44ebac2c 100644 --- a/client/Mac/CMakeLists.txt +++ b/client/Mac/CMakeLists.txt @@ -1,12 +1,10 @@ cmake_minimum_required(VERSION 3.13) -if (NOT FREERDP_DEFAULT_PROJECT_VERSION) - set(FREERDP_DEFAULT_PROJECT_VERSION "1.0.0.0") +if(NOT FREERDP_DEFAULT_PROJECT_VERSION) + set(FREERDP_DEFAULT_PROJECT_VERSION "1.0.0.0") endif() -project(MacFreeRDP-library - VERSION ${FREERDP_DEFAULT_PROJECT_VERSION} -) +project(MacFreeRDP-library VERSION ${FREERDP_DEFAULT_PROJECT_VERSION}) message("project ${PROJECT_NAME} is using version ${PROJECT_VERSION}") @@ -24,86 +22,71 @@ find_library(COREGRAPHICS_LIBRARY CoreGraphics REQUIRED) set(EXTRA_LIBS ${COCOA_LIBRARY} ${FOUNDATION_LIBRARY} ${APPKIT_LIBRARY} ${IOKIT_LIBRARY}) -set(XIBS - CertificateDialog.xib - PasswordDialog.xib) +set(XIBS CertificateDialog.xib PasswordDialog.xib) set(SOURCES "") set(OBJECTIVE_SOURCES - main.m - mf_client.m - MRDPCursor.m - MRDPView.m - Keyboard.m - Clipboard.m - CertificateDialog.m - PasswordDialog.m) + main.m + mf_client.m + MRDPCursor.m + MRDPView.m + Keyboard.m + Clipboard.m + CertificateDialog.m + PasswordDialog.m +) list(APPEND SOURCES ${OBJECTIVE_SOURCES}) set(HEADERS - mfreerdp.h - mf_client.h - MRDPCursor.h - MRDPView.h - Keyboard.h - Clipboard.h - CertificateDialog.h - PasswordDialog.h) + mfreerdp.h + mf_client.h + MRDPCursor.h + MRDPView.h + Keyboard.h + Clipboard.h + CertificateDialog.h + PasswordDialog.h +) set(RESOURCES "en.lproj/InfoPlist.strings") # Include XIB file in Xcode resources. if("${CMAKE_GENERATOR}" MATCHES "Xcode") - message(STATUS "Adding Xcode XIB resources for ${MODULE_NAME}") - list(APPEND RESOURCES ${XIBS}) - set(IS_XCODE ON) + message(STATUS "Adding Xcode XIB resources for ${MODULE_NAME}") + list(APPEND RESOURCES ${XIBS}) + set(IS_XCODE ON) endif() +add_library(${PROJECT_NAME} ../common/client.c ${SOURCES} ${HEADERS} ${RESOURCES}) -add_library(${PROJECT_NAME} - ../common/client.c - ${SOURCES} - ${HEADERS} - ${RESOURCES}) - -set(LIBS - ${EXTRA_LIBS} - freerdp-client - ) +set(LIBS ${EXTRA_LIBS} freerdp-client) target_link_libraries(${PROJECT_NAME} PUBLIC ${LIBS}) set_target_properties(${PROJECT_NAME} PROPERTIES RESOURCE "${RESOURCES}") -if (NOT IS_XCODE) - find_program(IBTOOL ibtool REQUIRED - HINTS - "/usr/bin" - "${OSX_DEVELOPER_ROOT}/usr/bin" +if(NOT IS_XCODE) + find_program(IBTOOL ibtool REQUIRED HINTS "/usr/bin" "${OSX_DEVELOPER_ROOT}/usr/bin") + + # Compile the .xib files using the 'ibtool' program with the destination being the app package + foreach(xib ${XIBS}) + get_filename_component(XIB_WE ${xib} NAME_WE) + set(NIB ${CMAKE_CURRENT_BINARY_DIR}/${XIB_WE}.nib) + list(APPEND NIBS ${NIB}) + + add_custom_command( + TARGET ${PROJECT_NAME} POST_BUILD COMMAND ${IBTOOL} --errors --warnings --notices --output-format + human-readable-text --compile ${NIB} ${CMAKE_CURRENT_SOURCE_DIR}/${xib} + COMMENT "Compiling ${xib}" ) + endforeach() - # Compile the .xib files using the 'ibtool' program with the destination being the app package - foreach(xib ${XIBS}) - get_filename_component(XIB_WE ${xib} NAME_WE) - set(NIB ${CMAKE_CURRENT_BINARY_DIR}/${XIB_WE}.nib) - list(APPEND NIBS ${NIB}) - - add_custom_command (TARGET ${PROJECT_NAME} POST_BUILD - COMMAND ${IBTOOL} --errors --warnings --notices --output-format human-readable-text - --compile ${NIB} ${CMAKE_CURRENT_SOURCE_DIR}/${xib} - COMMENT "Compiling ${xib}") - endforeach() - - install(FILES ${NIBS} DESTINATION ${CMAKE_INSTALL_DATADIR}) + install(FILES ${NIBS} DESTINATION ${CMAKE_INSTALL_DATADIR}) endif() - -install(TARGETS ${PROJECT_NAME} - COMPONENT client - RESOURCE DESTINATION ${CMAKE_INSTALL_DATADIR} - ) +install(TARGETS ${PROJECT_NAME} COMPONENT client RESOURCE DESTINATION ${CMAKE_INSTALL_DATADIR}) include_directories(${CMAKE_CURRENT_SOURCE_DIR}) add_subdirectory(cli) diff --git a/client/Mac/ModuleOptions.cmake b/client/Mac/ModuleOptions.cmake index 3902d2b71..10ab91c56 100644 --- a/client/Mac/ModuleOptions.cmake +++ b/client/Mac/ModuleOptions.cmake @@ -1,4 +1,3 @@ - set(FREERDP_CLIENT_NAME "mfreerdp") set(FREERDP_CLIENT_PLATFORM "MacOSX") set(FREERDP_CLIENT_VENDOR "FreeRDP") diff --git a/client/Mac/cli/CMakeLists.txt b/client/Mac/cli/CMakeLists.txt index b8fc53ada..6b1faf5c6 100644 --- a/client/Mac/cli/CMakeLists.txt +++ b/client/Mac/cli/CMakeLists.txt @@ -1,12 +1,10 @@ cmake_minimum_required(VERSION 3.13) -if (NOT FREERDP_DEFAULT_PROJECT_VERSION) - set(FREERDP_DEFAULT_PROJECT_VERSION "1.0.0.0") +if(NOT FREERDP_DEFAULT_PROJECT_VERSION) + set(FREERDP_DEFAULT_PROJECT_VERSION "1.0.0.0") endif() -project(MacFreeRDP - VERSION ${FREERDP_DEFAULT_PROJECT_VERSION} -) +project(MacFreeRDP VERSION ${FREERDP_DEFAULT_PROJECT_VERSION}) message("project ${PROJECT_NAME} is using version ${PROJECT_VERSION}") @@ -36,75 +34,55 @@ set(XIBS MainMenu.xib) set(SOURCES "") -set(OBJECTIVE_SOURCES - main.m - AppDelegate.m - ) +set(OBJECTIVE_SOURCES main.m AppDelegate.m) list(APPEND SOURCES ${OBJECTIVE_SOURCES}) -set(HEADERS - AppDelegate.h - ) +set(HEADERS AppDelegate.h) -set(RESOURCES - "en.lproj/InfoPlist.strings" - ${MACOSX_BUNDLE_ICON_FILE} -) +set(RESOURCES "en.lproj/InfoPlist.strings" ${MACOSX_BUNDLE_ICON_FILE}) # Include XIB file in Xcode resources. if("${CMAKE_GENERATOR}" MATCHES "Xcode") - message(STATUS "Adding Xcode XIB resources for ${MODULE_NAME}") - list(APPEND RESOURCES ${XIBS}) - set(IS_XCODE ON) + message(STATUS "Adding Xcode XIB resources for ${MODULE_NAME}") + list(APPEND RESOURCES ${XIBS}) + set(IS_XCODE ON) endif() configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Info.plist.in ${CMAKE_CURRENT_BINARY_DIR}/Info.plist @ONLY) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/PkgInfo.in ${CMAKE_CURRENT_BINARY_DIR}/PkgInfo @ONLY) -add_executable(${PROJECT_NAME} - ${HEADERS} - ${SOURCES} - ${RESOURCES}) +add_executable(${PROJECT_NAME} ${HEADERS} ${SOURCES} ${RESOURCES}) -if (WITH_BINARY_VERSIONING) - set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME "${PROJECT_NAME}${PROJECT_VERSION_MAJOR}") +if(WITH_BINARY_VERSIONING) + set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME "${PROJECT_NAME}${PROJECT_VERSION_MAJOR}") endif() set_target_properties(${PROJECT_NAME} PROPERTIES RESOURCE "${RESOURCES}") set_target_properties(${PROJECT_NAME} PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_BINARY_DIR}/Info.plist) -target_link_libraries(${PROJECT_NAME} PRIVATE - ${COCOA_LIBRARY} - ${FOUNDATION_LIBRARY} - ${APPKIT_LIBRARY} - MacFreeRDP-library +target_link_libraries( + ${PROJECT_NAME} PRIVATE ${COCOA_LIBRARY} ${FOUNDATION_LIBRARY} ${APPKIT_LIBRARY} MacFreeRDP-library +) + +if(NOT IS_XCODE) + find_program(IBTOOL ibtool REQUIRED HINTS "/usr/bin" "${OSX_DEVELOPER_ROOT}/usr/bin") + + # Compile the .xib files using the 'ibtool' program with the destination being the app package + + foreach(xib ${XIBS}) + get_filename_component(XIB_WE ${xib} NAME_WE) + set(NIB ${CMAKE_CURRENT_BINARY_DIR}/${XIB_WE}.nib) + list(APPEND NIBS ${NIB}) + + add_custom_command( + TARGET ${PROJECT_NAME} POST_BUILD COMMAND ${IBTOOL} --errors --warnings --notices --output-format + human-readable-text --compile ${NIB} ${CMAKE_CURRENT_SOURCE_DIR}/${xib} + COMMENT "Compiling ${xib}" ) + endforeach() -if (NOT IS_XCODE) - find_program(IBTOOL ibtool REQUIRED - HINTS - "/usr/bin" - "${OSX_DEVELOPER_ROOT}/usr/bin" - ) - - # Compile the .xib files using the 'ibtool' program with the destination being the app package - - foreach(xib ${XIBS}) - get_filename_component(XIB_WE ${xib} NAME_WE) - set(NIB ${CMAKE_CURRENT_BINARY_DIR}/${XIB_WE}.nib) - list(APPEND NIBS ${NIB}) - - add_custom_command (TARGET ${PROJECT_NAME} POST_BUILD - COMMAND ${IBTOOL} --errors --warnings --notices --output-format human-readable-text - --compile ${NIB} ${CMAKE_CURRENT_SOURCE_DIR}/${xib} - COMMENT "Compiling ${xib}") - endforeach() - - install(FILES ${NIBS} DESTINATION ${CMAKE_INSTALL_DATADIR}) + install(FILES ${NIBS} DESTINATION ${CMAKE_INSTALL_DATADIR}) endif() -install(TARGETS ${PROJECT_NAME} - COMPONENT client - RESOURCE DESTINATION ${CMAKE_INSTALL_DATADIR} - ) +install(TARGETS ${PROJECT_NAME} COMPONENT client RESOURCE DESTINATION ${CMAKE_INSTALL_DATADIR}) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/Info.plist DESTINATION ${CMAKE_INSTALL_PREFIX}) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/PkgInfo DESTINATION ${CMAKE_INSTALL_PREFIX}) diff --git a/client/SDL/CMakeLists.txt b/client/SDL/CMakeLists.txt index 45ddd3b3d..490cca260 100644 --- a/client/SDL/CMakeLists.txt +++ b/client/SDL/CMakeLists.txt @@ -18,16 +18,13 @@ cmake_minimum_required(VERSION 3.13) if(POLICY CMP0091) - cmake_policy(SET CMP0091 NEW) + cmake_policy(SET CMP0091 NEW) endif() -if (NOT FREERDP_DEFAULT_PROJECT_VERSION) - set(FREERDP_DEFAULT_PROJECT_VERSION "1.0.0.0") +if(NOT FREERDP_DEFAULT_PROJECT_VERSION) + set(FREERDP_DEFAULT_PROJECT_VERSION "1.0.0.0") endif() -project(sdl-freerdp - LANGUAGES CXX - VERSION ${FREERDP_DEFAULT_PROJECT_VERSION} -) +project(sdl-freerdp LANGUAGES CXX VERSION ${FREERDP_DEFAULT_PROJECT_VERSION}) message("project ${PROJECT_NAME} is using version ${PROJECT_VERSION}") @@ -42,7 +39,9 @@ include(ConfigureFreeRDP) include(CXXCompilerFlags) option(WITH_DEBUG_SDL_EVENTS "[dangerous, not for release builds!] Debug SDL events" ${DEFAULT_DEBUG_OPTION}) -option(WITH_DEBUG_SDL_KBD_EVENTS "[dangerous, not for release builds!] Debug SDL keyboard events" ${DEFAULT_DEBUG_OPTION}) +option(WITH_DEBUG_SDL_KBD_EVENTS "[dangerous, not for release builds!] Debug SDL keyboard events" + ${DEFAULT_DEBUG_OPTION} +) option(WITH_WIN_CONSOLE "Build ${PROJECT_NAME} with console support" ON) option(WITH_SDL_LINK_SHARED "link SDL dynamic or static" ON) @@ -52,12 +51,11 @@ else() set(WIN32_GUI_FLAG "WIN32") endif() - -if (WITH_DEBUG_SDL_EVENTS) - add_definitions(-DWITH_DEBUG_SDL_EVENTS) +if(WITH_DEBUG_SDL_EVENTS) + add_definitions(-DWITH_DEBUG_SDL_EVENTS) endif() -if (WITH_DEBUG_SDL_KBD_EVENTS) - add_definitions(-DWITH_DEBUG_SDL_KBD_EVENTS) +if(WITH_DEBUG_SDL_KBD_EVENTS) + add_definitions(-DWITH_DEBUG_SDL_KBD_EVENTS) endif() include(CMakeDependentOption) @@ -66,34 +64,37 @@ find_package(SDL2) find_package(SDL3) cmake_dependent_option(WITH_CLIENT_SDL_VERSIONED "append sdl version to client binaries" OFF WITH_CLIENT_SDL OFF) -cmake_dependent_option(WITH_CLIENT_SDL2 "[experimental] build experimental SDL2 client" ${SDL2_FOUND} WITH_CLIENT_SDL OFF) -cmake_dependent_option(WITH_CLIENT_SDL3 "[experimental] build experimental SDL3 client" ${SDL3_FOUND} WITH_CLIENT_SDL OFF) +cmake_dependent_option( + WITH_CLIENT_SDL2 "[experimental] build experimental SDL2 client" ${SDL2_FOUND} WITH_CLIENT_SDL OFF +) +cmake_dependent_option( + WITH_CLIENT_SDL3 "[experimental] build experimental SDL3 client" ${SDL3_FOUND} WITH_CLIENT_SDL OFF +) -if (WITH_CLIENT_SDL2 AND WITH_CLIENT_SDL3) - message("Building both, SDL2 and SDL3 clients, forcing WITH_CLIENT_SDL_VERSIONED=ON") - set(WITH_CLIENT_SDL_VERSIONED ON) +if(WITH_CLIENT_SDL2 AND WITH_CLIENT_SDL3) + message("Building both, SDL2 and SDL3 clients, forcing WITH_CLIENT_SDL_VERSIONED=ON") + set(WITH_CLIENT_SDL_VERSIONED ON) endif() -if (NOT SDL2_FOUND AND NOT SDL3_FOUND) - message(FATAL_ERROR "No SDL library detected, giving up. Install SDL2 or SDL3 development package to fix") +if(NOT SDL2_FOUND AND NOT SDL3_FOUND) + message(FATAL_ERROR "No SDL library detected, giving up. Install SDL2 or SDL3 development package to fix") endif() add_subdirectory(common) include_directories(common) -if (WITH_CLIENT_SDL2) - if (SDL2_FOUND) - add_subdirectory(SDL2) - else() - message(WARNING "SDL2 requested but not found, continuing build without SDL2 client") - endif() +if(WITH_CLIENT_SDL2) + if(SDL2_FOUND) + add_subdirectory(SDL2) + else() + message(WARNING "SDL2 requested but not found, continuing build without SDL2 client") + endif() endif() -if (WITH_CLIENT_SDL3) - if (SDL3_FOUND) - add_subdirectory(SDL3) - else() - message(WARNING "SDL3 requested but not found, continuing build without SDL3 client") - endif() +if(WITH_CLIENT_SDL3) + if(SDL3_FOUND) + add_subdirectory(SDL3) + else() + message(WARNING "SDL3 requested but not found, continuing build without SDL3 client") + endif() endif() - diff --git a/client/SDL/SDL2/CMakeLists.txt b/client/SDL/SDL2/CMakeLists.txt index d337f10fe..ddf5c491d 100644 --- a/client/SDL/SDL2/CMakeLists.txt +++ b/client/SDL/SDL2/CMakeLists.txt @@ -45,35 +45,35 @@ set(SRCS sdl_window.cpp ) -list(APPEND LIBS - winpr - freerdp - freerdp-client - Threads::Threads - sdl2_client_res - sdl2-dialogs - sdl-common-aad-view - sdl-common-prefs - ) +list( + APPEND + LIBS + winpr + freerdp + freerdp-client + Threads::Threads + sdl2_client_res + sdl2-dialogs + sdl-common-aad-view + sdl-common-prefs +) -if (NOT WITH_SDL_LINK_SHARED) - list(APPEND LIBS ${SDL2_STATIC_LIBRARIES}) +if(NOT WITH_SDL_LINK_SHARED) + list(APPEND LIBS ${SDL2_STATIC_LIBRARIES}) else() - list(APPEND LIBS ${SDL2_LIBRARIES}) + list(APPEND LIBS ${SDL2_LIBRARIES}) endif() -AddTargetWithResourceFile(${MODULE_NAME} TRUE "${PROJECT_VERSION}" SRCS) +addtargetwithresourcefile(${MODULE_NAME} TRUE "${PROJECT_VERSION}" SRCS) target_link_libraries(${MODULE_NAME} PRIVATE ${LIBS}) set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Client/SDL") -if (NOT WITH_CLIENT_SDL_VERSIONED) - get_target_property(OUT_NAME ${MODULE_NAME} OUTPUT_NAME) - string(REPLACE "${MODULE_NAME}" "${PROJECT_NAME}" OUT_NAME "${OUT_NAME}") - set_target_properties(${MODULE_NAME} - PROPERTIES - OUTPUT_NAME ${OUT_NAME}) +if(NOT WITH_CLIENT_SDL_VERSIONED) + get_target_property(OUT_NAME ${MODULE_NAME} OUTPUT_NAME) + string(REPLACE "${MODULE_NAME}" "${PROJECT_NAME}" OUT_NAME "${OUT_NAME}") + set_target_properties(${MODULE_NAME} PROPERTIES OUTPUT_NAME ${OUT_NAME}) endif() install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT client) diff --git a/client/SDL/SDL2/dialogs/CMakeLists.txt b/client/SDL/SDL2/dialogs/CMakeLists.txt index bba708c66..d86b5345a 100644 --- a/client/SDL/SDL2/dialogs/CMakeLists.txt +++ b/client/SDL/SDL2/dialogs/CMakeLists.txt @@ -19,57 +19,52 @@ set(SRCS sdl_connection_dialog.hpp ) -list(APPEND LIBS - sdl2_client_res - winpr -) +list(APPEND LIBS sdl2_client_res winpr) -if (NOT WITH_SDL_LINK_SHARED) - list(APPEND LIBS ${SDL2_STATIC_LIBRARIES}) +if(NOT WITH_SDL_LINK_SHARED) + list(APPEND LIBS ${SDL2_STATIC_LIBRARIES}) else() - list(APPEND LIBS ${SDL2_LIBRARIES}) + list(APPEND LIBS ${SDL2_LIBRARIES}) endif() macro(find_sdl_component name) - find_package(${name}) - if (NOT ${name}_FOUND) - find_package(PkgConfig REQUIRED) - pkg_check_modules(${name} REQUIRED ${name}) + find_package(${name}) + if(NOT ${name}_FOUND) + find_package(PkgConfig REQUIRED) + pkg_check_modules(${name} REQUIRED ${name}) - if (BUILD_SHARED_LIBS) - list(APPEND LIBS ${${name}_LIBRARIES}) - link_directories(${${name}_LIBRARY_DIRS}) - include_directories(SYSTEM ${${name}_INCLUDE_DIRS}) - else() - list(APPEND LIBS ${${name}_STATIC_LIBRARIES}) - link_directories(${${name}_STATIC_LIBRARY_DIRS}) - include_directories(SYSTEM ${${name}_STATIC_INCLUDE_DIRS}) - endif() - else() - if (WITH_SDL_LINK_SHARED) - list(APPEND LIBS ${name}::${name}) - else() - list(APPEND LIBS ${name}::${name}-static) - endif() - endif() + if(BUILD_SHARED_LIBS) + list(APPEND LIBS ${${name}_LIBRARIES}) + link_directories(${${name}_LIBRARY_DIRS}) + include_directories(SYSTEM ${${name}_INCLUDE_DIRS}) + else() + list(APPEND LIBS ${${name}_STATIC_LIBRARIES}) + link_directories(${${name}_STATIC_LIBRARY_DIRS}) + include_directories(SYSTEM ${${name}_STATIC_INCLUDE_DIRS}) + endif() + else() + if(WITH_SDL_LINK_SHARED) + list(APPEND LIBS ${name}::${name}) + else() + list(APPEND LIBS ${name}::${name}-static) + endif() + endif() endmacro() find_sdl_component(SDL2_ttf) option(WITH_SDL_IMAGE_DIALOGS "Build with SDL_image support (recommended)" OFF) -if (WITH_SDL_IMAGE_DIALOGS) - find_sdl_component(SDL2_image) - add_definitions(-DWITH_SDL_IMAGE_DIALOGS) +if(WITH_SDL_IMAGE_DIALOGS) + find_sdl_component(SDL2_image) + add_definitions(-DWITH_SDL_IMAGE_DIALOGS) endif() add_subdirectory(res) -add_library(sdl2-dialogs STATIC - ${SRCS} -) +add_library(sdl2-dialogs STATIC ${SRCS}) target_link_libraries(sdl2-dialogs PRIVATE ${LIBS}) if(BUILD_TESTING_INTERNAL OR BUILD_TESTING) -# add_subdirectory(test) + # add_subdirectory(test) endif() diff --git a/client/SDL/SDL2/dialogs/res/CMakeLists.txt b/client/SDL/SDL2/dialogs/res/CMakeLists.txt index b22da6218..3edf40889 100644 --- a/client/SDL/SDL2/dialogs/res/CMakeLists.txt +++ b/client/SDL/SDL2/dialogs/res/CMakeLists.txt @@ -16,19 +16,14 @@ # See the License for the specific language governing permissions and # limitations under the License. -set(SRCS - sdl2_resource_manager.cpp - sdl2_resource_manager.hpp -) +set(SRCS sdl2_resource_manager.cpp sdl2_resource_manager.hpp) -add_library(sdl2_client_res STATIC - ${SRCS} -) +add_library(sdl2_client_res STATIC ${SRCS}) -if (NOT WITH_SDL_LINK_SHARED) - target_link_libraries(sdl2_client_res ${SDL2_STATIC_LIBRARIES}) +if(NOT WITH_SDL_LINK_SHARED) + target_link_libraries(sdl2_client_res ${SDL2_STATIC_LIBRARIES}) else() - target_link_libraries(sdl2_client_res ${SDL2_LIBRARIES}) + target_link_libraries(sdl2_client_res ${SDL2_LIBRARIES}) endif() set_property(TARGET sdl2_client_res PROPERTY POSITION_INDEPENDENT_CODE ON) diff --git a/client/SDL/SDL2/dialogs/test/CMakeLists.txt b/client/SDL/SDL2/dialogs/test/CMakeLists.txt index 505907528..a6a94645e 100644 --- a/client/SDL/SDL2/dialogs/test/CMakeLists.txt +++ b/client/SDL/SDL2/dialogs/test/CMakeLists.txt @@ -5,28 +5,21 @@ set(DRIVER ${MODULE_NAME}.cpp) disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR}) -set(TEST_SRCS - TestSDLDialogs.cpp -) +set(TEST_SRCS TestSDLDialogs.cpp) -create_test_sourcelist(SRCS - ${DRIVER} - ${TEST_SRCS}) +create_test_sourcelist(SRCS ${DRIVER} ${TEST_SRCS}) add_library(${MODULE_NAME} ${SRCS}) -list(APPEND LIBS - dialogs -) +list(APPEND LIBS dialogs) target_link_libraries(${MODULE_NAME} ${LIBS}) set_target_properties(${MODULE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TESTING_OUTPUT_DIRECTORY}") foreach(test ${TESTS}) - get_filename_component(TestName ${test} NAME_WE) - add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) + get_filename_component(TestName ${test} NAME_WE) + add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) endforeach() set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "FreeRDP/Client/Test") - diff --git a/client/SDL/SDL2/man/CMakeLists.txt b/client/SDL/SDL2/man/CMakeLists.txt index 41868282f..0c1cd7d3c 100644 --- a/client/SDL/SDL2/man/CMakeLists.txt +++ b/client/SDL/SDL2/man/CMakeLists.txt @@ -1,16 +1,8 @@ set(DEPS - ../../../common/man/freerdp-global-options.1 - ../../common/man/sdl-freerdp-config.1 - ../../../common/man/freerdp-global-envvar.1 - ../../../common/man/freerdp-global-config.1 - ../../common/man/sdl-freerdp-examples.1 - ../../../common/man/freerdp-global-links.1 + ../../../common/man/freerdp-global-options.1 ../../common/man/sdl-freerdp-config.1 + ../../../common/man/freerdp-global-envvar.1 ../../../common/man/freerdp-global-config.1 + ../../common/man/sdl-freerdp-examples.1 ../../../common/man/freerdp-global-links.1 ) -set(VAR_NAMES - "VENDOR" - "PRODUCT" - "VENDOR_PRODUCT" - "CMAKE_INSTALL_FULL_SYSCONFDIR" -) +set(VAR_NAMES "VENDOR" "PRODUCT" "VENDOR_PRODUCT" "CMAKE_INSTALL_FULL_SYSCONFDIR") generate_and_install_freerdp_man_from_xml(${MODULE_NAME} "1" "${DEPS}" "${VAR_NAMES}") diff --git a/client/SDL/SDL3/CMakeLists.txt b/client/SDL/SDL3/CMakeLists.txt index 931d4ceb3..bae32f1df 100644 --- a/client/SDL/SDL3/CMakeLists.txt +++ b/client/SDL/SDL3/CMakeLists.txt @@ -43,37 +43,36 @@ set(SRCS sdl_channels.cpp sdl_window.hpp sdl_window.cpp - sdl_clip.hpp - sdl_clip.cpp + sdl_clip.hpp + sdl_clip.cpp ) -list(APPEND LIBS - winpr - freerdp - freerdp-client - Threads::Threads - sdl3_client_res - sdl3-dialogs - sdl-common-aad-view - sdl-common-prefs - ) +list( + APPEND + LIBS + winpr + freerdp + freerdp-client + Threads::Threads + sdl3_client_res + sdl3-dialogs + sdl-common-aad-view + sdl-common-prefs +) -if (NOT WITH_SDL_LINK_SHARED) - list(APPEND LIBS ${SDL3_STATIC_LIBRARIES}) +if(NOT WITH_SDL_LINK_SHARED) + list(APPEND LIBS ${SDL3_STATIC_LIBRARIES}) else() - list(APPEND LIBS ${SDL3_LIBRARIES}) + list(APPEND LIBS ${SDL3_LIBRARIES}) endif() -AddTargetWithResourceFile(${MODULE_NAME} "${WIN32_GUI_FLAG}" "${PROJECT_VERSION}" SRCS) +addtargetwithresourcefile(${MODULE_NAME} "${WIN32_GUI_FLAG}" "${PROJECT_VERSION}" SRCS) target_link_libraries(${MODULE_NAME} PRIVATE ${LIBS}) set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Client/SDL") -if (NOT WITH_CLIENT_SDL_VERSIONED) - set_target_properties(${MODULE_NAME} - PROPERTIES - OUTPUT_NAME ${PROJECT_NAME} - ) +if(NOT WITH_CLIENT_SDL_VERSIONED) + set_target_properties(${MODULE_NAME} PROPERTIES OUTPUT_NAME ${PROJECT_NAME}) endif() install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT client) install_freerdp_desktop("${MODULE_NAME}" "${MODULE_NAME}") diff --git a/client/SDL/SDL3/dialogs/CMakeLists.txt b/client/SDL/SDL3/dialogs/CMakeLists.txt index f221612e0..d49af715e 100644 --- a/client/SDL/SDL3/dialogs/CMakeLists.txt +++ b/client/SDL/SDL3/dialogs/CMakeLists.txt @@ -36,42 +36,37 @@ set(SRCS sdl_connection_dialog.hpp ) -list(APPEND LIBS - sdl3_client_res - winpr -) +list(APPEND LIBS sdl3_client_res winpr) -if (NOT WITH_SDL_LINK_SHARED) - list(APPEND LIBS ${SDL3_STATIC_LIBRARIES}) +if(NOT WITH_SDL_LINK_SHARED) + list(APPEND LIBS ${SDL3_STATIC_LIBRARIES}) else() - list(APPEND LIBS ${SDL3_LIBRARIES}) + list(APPEND LIBS ${SDL3_LIBRARIES}) endif() macro(find_sdl_component name) - find_package(${name} REQUIRED) - if (WITH_SDL_LINK_SHARED) - list(APPEND LIBS ${name}::${name}) - else() - list(APPEND LIBS ${name}::${name}-static) - endif() + find_package(${name} REQUIRED) + if(WITH_SDL_LINK_SHARED) + list(APPEND LIBS ${name}::${name}) + else() + list(APPEND LIBS ${name}::${name}-static) + endif() endmacro() find_sdl_component(SDL3_ttf) option(WITH_SDL_IMAGE_DIALOGS "Build with SDL_image support (recommended)" OFF) -if (WITH_SDL_IMAGE_DIALOGS) - find_sdl_component(SDL3_image) - add_definitions(-DWITH_SDL_IMAGE_DIALOGS) +if(WITH_SDL_IMAGE_DIALOGS) + find_sdl_component(SDL3_image) + add_definitions(-DWITH_SDL_IMAGE_DIALOGS) endif() add_subdirectory(res) -add_library(sdl3-dialogs STATIC - ${SRCS} -) +add_library(sdl3-dialogs STATIC ${SRCS}) target_link_libraries(sdl3-dialogs PRIVATE ${LIBS}) if(BUILD_TESTING) -# add_subdirectory(test) + # add_subdirectory(test) endif() diff --git a/client/SDL/SDL3/dialogs/res/CMakeLists.txt b/client/SDL/SDL3/dialogs/res/CMakeLists.txt index 8ff2c5196..7d542dd59 100644 --- a/client/SDL/SDL3/dialogs/res/CMakeLists.txt +++ b/client/SDL/SDL3/dialogs/res/CMakeLists.txt @@ -15,18 +15,13 @@ # 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. -set(SRCS - sdl3_resource_manager.cpp - sdl3_resource_manager.hpp -) +set(SRCS sdl3_resource_manager.cpp sdl3_resource_manager.hpp) -add_library(sdl3_client_res STATIC - ${SRCS} -) -if (NOT WITH_SDL_LINK_SHARED) - target_link_libraries(sdl3_client_res ${SDL3_STATIC_LIBRARIES}) +add_library(sdl3_client_res STATIC ${SRCS}) +if(NOT WITH_SDL_LINK_SHARED) + target_link_libraries(sdl3_client_res ${SDL3_STATIC_LIBRARIES}) else() - target_link_libraries(sdl3_client_res ${SDL3_LIBRARIES}) + target_link_libraries(sdl3_client_res ${SDL3_LIBRARIES}) endif() target_link_libraries(sdl3_client_res sdl-common-client-res) diff --git a/client/SDL/SDL3/dialogs/test/CMakeLists.txt b/client/SDL/SDL3/dialogs/test/CMakeLists.txt index 04e429c77..a6a94645e 100644 --- a/client/SDL/SDL3/dialogs/test/CMakeLists.txt +++ b/client/SDL/SDL3/dialogs/test/CMakeLists.txt @@ -3,31 +3,23 @@ set(MODULE_PREFIX "TEST_SDL") set(DRIVER ${MODULE_NAME}.cpp) - disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR}) -set(TEST_SRCS - TestSDLDialogs.cpp -) +set(TEST_SRCS TestSDLDialogs.cpp) -create_test_sourcelist(SRCS - ${DRIVER} - ${TEST_SRCS}) +create_test_sourcelist(SRCS ${DRIVER} ${TEST_SRCS}) add_library(${MODULE_NAME} ${SRCS}) -list(APPEND LIBS - dialogs -) +list(APPEND LIBS dialogs) target_link_libraries(${MODULE_NAME} ${LIBS}) set_target_properties(${MODULE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TESTING_OUTPUT_DIRECTORY}") foreach(test ${TESTS}) - get_filename_component(TestName ${test} NAME_WE) - add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) + get_filename_component(TestName ${test} NAME_WE) + add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) endforeach() set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "FreeRDP/Client/Test") - diff --git a/client/SDL/SDL3/man/CMakeLists.txt b/client/SDL/SDL3/man/CMakeLists.txt index ec95c97dd..0c1cd7d3c 100644 --- a/client/SDL/SDL3/man/CMakeLists.txt +++ b/client/SDL/SDL3/man/CMakeLists.txt @@ -1,16 +1,8 @@ set(DEPS - ../../../common/man/freerdp-global-options.1 - ../../common/man/sdl-freerdp-config.1 - ../../../common/man/freerdp-global-envvar.1 - ../../../common/man/freerdp-global-config.1 - ../../common/man/sdl-freerdp-examples.1 - ../../../common/man/freerdp-global-links.1 + ../../../common/man/freerdp-global-options.1 ../../common/man/sdl-freerdp-config.1 + ../../../common/man/freerdp-global-envvar.1 ../../../common/man/freerdp-global-config.1 + ../../common/man/sdl-freerdp-examples.1 ../../../common/man/freerdp-global-links.1 ) -set(VAR_NAMES - "VENDOR" - "PRODUCT" - "VENDOR_PRODUCT" - "CMAKE_INSTALL_FULL_SYSCONFDIR" -) +set(VAR_NAMES "VENDOR" "PRODUCT" "VENDOR_PRODUCT" "CMAKE_INSTALL_FULL_SYSCONFDIR") generate_and_install_freerdp_man_from_xml(${MODULE_NAME} "1" "${DEPS}" "${VAR_NAMES}") diff --git a/client/SDL/common/CMakeLists.txt b/client/SDL/common/CMakeLists.txt index 81d3c0e6c..fb3e3ed89 100644 --- a/client/SDL/common/CMakeLists.txt +++ b/client/SDL/common/CMakeLists.txt @@ -19,13 +19,9 @@ add_subdirectory(aad) add_subdirectory(res) -add_library(sdl-common-prefs STATIC - sdl_prefs.hpp - sdl_prefs.cpp - scoped_guard.hpp -) +add_library(sdl-common-prefs STATIC sdl_prefs.hpp sdl_prefs.cpp scoped_guard.hpp) target_link_libraries(sdl-common-prefs winpr freerdp) if(BUILD_TESTING_INTERNAL OR BUILD_TESTING) - add_subdirectory(test) + add_subdirectory(test) endif() diff --git a/client/SDL/common/aad/CMakeLists.txt b/client/SDL/common/aad/CMakeLists.txt index bec4355e4..85d9dbcf6 100644 --- a/client/SDL/common/aad/CMakeLists.txt +++ b/client/SDL/common/aad/CMakeLists.txt @@ -18,75 +18,46 @@ set(WITH_WEBVIEW_DEFAULT OFF) option(WITH_WEBVIEW "Build with WebView support for AAD login popup browser" ${WITH_WEBVIEW_DEFAULT}) -if (WITH_WEBVIEW) +if(WITH_WEBVIEW) option(WITH_WEBVIEW_QT "Build with QtWebEngine support for AAD login broweser popup" OFF) - set(SRCS - sdl_webview.hpp - webview_impl.hpp - sdl_webview.cpp - ) - set(LIBS - winpr - ) + set(SRCS sdl_webview.hpp webview_impl.hpp sdl_webview.cpp) + set(LIBS winpr) - if (WITH_WEBVIEW_QT) + if(WITH_WEBVIEW_QT) find_package(Qt5 COMPONENTS WebEngineWidgets REQUIRED) - list(APPEND SRCS - qt/webview_impl.cpp - ) + list(APPEND SRCS qt/webview_impl.cpp) - list(APPEND LIBS - Qt5::WebEngineWidgets - ) + list(APPEND LIBS Qt5::WebEngineWidgets) else() - list(APPEND SRCS - wrapper/webview.h - wrapper/webview_impl.cpp - ) + list(APPEND SRCS wrapper/webview.h wrapper/webview_impl.cpp) if(APPLE) find_library(WEBKIT Webkit REQUIRED) - list(APPEND LIBS - ${WEBKIT} - ) + list(APPEND LIBS ${WEBKIT}) elseif(NOT WIN32) find_package(PkgConfig REQUIRED) pkg_check_modules(WEBVIEW_GTK webkit2gtk-4.1) - if (NOT WEBVIEW_GTK_FOUND) + if(NOT WEBVIEW_GTK_FOUND) pkg_check_modules(WEBVIEW_GTK webkit2gtk-4.0 REQUIRED) endif() include_directories(SYSTEM ${WEBVIEW_GTK_INCLUDE_DIRS}) - list(APPEND LIBS - ${WEBVIEW_GTK_LIBRARIES} - ) + list(APPEND LIBS ${WEBVIEW_GTK_LIBRARIES}) endif() endif() else() - set(SRCS - dummy.cpp - ) + set(SRCS dummy.cpp) endif() cleaning_configure_file(sdl_config.hpp.in sdl_config.hpp @ONLY) include_directories(${CMAKE_CURRENT_BINARY_DIR}) -add_library(sdl-common-aad-view STATIC - ${SRCS} -) +add_library(sdl-common-aad-view STATIC ${SRCS}) target_include_directories(sdl-common-aad-view PUBLIC ${CMAKE_CURRENT_BINARY_DIR}) -target_link_libraries(sdl-common-aad-view - PRIVATE - ${LIBS} -) -target_compile_definitions( - sdl-common-aad-view - PUBLIC - ${DEFINITIONS} -) -if (WITH_WEBVIEW AND NOT WITH_WEBVIEW_QT) - include (WebView2) - target_link_webview2("sdl-common-aad-view") +target_link_libraries(sdl-common-aad-view PRIVATE ${LIBS}) +target_compile_definitions(sdl-common-aad-view PUBLIC ${DEFINITIONS}) +if(WITH_WEBVIEW AND NOT WITH_WEBVIEW_QT) + include(WebView2) + target_link_webview2("sdl-common-aad-view") endif() - diff --git a/client/SDL/common/res/CMakeLists.txt b/client/SDL/common/res/CMakeLists.txt index cf5ad4cf1..ff8ec997c 100644 --- a/client/SDL/common/res/CMakeLists.txt +++ b/client/SDL/common/res/CMakeLists.txt @@ -22,120 +22,86 @@ set(FACTORY_CLASSES "") include(ConvertFileToHexArray) macro(convert_to_bin FILE FILE_TYPE) - get_filename_component(FILE_NAME ${FILE} NAME) - string(REGEX REPLACE "[^a-zA-Z0-9]" "_" TARGET_NAME ${FILE_NAME}) + get_filename_component(FILE_NAME ${FILE} NAME) + string(REGEX REPLACE "[^a-zA-Z0-9]" "_" TARGET_NAME ${FILE_NAME}) - set(FILE_BIN_DIR ${CMAKE_CURRENT_BINARY_DIR}/bin) + set(FILE_BIN_DIR ${CMAKE_CURRENT_BINARY_DIR}/bin) - set(FILENAME ${FILE_NAME}) - set(CLASSNAME ${TARGET_NAME}) - set(CLASSTYPE ${FILE_TYPE}) + set(FILENAME ${FILE_NAME}) + set(CLASSNAME ${TARGET_NAME}) + set(CLASSTYPE ${FILE_TYPE}) - file_to_hex_array("${FILE}" FILEDATA) + file_to_hex_array("${FILE}" FILEDATA) - cleaning_configure_file(resource.hpp.in - ${FILE_BIN_DIR}/${TARGET_NAME}.hpp - @ONLY - ) + cleaning_configure_file(resource.hpp.in ${FILE_BIN_DIR}/${TARGET_NAME}.hpp @ONLY) - cleaning_configure_file(resource.cpp.in - ${FILE_BIN_DIR}/${TARGET_NAME}.cpp - @ONLY - ) + cleaning_configure_file(resource.cpp.in ${FILE_BIN_DIR}/${TARGET_NAME}.cpp @ONLY) - list(APPEND FACTORY_HDR - ${FILE_BIN_DIR}/${TARGET_NAME}.hpp - ) - list(APPEND FACTORY_SRCS - ${FILE_BIN_DIR}/${TARGET_NAME}.cpp - ) + list(APPEND FACTORY_HDR ${FILE_BIN_DIR}/${TARGET_NAME}.hpp) + list(APPEND FACTORY_SRCS ${FILE_BIN_DIR}/${TARGET_NAME}.cpp) - list(APPEND FACTORY_CLASSES - ${TARGET_NAME} - ) + list(APPEND FACTORY_CLASSES ${TARGET_NAME}) endmacro() -set(SRCS - sdl_resource_manager.cpp - sdl_resource_manager.hpp +set(SRCS sdl_resource_manager.cpp sdl_resource_manager.hpp) + +set(RES_SVG_FILES ${CMAKE_SOURCE_DIR}/resources/FreeRDP_Icon.svg ${CMAKE_SOURCE_DIR}/resources/icon_info.svg + ${CMAKE_SOURCE_DIR}/resources/icon_warning.svg ${CMAKE_SOURCE_DIR}/resources/icon_error.svg ) -set(RES_SVG_FILES - ${CMAKE_SOURCE_DIR}/resources/FreeRDP_Icon.svg - ${CMAKE_SOURCE_DIR}/resources/icon_info.svg - ${CMAKE_SOURCE_DIR}/resources/icon_warning.svg - ${CMAKE_SOURCE_DIR}/resources/icon_error.svg -) - -set(RES_FONT_FILES - ${CMAKE_SOURCE_DIR}/resources/font/OpenSans-VariableFont_wdth,wght.ttf -) +set(RES_FONT_FILES ${CMAKE_SOURCE_DIR}/resources/font/OpenSans-VariableFont_wdth,wght.ttf) option(SDL_USE_COMPILED_RESOURCES "Compile in images/fonts" ON) -if (SDL_USE_COMPILED_RESOURCES) - list(APPEND SRCS - sdl_resource_file.cpp - sdl_resource_file.hpp - ) +if(SDL_USE_COMPILED_RESOURCES) + list(APPEND SRCS sdl_resource_file.cpp sdl_resource_file.hpp) - include_directories(${CMAKE_CURRENT_SOURCE_DIR}) + include_directories(${CMAKE_CURRENT_SOURCE_DIR}) - if (WITH_SDL_IMAGE_DIALOGS) - foreach(FILE ${RES_SVG_FILES}) - convert_to_bin("${FILE}" "images") - endforeach() - endif() - - foreach(FILE ${RES_FONT_FILES}) - convert_to_bin("${FILE}" "fonts") + if(WITH_SDL_IMAGE_DIALOGS) + foreach(FILE ${RES_SVG_FILES}) + convert_to_bin("${FILE}" "images") endforeach() - add_definitions(-DSDL_USE_COMPILED_RESOURCES) + endif() - set(FINIT ${CMAKE_CURRENT_BINARY_DIR}/resource-init.cpp) - list(APPEND FACTORY_SRCS ${FINIT}) + foreach(FILE ${RES_FONT_FILES}) + convert_to_bin("${FILE}" "fonts") + endforeach() + add_definitions(-DSDL_USE_COMPILED_RESOURCES) - write_file(${FINIT} "#include ") - foreach(HDR ${FACTORY_HDR}) - write_file(${FINIT} "#include <${HDR}>" APPEND) - endforeach() + set(FINIT ${CMAKE_CURRENT_BINARY_DIR}/resource-init.cpp) + list(APPEND FACTORY_SRCS ${FINIT}) - write_file(${FINIT} "void SDLResourceManager::init() {" APPEND) - foreach(CLASS ${FACTORY_CLASSES}) - write_file(${FINIT} "\t${CLASS}::init();" APPEND) - endforeach() - write_file(${FINIT} "}" APPEND) + write_file(${FINIT} "#include ") + foreach(HDR ${FACTORY_HDR}) + write_file(${FINIT} "#include <${HDR}>" APPEND) + endforeach() + + write_file(${FINIT} "void SDLResourceManager::init() {" APPEND) + foreach(CLASS ${FACTORY_CLASSES}) + write_file(${FINIT} "\t${CLASS}::init();" APPEND) + endforeach() + write_file(${FINIT} "}" APPEND) else() - option(SDL_USE_VENDOR_PRODUCT_CONFIG_DIR "Use / path for resources" OFF) - set(SDL_RESOURCE_ROOT ${CMAKE_INSTALL_FULL_DATAROOTDIR}) - if (SDL_USE_VENDOR_PRODUCT_CONFIG_DIR) - string(APPEND SDL_RESOURCE_ROOT "/${VENDOR}") - endif() - string(APPEND SDL_RESOURCE_ROOT "/${PRODUCT}") + option(SDL_USE_VENDOR_PRODUCT_CONFIG_DIR "Use / path for resources" OFF) + set(SDL_RESOURCE_ROOT ${CMAKE_INSTALL_FULL_DATAROOTDIR}) + if(SDL_USE_VENDOR_PRODUCT_CONFIG_DIR) + string(APPEND SDL_RESOURCE_ROOT "/${VENDOR}") + endif() + string(APPEND SDL_RESOURCE_ROOT "/${PRODUCT}") - if (WITH_BINARY_VERSIONING) - string(APPEND SDL_RESOURCE_ROOT "${FREERDP_VERSION_MAJOR}") - endif() + if(WITH_BINARY_VERSIONING) + string(APPEND SDL_RESOURCE_ROOT "${FREERDP_VERSION_MAJOR}") + endif() - add_definitions(-DSDL_RESOURCE_ROOT="${SDL_RESOURCE_ROOT}") + add_definitions(-DSDL_RESOURCE_ROOT="${SDL_RESOURCE_ROOT}") - if (WITH_SDL_IMAGE_DIALOGS) - install( - FILES ${RES_SVG_FILES} - DESTINATION ${SDL_RESOURCE_ROOT}/images - ) - endif() + if(WITH_SDL_IMAGE_DIALOGS) + install(FILES ${RES_SVG_FILES} DESTINATION ${SDL_RESOURCE_ROOT}/images) + endif() - install( - FILES ${RES_FONT_FILES} - DESTINATION ${SDL_RESOURCE_ROOT}/fonts - ) + install(FILES ${RES_FONT_FILES} DESTINATION ${SDL_RESOURCE_ROOT}/fonts) endif() -add_library(sdl-common-client-res STATIC - ${RES_FILES} - ${SRCS} - ${FACTORY_HDR} - ${FACTORY_SRCS} -) +add_library(sdl-common-client-res STATIC ${RES_FILES} ${SRCS} ${FACTORY_HDR} ${FACTORY_SRCS}) set_property(TARGET sdl-common-client-res PROPERTY POSITION_INDEPENDENT_CODE ON) diff --git a/client/SDL/common/test/CMakeLists.txt b/client/SDL/common/test/CMakeLists.txt index b555d3eba..1c1b3bf1e 100644 --- a/client/SDL/common/test/CMakeLists.txt +++ b/client/SDL/common/test/CMakeLists.txt @@ -5,12 +5,9 @@ set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.cpp) set(${MODULE_PREFIX}_TESTS TestSDLPrefs.cpp) - disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR}) -create_test_sourcelist(${MODULE_PREFIX}_SRCS - ${${MODULE_PREFIX}_DRIVER} - ${${MODULE_PREFIX}_TESTS}) +create_test_sourcelist(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_DRIVER} ${${MODULE_PREFIX}_TESTS}) add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) @@ -23,17 +20,17 @@ set_target_properties(${MODULE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TEST set(TEST_SRC_AREA "${CMAKE_CURRENT_SOURCE_DIR}") set(TEST_BIN_AREA "${CMAKE_CURRENT_BINARY_DIR}") -if (WIN32) - string(REPLACE "\\" "\\\\" TEST_SRC_AREA "${TEST_SRC_AREA}") - string(REPLACE "\\" "\\\\" TEST_BIN_AREA "${TEST_BIN_AREA}") +if(WIN32) + string(REPLACE "\\" "\\\\" TEST_SRC_AREA "${TEST_SRC_AREA}") + string(REPLACE "\\" "\\\\" TEST_BIN_AREA "${TEST_BIN_AREA}") endif() add_compile_definitions(TEST_SRC_AREA="${TEST_SRC_AREA}") add_compile_definitions(TEST_BIN_AREA="${TEST_BIN_AREA}") foreach(test ${${MODULE_PREFIX}_TESTS}) - get_filename_component(TestName ${test} NAME_WE) - add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) + get_filename_component(TestName ${test} NAME_WE) + add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) endforeach() set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "FreeRDP/Client/Test") diff --git a/client/Sample/CMakeLists.txt b/client/Sample/CMakeLists.txt index 13c1ea344..4783ca6b9 100644 --- a/client/Sample/CMakeLists.txt +++ b/client/Sample/CMakeLists.txt @@ -17,16 +17,13 @@ cmake_minimum_required(VERSION 3.13) if(POLICY CMP0091) - cmake_policy(SET CMP0091 NEW) + cmake_policy(SET CMP0091 NEW) endif() -if (NOT FREERDP_DEFAULT_PROJECT_VERSION) - set(FREERDP_DEFAULT_PROJECT_VERSION "1.0.0.0") +if(NOT FREERDP_DEFAULT_PROJECT_VERSION) + set(FREERDP_DEFAULT_PROJECT_VERSION "1.0.0.0") endif() -project(sfreerdp - LANGUAGES C - VERSION ${FREERDP_DEFAULT_PROJECT_VERSION} -) +project(sfreerdp LANGUAGES C VERSION ${FREERDP_DEFAULT_PROJECT_VERSION}) message("project ${PROJECT_NAME} is using version ${PROJECT_VERSION}") @@ -39,19 +36,11 @@ include(CommonConfigOptions) include(ConfigureFreeRDP) -set(SRCS - tf_channels.c - tf_channels.h - tf_freerdp.h - tf_freerdp.c) +set(SRCS tf_channels.c tf_channels.h tf_freerdp.h tf_freerdp.c) -AddTargetWithResourceFile(${PROJECT_NAME} TRUE "${PROJECT_VERSION}" SRCS) +addtargetwithresourcefile(${PROJECT_NAME} TRUE "${PROJECT_VERSION}" SRCS) -set(LIBS - freerdp-client - freerdp - winpr -) +set(LIBS freerdp-client freerdp winpr) target_link_libraries(${PROJECT_NAME} PRIVATE ${LIBS}) set_property(TARGET ${PROJECT_NAME} PROPERTY FOLDER "Client/Sample") diff --git a/client/Sample/ModuleOptions.cmake b/client/Sample/ModuleOptions.cmake index d4d5a9e44..1594cfed9 100644 --- a/client/Sample/ModuleOptions.cmake +++ b/client/Sample/ModuleOptions.cmake @@ -1,4 +1,3 @@ - set(FREERDP_CLIENT_NAME "sfreerdp") set(FREERDP_CLIENT_PLATFORM "Sample") set(FREERDP_CLIENT_VENDOR "FreeRDP") diff --git a/client/Wayland/CMakeLists.txt b/client/Wayland/CMakeLists.txt index 378882378..5a237a599 100644 --- a/client/Wayland/CMakeLists.txt +++ b/client/Wayland/CMakeLists.txt @@ -23,30 +23,30 @@ include_directories(SYSTEM ${WAYLAND_INCLUDE_DIR}) set(${MODULE_PREFIX}_SRCS wlfreerdp.c - wlfreerdp.h - wlf_disp.c - wlf_disp.h - wlf_pointer.c - wlf_pointer.h - wlf_input.c - wlf_input.h - wlf_cliprdr.c - wlf_cliprdr.h - wlf_channels.c - wlf_channels.h - ) + wlfreerdp.h + wlf_disp.c + wlf_disp.h + wlf_pointer.c + wlf_pointer.h + wlf_input.c + wlf_input.h + wlf_cliprdr.c + wlf_cliprdr.h + wlf_channels.c + wlf_channels.h +) -if (FREERDP_UNIFIED_BUILD) - include_directories(${PROJECT_SOURCE_DIR}/uwac/include) - include_directories(${PROJECT_BINARY_DIR}/uwac/include) +if(FREERDP_UNIFIED_BUILD) + include_directories(${PROJECT_SOURCE_DIR}/uwac/include) + include_directories(${PROJECT_BINARY_DIR}/uwac/include) else() - find_package(uwac 0 REQUIRED) - include_directories(SYSTEM ${UWAC_INCLUDE_DIR}) + find_package(uwac 0 REQUIRED) + include_directories(SYSTEM ${UWAC_INCLUDE_DIR}) endif() -list (APPEND ${MODULE_PREFIX}_LIBS freerdp-client freerdp uwac) +list(APPEND ${MODULE_PREFIX}_LIBS freerdp-client freerdp uwac) -AddTargetWithResourceFile(${MODULE_NAME} TRUE ${FREERDP_VERSION} ${MODULE_PREFIX}_SRCS) +addtargetwithresourcefile(${MODULE_NAME} TRUE ${FREERDP_VERSION} ${MODULE_PREFIX}_SRCS) target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS}) diff --git a/client/Windows/CMakeLists.txt b/client/Windows/CMakeLists.txt index 72d3ca62b..f5c3a05fd 100644 --- a/client/Windows/CMakeLists.txt +++ b/client/Windows/CMakeLists.txt @@ -19,28 +19,31 @@ set(MODULE_NAME "wfreerdp-client") set(MODULE_PREFIX "FREERDP_CLIENT_WINDOWS_CONTROL") set(${MODULE_PREFIX}_SRCS - wf_gdi.c - wf_gdi.h - wf_event.c - wf_event.h - wf_channels.c - wf_channels.h - wf_graphics.c - wf_graphics.h - wf_cliprdr.c - wf_cliprdr.h - wf_rail.c - wf_rail.h - wf_client.c - wf_client.h - wf_floatbar.c - wf_floatbar.h - wf_defaults.h - wf_defaults.c - resource/wfreerdp.rc - resource/resource.h) + wf_gdi.c + wf_gdi.h + wf_event.c + wf_event.h + wf_channels.c + wf_channels.h + wf_graphics.c + wf_graphics.h + wf_cliprdr.c + wf_cliprdr.h + wf_rail.c + wf_rail.h + wf_client.c + wf_client.h + wf_floatbar.c + wf_floatbar.h + wf_defaults.h + wf_defaults.c + resource/wfreerdp.rc + resource/resource.h +) -option(WITH_WINDOWS_CERT_STORE "Build ${MODULE_NAME} with additional certificate validation against windows certificate store" ON) +option(WITH_WINDOWS_CERT_STORE + "Build ${MODULE_NAME} with additional certificate validation against windows certificate store" ON +) if(WITH_WINDOWS_CERT_STORE) add_definitions("-DWITH_WINDOWS_CERT_STORE") endif() @@ -59,9 +62,9 @@ if(WITH_PROGRESS_BAR) endif() if(CLIENT_INTERFACE_SHARED) - AddTargetWithResourceFile(${MODULE_NAME} "SHARED" "${FREERDP_VERSION}" ${MODULE_PREFIX}_SRCS) + addtargetwithresourcefile(${MODULE_NAME} "SHARED" "${FREERDP_VERSION}" ${MODULE_PREFIX}_SRCS) else() - AddTargetWithResourceFile(${MODULE_NAME} FALSE "${FREERDP_VERSION}" ${MODULE_PREFIX}_SRCS) + addtargetwithresourcefile(${MODULE_NAME} FALSE "${FREERDP_VERSION}" ${MODULE_PREFIX}_SRCS) endif() target_include_directories(${MODULE_NAME} INTERFACE $) @@ -70,14 +73,14 @@ list(APPEND PUB_LIBS winpr freerdp) list(APPEND PRIV_LIBS msimg32.lib credui.lib) -if (MINGW) - list(APPEND PRIV_LIBS ntdll.lib) # only required with MINGW +if(MINGW) + list(APPEND PRIV_LIBS ntdll.lib) # only required with MINGW endif() target_link_libraries(${MODULE_NAME} PUBLIC ${PUB_LIBS}) target_link_libraries(${MODULE_NAME} PRIVATE ${PRIV_LIBS}) if(WITH_CLIENT_INTERFACE) - install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries) + install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries) endif() add_subdirectory(cli) diff --git a/client/Windows/ModuleOptions.cmake b/client/Windows/ModuleOptions.cmake index a0fcaec59..ec9bf511b 100644 --- a/client/Windows/ModuleOptions.cmake +++ b/client/Windows/ModuleOptions.cmake @@ -1,4 +1,3 @@ - set(FREERDP_CLIENT_NAME "wfreerdp") set(FREERDP_CLIENT_PLATFORM "Windows") set(FREERDP_CLIENT_VENDOR "FreeRDP") diff --git a/client/Windows/cli/CMakeLists.txt b/client/Windows/cli/CMakeLists.txt index 5ea186b4e..536ca3a83 100644 --- a/client/Windows/cli/CMakeLists.txt +++ b/client/Windows/cli/CMakeLists.txt @@ -20,12 +20,9 @@ set(MODULE_PREFIX "FREERDP_CLIENT_WINDOWS") include_directories(..) -set(${MODULE_PREFIX}_SRCS - wfreerdp.c - wfreerdp.h - ../resource/wfreerdp.rc) +set(${MODULE_PREFIX}_SRCS wfreerdp.c wfreerdp.h ../resource/wfreerdp.rc) -AddTargetWithResourceFile(${MODULE_NAME} "${WIN32_GUI_FLAG}" "${FREERDP_VERSION}" ${MODULE_PREFIX}_SRCS) +addtargetwithresourcefile(${MODULE_NAME} "${WIN32_GUI_FLAG}" "${FREERDP_VERSION}" ${MODULE_PREFIX}_SRCS) set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} wfreerdp-client) diff --git a/client/X11/CMakeLists.txt b/client/X11/CMakeLists.txt index 36d0b9910..1da67d39e 100644 --- a/client/X11/CMakeLists.txt +++ b/client/X11/CMakeLists.txt @@ -17,14 +17,11 @@ # limitations under the License. cmake_minimum_required(VERSION 3.13) -if (NOT FREERDP_DEFAULT_PROJECT_VERSION) - set(FREERDP_DEFAULT_PROJECT_VERSION "1.0.0.0") +if(NOT FREERDP_DEFAULT_PROJECT_VERSION) + set(FREERDP_DEFAULT_PROJECT_VERSION "1.0.0.0") endif() -project(xfreerdp-client - LANGUAGES C - VERSION ${FREERDP_DEFAULT_PROJECT_VERSION} -) +project(xfreerdp-client LANGUAGES C VERSION ${FREERDP_DEFAULT_PROJECT_VERSION}) message("project ${PROJECT_NAME} is using version ${PROJECT_VERSION}") @@ -46,180 +43,152 @@ include_directories(SYSTEM ${X11_INCLUDE_DIRS}) include_directories(SYSTEM ${OPENSSL_INCLUDE_DIR}) set(SRCS - xf_utils.h - xf_utils.c - xf_gfx.c - xf_gfx.h - xf_rail.c - xf_rail.h - xf_input.c - xf_input.h - xf_event.c - xf_event.h - xf_floatbar.c - xf_floatbar.h - xf_input.c - xf_input.h - xf_channels.c - xf_channels.h - xf_cliprdr.c - xf_cliprdr.h - xf_monitor.c - xf_monitor.h - xf_disp.c - xf_disp.h - xf_graphics.c - xf_graphics.h - xf_keyboard.c - xf_keyboard.h - xf_video.c - xf_video.h - xf_window.c - xf_window.h - xf_client.c - xf_client.h) + xf_utils.h + xf_utils.c + xf_gfx.c + xf_gfx.h + xf_rail.c + xf_rail.h + xf_input.c + xf_input.h + xf_event.c + xf_event.h + xf_floatbar.c + xf_floatbar.h + xf_input.c + xf_input.h + xf_channels.c + xf_channels.h + xf_cliprdr.c + xf_cliprdr.h + xf_monitor.c + xf_monitor.h + xf_disp.c + xf_disp.h + xf_graphics.c + xf_graphics.h + xf_keyboard.c + xf_keyboard.h + xf_video.c + xf_video.h + xf_window.c + xf_window.h + xf_client.c + xf_client.h +) -if (CHANNEL_TSMF_CLIENT) - list(APPEND SRCS - xf_tsmf.c - xf_tsmf.h - ) +if(CHANNEL_TSMF_CLIENT) + list(APPEND SRCS xf_tsmf.c xf_tsmf.h) endif() if(CLIENT_INTERFACE_SHARED) - AddTargetWithResourceFile(${PROJECT_NAME} "SHARED" "${PROJECT_VERSION}" SRCS) + addtargetwithresourcefile(${PROJECT_NAME} "SHARED" "${PROJECT_VERSION}" SRCS) else() - AddTargetWithResourceFile(${PROJECT_NAME} "STATIC" "${PROJECT_VERSION}" SRCS) + addtargetwithresourcefile(${PROJECT_NAME} "STATIC" "${PROJECT_VERSION}" SRCS) endif() target_include_directories(${PROJECT_NAME} INTERFACE $) -set(PRIV_LIBS - ${X11_LIBRARIES} -) +set(PRIV_LIBS ${X11_LIBRARIES}) find_package(X11 REQUIRED) if(X11_XShm_FOUND) - add_definitions(-DWITH_XSHM) - include_directories(SYSTEM ${X11_XShm_INCLUDE_PATH}) - list(APPEND PRIV_LIBS - ${X11_Xext_LIB} - ) + add_definitions(-DWITH_XSHM) + include_directories(SYSTEM ${X11_XShm_INCLUDE_PATH}) + list(APPEND PRIV_LIBS ${X11_Xext_LIB}) endif() - option(WITH_XINERAMA "[X11] enable xinerama" ON) -if (WITH_XINERAMA) - find_package(X11 REQUIRED) - if(X11_Xinerama_FOUND) - add_definitions(-DWITH_XINERAMA) - include_directories(SYSTEM ${X11_Xinerama_INCLUDE_PATH}) - list(APPEND PRIV_LIBS - ${X11_Xinerama_LIB} - ) - endif() +if(WITH_XINERAMA) + find_package(X11 REQUIRED) + if(X11_Xinerama_FOUND) + add_definitions(-DWITH_XINERAMA) + include_directories(SYSTEM ${X11_Xinerama_INCLUDE_PATH}) + list(APPEND PRIV_LIBS ${X11_Xinerama_LIB}) + endif() endif() option(WITH_XEXT "[X11] enable Xext" ON) -if (WITH_XEXT) - find_package(X11 REQUIRED) - if(X11_Xext_FOUND) - add_definitions(-DWITH_XEXT) - list(APPEND PRIV_LIBS - ${X11_Xext_LIB} - ) - endif() +if(WITH_XEXT) + find_package(X11 REQUIRED) + if(X11_Xext_FOUND) + add_definitions(-DWITH_XEXT) + list(APPEND PRIV_LIBS ${X11_Xext_LIB}) + endif() endif() option(WITH_XCURSOR "[X11] enable Xcursor" ON) -if (WITH_XCURSOR) - find_package(X11 REQUIRED) - if(X11_Xcursor_FOUND) - add_definitions(-DWITH_XCURSOR) - include_directories(SYSTEM ${X11_Xcursor_INCLUDE_PATH}) - list(APPEND PRIV_LIBS - ${X11_Xcursor_LIB} - ) - endif() +if(WITH_XCURSOR) + find_package(X11 REQUIRED) + if(X11_Xcursor_FOUND) + add_definitions(-DWITH_XCURSOR) + include_directories(SYSTEM ${X11_Xcursor_INCLUDE_PATH}) + list(APPEND PRIV_LIBS ${X11_Xcursor_LIB}) + endif() endif() option(WITH_XV "[X11] enable Xv" ON) -if (WITH_XV) - find_package(X11 REQUIRED) - if(X11_Xv_FOUND) - add_definitions(-DWITH_XV) - include_directories(SYSTEM ${X11_Xv_INCLUDE_PATH}) - list(APPEND PRIV_LIBS - ${X11_Xv_LIB} - ) - endif() +if(WITH_XV) + find_package(X11 REQUIRED) + if(X11_Xv_FOUND) + add_definitions(-DWITH_XV) + include_directories(SYSTEM ${X11_Xv_INCLUDE_PATH}) + list(APPEND PRIV_LIBS ${X11_Xv_LIB}) + endif() endif() option(WITH_XI "[X11] enable Xi" ON) -if (WITH_XI) - find_package(X11 REQUIRED) - if(X11_Xi_FOUND) - add_definitions(-DWITH_XI) - include_directories(SYSTEM ${X11_Xi_INCLUDE_PATH}) - list(APPEND PRIV_LIBS - ${X11_Xi_LIB} - ) - endif() +if(WITH_XI) + find_package(X11 REQUIRED) + if(X11_Xi_FOUND) + add_definitions(-DWITH_XI) + include_directories(SYSTEM ${X11_Xi_INCLUDE_PATH}) + list(APPEND PRIV_LIBS ${X11_Xi_LIB}) + endif() endif() option(WITH_XRENDER "[X11] enable XRender" ON) if(WITH_XRENDER) - find_package(X11 REQUIRED) - if(X11_Xrender_FOUND) - add_definitions(-DWITH_XRENDER) - include_directories(SYSTEM ${X11_Xrender_INCLUDE_PATH}) - list(APPEND PRIV_LIBS - ${X11_Xrender_LIB} - ) - endif() + find_package(X11 REQUIRED) + if(X11_Xrender_FOUND) + add_definitions(-DWITH_XRENDER) + include_directories(SYSTEM ${X11_Xrender_INCLUDE_PATH}) + list(APPEND PRIV_LIBS ${X11_Xrender_LIB}) + endif() endif() option(WITH_XRANDR "[X11] enable XRandR" ON) -if (WITH_XRANDR) - find_package(X11 REQUIRED) - if(X11_Xrandr_FOUND) - add_definitions(-DWITH_XRANDR) - include_directories(SYSTEM ${X11_Xrandr_INCLUDE_PATH}) - list(APPEND PRIV_LIBS - ${X11_Xrandr_LIB} - ) - endif() +if(WITH_XRANDR) + find_package(X11 REQUIRED) + if(X11_Xrandr_FOUND) + add_definitions(-DWITH_XRANDR) + include_directories(SYSTEM ${X11_Xrandr_INCLUDE_PATH}) + list(APPEND PRIV_LIBS ${X11_Xrandr_LIB}) + endif() endif() option(WITH_XFIXES "[X11] enable Xfixes" ON) -if (WITH_XFIXES) - find_package(X11 REQUIRED) - if(X11_Xfixes_FOUND) - add_definitions(-DWITH_XFIXES) - include_directories(SYSTEM ${X11_Xfixes_INCLUDE_PATH}) - list(APPEND PRIV_LIBS - ${X11_Xfixes_LIB} - ) - endif() +if(WITH_XFIXES) + find_package(X11 REQUIRED) + if(X11_Xfixes_FOUND) + add_definitions(-DWITH_XFIXES) + include_directories(SYSTEM ${X11_Xfixes_INCLUDE_PATH}) + list(APPEND PRIV_LIBS ${X11_Xfixes_LIB}) + endif() endif() -list(APPEND PUB_LIBS - freerdp-client -) +list(APPEND PUB_LIBS freerdp-client) -list(APPEND PRIV_LIBS - m -) -if (NOT APPLE) - list(APPEND PRIV_LIBS rt) +list(APPEND PRIV_LIBS m) +if(NOT APPLE) + list(APPEND PRIV_LIBS rt) endif() target_link_libraries(${PROJECT_NAME} PUBLIC ${PUB_LIBS}) target_link_libraries(${PROJECT_NAME} PRIVATE ${PRIV_LIBS}) if(WITH_CLIENT_INTERFACE) - install(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries) + install(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries) endif() add_subdirectory(cli) add_subdirectory(man) set_property(TARGET ${PROJECT_NAME} PROPERTY FOLDER "Client/X11") - diff --git a/client/X11/ModuleOptions.cmake b/client/X11/ModuleOptions.cmake index 4fef68a2f..de108a40d 100644 --- a/client/X11/ModuleOptions.cmake +++ b/client/X11/ModuleOptions.cmake @@ -1,4 +1,3 @@ - set(FREERDP_CLIENT_NAME "xfreerdp") set(FREERDP_CLIENT_PLATFORM "X11") set(FREERDP_CLIENT_VENDOR "FreeRDP") diff --git a/client/X11/cli/CMakeLists.txt b/client/X11/cli/CMakeLists.txt index 6daf336e3..38e3eb8fe 100644 --- a/client/X11/cli/CMakeLists.txt +++ b/client/X11/cli/CMakeLists.txt @@ -15,16 +15,12 @@ # See the License for the specific language governing permissions and # limitations under the License. -set(SRCS - xfreerdp.c -) +set(SRCS xfreerdp.c) -AddTargetWithResourceFile(${MODULE_NAME} TRUE "${PROJECT_VERSION}" SRCS) +addtargetwithresourcefile(${MODULE_NAME} TRUE "${PROJECT_VERSION}" SRCS) set_target_properties(${MODULE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "..") -list(APPEND LIBS - xfreerdp-client -) +list(APPEND LIBS xfreerdp-client) target_link_libraries(${MODULE_NAME} PRIVATE ${LIBS}) @@ -32,4 +28,3 @@ install(TARGETS ${MODULE_NAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPO install_freerdp_desktop("${MODULE_NAME}") set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Client/X11") - diff --git a/client/X11/man/CMakeLists.txt b/client/X11/man/CMakeLists.txt index e3908b0aa..e56a56a29 100644 --- a/client/X11/man/CMakeLists.txt +++ b/client/X11/man/CMakeLists.txt @@ -1,18 +1,7 @@ -set(DEPS - ../../common/man/freerdp-global-options.1 - xfreerdp-shortcuts.1 - ../../common/man/freerdp-global-envvar.1 - ../../common/man/freerdp-global-config.1 - xfreerdp-examples.1 - ../../common/man/freerdp-global-links.1 +set(DEPS ../../common/man/freerdp-global-options.1 xfreerdp-shortcuts.1 ../../common/man/freerdp-global-envvar.1 + ../../common/man/freerdp-global-config.1 xfreerdp-examples.1 ../../common/man/freerdp-global-links.1 ) set(SDL_WIKI_BASE_URL "https://wiki.libsdl.org/SDL2") -set(VAR_NAMES - "VENDOR" - "PRODUCT" - "VENDOR_PRODUCT" - "CMAKE_INSTALL_FULL_SYSCONFDIR" - "SDL_WIKI_BASE_URL" -) +set(VAR_NAMES "VENDOR" "PRODUCT" "VENDOR_PRODUCT" "CMAKE_INSTALL_FULL_SYSCONFDIR" "SDL_WIKI_BASE_URL") generate_and_install_freerdp_man_from_xml(${MODULE_NAME} "1" "${DEPS}" "${VAR_NAMES}") diff --git a/client/common/CMakeLists.txt b/client/common/CMakeLists.txt index 35eed4e92..d96a0c2d0 100644 --- a/client/common/CMakeLists.txt +++ b/client/common/CMakeLists.txt @@ -26,48 +26,49 @@ if(POLICY CMP0022) endif() set(SRCS - client.c - cmdline.c - cmdline.h - file.c - client_cliprdr_file.c - geometry.c - smartcard_cli.c) + client.c + cmdline.c + cmdline.h + file.c + client_cliprdr_file.c + geometry.c + smartcard_cli.c +) foreach(FREERDP_CHANNELS_CLIENT_SRC ${FREERDP_CHANNELS_CLIENT_SRCS}) - get_filename_component(NINC ${FREERDP_CHANNELS_CLIENT_SRC} PATH) - include_directories(${NINC}) - list(APPEND SRCS "${FREERDP_CHANNELS_CLIENT_SRC}") + get_filename_component(NINC ${FREERDP_CHANNELS_CLIENT_SRC} PATH) + include_directories(${NINC}) + list(APPEND SRCS "${FREERDP_CHANNELS_CLIENT_SRC}") endforeach() -if (NOT APPLE AND NOT WIN32 AND NOT ANDROID) - set(OPT_FUSE_DEFAULT ON) +if(NOT APPLE AND NOT WIN32 AND NOT ANDROID) + set(OPT_FUSE_DEFAULT ON) else() - set(OPT_FUSE_DEFAULT OFF) + set(OPT_FUSE_DEFAULT OFF) endif() option(WITH_FUSE "Build clipboard with FUSE file copy support" ${OPT_FUSE_DEFAULT}) if(WITH_FUSE) - find_package(PkgConfig REQUIRED) + find_package(PkgConfig REQUIRED) - pkg_check_modules(FUSE3 REQUIRED fuse3) - include_directories(SYSTEM ${FUSE3_INCLUDE_DIRS}) - add_definitions(-DWITH_FUSE) - list(APPEND LIBS ${FUSE3_LIBRARIES}) + pkg_check_modules(FUSE3 REQUIRED fuse3) + include_directories(SYSTEM ${FUSE3_INCLUDE_DIRS}) + add_definitions(-DWITH_FUSE) + list(APPEND LIBS ${FUSE3_LIBRARIES}) - add_definitions(-D_FILE_OFFSET_BITS=64) + add_definitions(-D_FILE_OFFSET_BITS=64) endif() include_directories(SYSTEM ${OPENSSL_INCLUDE_DIR}) -AddTargetWithResourceFile(${MODULE_NAME} FALSE "${FREERDP_VERSION}" SRCS) +addtargetwithresourcefile(${MODULE_NAME} FALSE "${FREERDP_VERSION}" SRCS) list(APPEND LIBS freerdp winpr) include(CheckLibraryExists) -CHECK_LIBRARY_EXISTS(m lround "" HAVE_LIB_M) +check_library_exists(m lround "" HAVE_LIB_M) if(HAVE_LIB_M) - list(APPEND LIBS m) + list(APPEND LIBS m) endif() target_include_directories(${MODULE_NAME} INTERFACE $) @@ -75,16 +76,16 @@ target_link_libraries(${MODULE_NAME} PRIVATE ${FREERDP_CHANNELS_CLIENT_LIBS}) target_link_libraries(${MODULE_NAME} PUBLIC ${LIBS}) install(TARGETS ${MODULE_NAME} COMPONENT libraries EXPORT FreeRDP-ClientTargets - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +) set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Client/Common") if(BUILD_TESTING_INTERNAL OR BUILD_TESTING) - add_subdirectory(test) + add_subdirectory(test) endif() -if (WITH_MANPAGES) - add_subdirectory(man) +if(WITH_MANPAGES) + add_subdirectory(man) endif() diff --git a/client/common/man/CMakeLists.txt b/client/common/man/CMakeLists.txt index 798957c78..ca00e6c86 100644 --- a/client/common/man/CMakeLists.txt +++ b/client/common/man/CMakeLists.txt @@ -1,30 +1,21 @@ if(CMAKE_CROSSCOMPILING) - find_package(GenerateArgumentManpage) + find_package(GenerateArgumentManpage) else() - include_directories(${CMAKE_BINARY_DIR}/include/) + include_directories(${CMAKE_BINARY_DIR}/include/) - add_executable(generate_argument_manpage - generate_argument_manpage.c - ../cmdline.h - ) - export(TARGETS generate_argument_manpage FILE - "${CMAKE_BINARY_DIR}/GenerateArgumentManpageConfig.cmake") + add_executable(generate_argument_manpage generate_argument_manpage.c ../cmdline.h) + export(TARGETS generate_argument_manpage FILE "${CMAKE_BINARY_DIR}/GenerateArgumentManpageConfig.cmake") endif() set(MAN_OPTIONS_FILE "${CMAKE_CURRENT_BINARY_DIR}/freerdp-global-options.1") set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${MAN_OPTIONS_FILE}) add_custom_command( - OUTPUT ${MAN_OPTIONS_FILE} - COMMAND ${CMAKE_BINARY_DIR}/client/common/man/generate_argument_manpage "${MAN_OPTIONS_FILE}" - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - DEPENDS - generate_argument_manpage + OUTPUT ${MAN_OPTIONS_FILE} COMMAND ${CMAKE_BINARY_DIR}/client/common/man/generate_argument_manpage + "${MAN_OPTIONS_FILE}" WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + DEPENDS generate_argument_manpage +) +add_custom_target( + generate_argument_manpage.target DEPENDS ${MAN_OPTIONS_FILE} ${CMAKE_BINARY_DIR}/include/freerdp/config.h + generate_argument_manpage WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} ) -add_custom_target(generate_argument_manpage.target - DEPENDS - ${MAN_OPTIONS_FILE} - ${CMAKE_BINARY_DIR}/include/freerdp/config.h - generate_argument_manpage - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - ) diff --git a/client/common/test/CMakeLists.txt b/client/common/test/CMakeLists.txt index 006f3047e..cc01be23f 100644 --- a/client/common/test/CMakeLists.txt +++ b/client/common/test/CMakeLists.txt @@ -1,4 +1,3 @@ - set(MODULE_NAME "TestClient") set(MODULE_PREFIX "TEST_CLIENT") @@ -6,14 +5,9 @@ set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c) disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR}) -set(${MODULE_PREFIX}_TESTS - TestClientRdpFile.c - TestClientChannels.c - TestClientCmdLine.c) +set(${MODULE_PREFIX}_TESTS TestClientRdpFile.c TestClientChannels.c TestClientCmdLine.c) -create_test_sourcelist(${MODULE_PREFIX}_SRCS - ${${MODULE_PREFIX}_DRIVER} - ${${MODULE_PREFIX}_TESTS}) +create_test_sourcelist(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_DRIVER} ${${MODULE_PREFIX}_TESTS}) add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) @@ -24,9 +18,8 @@ target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS}) set_target_properties(${MODULE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TESTING_OUTPUT_DIRECTORY}") foreach(test ${${MODULE_PREFIX}_TESTS}) - get_filename_component(TestName ${test} NAME_WE) - add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) + get_filename_component(TestName ${test} NAME_WE) + add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) endforeach() set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "FreeRDP/Client/Test") - diff --git a/client/iOS/CMakeLists.txt b/client/iOS/CMakeLists.txt index 162d62392..f69dd692d 100644 --- a/client/iOS/CMakeLists.txt +++ b/client/iOS/CMakeLists.txt @@ -17,13 +17,11 @@ cmake_minimum_required(VERSION 3.13) -if (NOT FREERDP_DEFAULT_PROJECT_VERSION) - set(FREERDP_DEFAULT_PROJECT_VERSION "1.0.0.0") +if(NOT FREERDP_DEFAULT_PROJECT_VERSION) + set(FREERDP_DEFAULT_PROJECT_VERSION "1.0.0.0") endif() -project(iFreeRDP - VERSION ${FREERDP_DEFAULT_PROJECT_VERSION} -) +project(iFreeRDP VERSION ${FREERDP_DEFAULT_PROJECT_VERSION}) message("project ${PROJECT_NAME} is using version ${PROJECT_VERSION}") @@ -53,10 +51,7 @@ include_directories(SYSTEM ${IOS_CLIENT_VIEWS_DIR}) include_directories(SYSTEM ${OPENSSL_INCLUDE_DIR}) # Add sources -set(${MODULE_PREFIX}_SRCS - AppDelegate.m - AppDelegate.h - main.m) +set(${MODULE_PREFIX}_SRCS AppDelegate.m AppDelegate.h main.m) file(GLOB IOS_CLIENT_ADDITIONS_SRCS ${IOS_CLIENT_ADDITIONS_DIR}/*.m) file(GLOB IOS_CLIENT_ADDITIONS_HDRS ${IOS_CLIENT_ADDITIONS_DIR}/*.h) @@ -87,7 +82,10 @@ source_group(FreeRDP FILES ${IOS_CLIENT_FREERDP_SRCS} ${IOS_CLIENT_FREERDP_HDRS} source_group(Misc FILES ${IOS_CLIENT_MISC_SRCS} ${IOS_CLIENT_MISC_HDRS}) source_group(Models FILES ${IOS_CLIENT_MODELS_SRCS} ${IOS_CLIENT_MODELS_HDRS}) source_group(Views FILES ${IOS_CLIENT_RESOURCES_XIBS} ${IOS_CLIENT_VIEWS_SRCS} ${IOS_CLIENT_VIEWS_HDRS}) -source_group(Resources FILES ${IOS_CLIENT_RESOURCES_PNGS} ${IOS_CLIENT_RESOURCES_DIR}/about_page ${IOS_CLIENT_RESOURCES_DIR}/help_page ${IOS_CLIENT_RESOURCES_DIR}/en.lproj) +source_group( + Resources FILES ${IOS_CLIENT_RESOURCES_PNGS} ${IOS_CLIENT_RESOURCES_DIR}/about_page + ${IOS_CLIENT_RESOURCES_DIR}/help_page ${IOS_CLIENT_RESOURCES_DIR}/en.lproj +) # import libraries find_library(FOUNDATION_FRAMEWORK Foundation) @@ -96,28 +94,41 @@ find_library(SECURITY_FRAMEWORK Security) find_library(UIKIT_FRAMEWORK UIKit) find_library(SYSTEMCONFIGURATION_FRAMEWORK SystemConfiguration) -mark_as_advanced(FOUNDATION_FRAMEWORK COREGRAPHICS_FRAMEWORK SECURITY_FRAMEWORK UIKIT_FRAMEWORK SYSTEMCONFIGURATION_FRAMEWORK) -set(EXTRA_LIBS ${FOUNDATION_FRAMEWORK} ${COREGRAPHICS_FRAMEWORK} ${SECURITY_FRAMEWORK} ${UIKIT_FRAMEWORK} ${SYSTEMCONFIGURATION_FRAMEWORK}) +mark_as_advanced( + FOUNDATION_FRAMEWORK COREGRAPHICS_FRAMEWORK SECURITY_FRAMEWORK UIKIT_FRAMEWORK SYSTEMCONFIGURATION_FRAMEWORK +) +set(EXTRA_LIBS ${FOUNDATION_FRAMEWORK} ${COREGRAPHICS_FRAMEWORK} ${SECURITY_FRAMEWORK} ${UIKIT_FRAMEWORK} + ${SYSTEMCONFIGURATION_FRAMEWORK} +) set(${MODULE_NAME}_RESOURCES ${IOS_CLIENT_RESOURCES_XIBS}) set(${MODULE_NAME}_RESOURCES ${${MODULE_NAME}_RESOURCES} ${IOS_CLIENT_RESOURCES_PNGS}) -set(${MODULE_NAME}_RESOURCES ${${MODULE_NAME}_RESOURCES} ${IOS_CLIENT_RESOURCES_DIR}/about_page ${IOS_CLIENT_RESOURCES_DIR}/help_page ${IOS_CLIENT_RESOURCES_DIR}/en.lproj) +set(${MODULE_NAME}_RESOURCES ${${MODULE_NAME}_RESOURCES} ${IOS_CLIENT_RESOURCES_DIR}/about_page + ${IOS_CLIENT_RESOURCES_DIR}/help_page ${IOS_CLIENT_RESOURCES_DIR}/en.lproj +) set(${MODULE_NAME}_RESOURCES ${${MODULE_NAME}_RESOURCES} ${IOS_CLIENT_DIR}/Defaults.plist) -add_executable(${MODULE_NAME} - ${APP_TYPE} - ${${MODULE_PREFIX}_SRCS} - ${IOS_CLIENT_ADDITIONS_SRCS} ${IOS_CLIENT_ADDITIONS_HDRS} - ${IOS_CLIENT_CONTROLLERS_SRCS} ${IOS_CLIENT_CONTROLLERS_HDRS} - ${IOS_CLIENT_FREERDP_SRCS} ${IOS_CLIENT_FREERDP_HDRS} - ${IOS_CLIENT_MISC_SRCS} ${IOS_CLIENT_MISC_HDRS} - ${IOS_CLIENT_MODELS_SRCS} ${IOS_CLIENT_MODELS_HDRS} - ${IOS_CLIENT_VIEWS_SRCS} ${IOS_CLIENT_VIEWS_HDRS} - ${${MODULE_NAME}_RESOURCES} - ) +add_executable( + ${MODULE_NAME} + ${APP_TYPE} + ${${MODULE_PREFIX}_SRCS} + ${IOS_CLIENT_ADDITIONS_SRCS} + ${IOS_CLIENT_ADDITIONS_HDRS} + ${IOS_CLIENT_CONTROLLERS_SRCS} + ${IOS_CLIENT_CONTROLLERS_HDRS} + ${IOS_CLIENT_FREERDP_SRCS} + ${IOS_CLIENT_FREERDP_HDRS} + ${IOS_CLIENT_MISC_SRCS} + ${IOS_CLIENT_MISC_HDRS} + ${IOS_CLIENT_MODELS_SRCS} + ${IOS_CLIENT_MODELS_HDRS} + ${IOS_CLIENT_VIEWS_SRCS} + ${IOS_CLIENT_VIEWS_HDRS} + ${${MODULE_NAME}_RESOURCES} +) -if (WITH_BINARY_VERSIONING) - set_target_properties(${MODULE_NAME} PROPERTIES OUTPUT_NAME "${MODULE_NAME}${PROJECT_VERSION_MAJOR}") +if(WITH_BINARY_VERSIONING) + set_target_properties(${MODULE_NAME} PROPERTIES OUTPUT_NAME "${MODULE_NAME}${PROJECT_VERSION_MAJOR}") endif() set_target_properties(${MODULE_NAME} PROPERTIES RESOURCE "${${MODULE_NAME}_RESOURCES}") @@ -134,8 +145,8 @@ set_target_properties(${MODULE_NAME} PROPERTIES XCODE_ATTRIBUTE_COMBINE_HIDPI_IM set_target_properties(${MODULE_NAME} PROPERTIES XCODE_ATTRIBUTE_SKIP_INSTALL NO) set_target_properties(${MODULE_NAME} PROPERTIES XCODE_ATTRIBUTE_INSTALL_PATH "/Applications") set_target_properties(${MODULE_NAME} PROPERTIES XCODE_ATTRIBUTE_GCC_GENERATE_DEBUGGING_SYMBOLS YES) -if (CODE_SIGN_IDENTITY) - set_target_properties(${MODULE_NAME} PROPERTIES XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "${CODE_SIGN_IDENTITY}") +if(CODE_SIGN_IDENTITY) + set_target_properties(${MODULE_NAME} PROPERTIES XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "${CODE_SIGN_IDENTITY}") endif() set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} ${EXTRA_LIBS}) diff --git a/client/iOS/ModuleOptions.cmake b/client/iOS/ModuleOptions.cmake index 3c4b366bb..ced71677c 100644 --- a/client/iOS/ModuleOptions.cmake +++ b/client/iOS/ModuleOptions.cmake @@ -1,4 +1,3 @@ - set(FREERDP_CLIENT_NAME "ifreerdp") set(FREERDP_CLIENT_PLATFORM "iOS") set(FREERDP_CLIENT_VENDOR "FreeRDP") diff --git a/cmake/AddFuzzerTest.cmake b/cmake/AddFuzzerTest.cmake index e16aa1bd1..382d04dea 100644 --- a/cmake/AddFuzzerTest.cmake +++ b/cmake/AddFuzzerTest.cmake @@ -1,15 +1,15 @@ macro(add_fuzzer_test FILES LINK_LIBS) - if (BUILD_FUZZERS) - string(REPLACE " " ";" LOCAL_LINK_LIBS ${LINK_LIBS}) - list(APPEND LOCAL_LINK_LIBS fuzzer_config) - foreach(test ${FILES}) - get_filename_component(TestName ${test} NAME_WE) - add_executable(${TestName} ${test}) - # Use PUBLIC to force 'fuzzer_config' for all dependent targets. - target_link_libraries(${TestName} PUBLIC ${LOCAL_LINK_LIBS}) - add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) - set_target_properties(${TestName} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TESTING_OUTPUT_DIRECTORY}") - add_dependencies(fuzzers ${TestName}) - endforeach() - endif (BUILD_FUZZERS) + if(BUILD_FUZZERS) + string(REPLACE " " ";" LOCAL_LINK_LIBS ${LINK_LIBS}) + list(APPEND LOCAL_LINK_LIBS fuzzer_config) + foreach(test ${FILES}) + get_filename_component(TestName ${test} NAME_WE) + add_executable(${TestName} ${test}) + # Use PUBLIC to force 'fuzzer_config' for all dependent targets. + target_link_libraries(${TestName} PUBLIC ${LOCAL_LINK_LIBS}) + add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) + set_target_properties(${TestName} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TESTING_OUTPUT_DIRECTORY}") + add_dependencies(fuzzers ${TestName}) + endforeach() + endif(BUILD_FUZZERS) endmacro() diff --git a/cmake/AddTargetWithResourceFile.cmake b/cmake/AddTargetWithResourceFile.cmake index 91e3da684..91cdd0e61 100644 --- a/cmake/AddTargetWithResourceFile.cmake +++ b/cmake/AddTargetWithResourceFile.cmake @@ -3,119 +3,92 @@ set(add_resource_macro_internal_dir ${CMAKE_CURRENT_LIST_DIR} CACHE INTERNAL "") include(CleaningConfigureFile) macro(AddTargetWithResourceFile nameAndTarget is_exe version sources) - list(LENGTH ${nameAndTarget} target_length) - if (target_length GREATER 1) - list(GET ${nameAndTarget} 1 name) - list(GET ${nameAndTarget} 0 target) - else() - set(name ${nameAndTarget}) - set(target ${nameAndTarget}) - endif() + list(LENGTH ${nameAndTarget} target_length) + if(target_length GREATER 1) + list(GET ${nameAndTarget} 1 name) + list(GET ${nameAndTarget} 0 target) + else() + set(name ${nameAndTarget}) + set(target ${nameAndTarget}) + endif() - set(VERSIONING OFF) - set(IS_EXE OFF) - if ("${is_exe}" MATCHES "TRUE") - set(IS_EXE ON) - elseif ("${is_exe}" MATCHES "WIN32") - set(IS_EXE ON) - set(exe_options "WIN32") - elseif ("${is_exe}" MATCHES "SHARED") - set(lib_options "SHARED") - elseif ("${is_exe}" MATCHES "STATIC") - set(lib_options "STATIC") - endif() + set(VERSIONING OFF) + set(IS_EXE OFF) + if("${is_exe}" MATCHES "TRUE") + set(IS_EXE ON) + elseif("${is_exe}" MATCHES "WIN32") + set(IS_EXE ON) + set(exe_options "WIN32") + elseif("${is_exe}" MATCHES "SHARED") + set(lib_options "SHARED") + elseif("${is_exe}" MATCHES "STATIC") + set(lib_options "STATIC") + endif() - if (IS_EXE AND WITH_BINARY_VERSIONING) - set(VERSIONING ON) - elseif (NOT IS_EXE AND WITH_LIBRARY_VERSIONING) - set(VERSIONING ON) - endif() - if (${ARGC} GREATER 4) - set(VERSIONING ${ARGV5}) - endif() + if(IS_EXE AND WITH_BINARY_VERSIONING) + set(VERSIONING ON) + elseif(NOT IS_EXE AND WITH_LIBRARY_VERSIONING) + set(VERSIONING ON) + endif() + if(${ARGC} GREATER 4) + set(VERSIONING ${ARGV5}) + endif() - string(REGEX MATCH "^([0-9]+)\\.([0-9]+)\\.([0-9]+).*" - RC_PROGRAM_VERSION_MATCH ${version}) - set (RC_VERSION_MAJOR ${CMAKE_MATCH_1}) - set (RC_VERSION_MINOR ${CMAKE_MATCH_2}) - set (RC_VERSION_BUILD ${CMAKE_MATCH_3}) + string(REGEX MATCH "^([0-9]+)\\.([0-9]+)\\.([0-9]+).*" RC_PROGRAM_VERSION_MATCH ${version}) + set(RC_VERSION_MAJOR ${CMAKE_MATCH_1}) + set(RC_VERSION_MINOR ${CMAKE_MATCH_2}) + set(RC_VERSION_BUILD ${CMAKE_MATCH_3}) - if (WIN32) - if (IS_EXE) - if (VERSIONING) - set (RC_VERSION_FILE "${name}${RC_VERSION_MAJOR}${CMAKE_EXECUTABLE_SUFFIX}" ) - else() - set (RC_VERSION_FILE "${name}${CMAKE_EXECUTABLE_SUFFIX}" ) - endif() + if(WIN32) + if(IS_EXE) + if(VERSIONING) + set(RC_VERSION_FILE "${name}${RC_VERSION_MAJOR}${CMAKE_EXECUTABLE_SUFFIX}") else() - if (VERSIONING) - set (RC_VERSION_FILE "${CMAKE_SHARED_LIBRARY_PREFIX}${name}${RC_VERSION_MAJOR}${CMAKE_SHARED_LIBRARY_SUFFIX}" ) - else() - set (RC_VERSION_FILE "${CMAKE_SHARED_LIBRARY_PREFIX}${name}${CMAKE_SHARED_LIBRARY_SUFFIX}" ) - endif() + set(RC_VERSION_FILE "${name}${CMAKE_EXECUTABLE_SUFFIX}") endif() - - cleaning_configure_file( - ${add_resource_macro_internal_dir}/WindowsDLLVersion.rc.in - ${CMAKE_CURRENT_BINARY_DIR}/version.rc - @ONLY - ) - - list(APPEND ${sources} ${CMAKE_CURRENT_BINARY_DIR}/version.rc) - endif() - - set(OUTPUT_FILENAME "${name}") - if (VERSIONING) - string(APPEND OUTPUT_FILENAME "${RC_VERSION_MAJOR}") - endif() - - if (IS_EXE) - message("add_executable(${target}) [${exe_options}]") - add_executable( - ${target} - ${exe_options} - ${${sources}} - ) - - set_target_properties( - ${target} - PROPERTIES - OUTPUT_NAME ${OUTPUT_FILENAME} - ) - string(APPEND OUTPUT_FILENAME "${CMAKE_EXECUTABLE_SUFFIX}") else() - message("add_library(${target}) [${lib_options}]") - add_library(${target} - ${lib_options} - ${${sources}}) - - if (VERSIONING) - set_target_properties( - ${target} - PROPERTIES - VERSION ${version} - SOVERSION ${RC_VERSION_MAJOR} - ) - else() - set_target_properties(${target} PROPERTIES PREFIX "") - endif() - - set_target_properties( - ${target} - PROPERTIES - OUTPUT_NAME ${OUTPUT_FILENAME} - ) - set (OUTPUT_FILENAME "${CMAKE_SHARED_LIBRARY_PREFIX}${OUTPUT_FILENAME}${CMAKE_SHARED_LIBRARY_SUFFIX}" ) + if(VERSIONING) + set(RC_VERSION_FILE "${CMAKE_SHARED_LIBRARY_PREFIX}${name}${RC_VERSION_MAJOR}${CMAKE_SHARED_LIBRARY_SUFFIX}") + else() + set(RC_VERSION_FILE "${CMAKE_SHARED_LIBRARY_PREFIX}${name}${CMAKE_SHARED_LIBRARY_SUFFIX}") + endif() endif() + cleaning_configure_file( + ${add_resource_macro_internal_dir}/WindowsDLLVersion.rc.in ${CMAKE_CURRENT_BINARY_DIR}/version.rc @ONLY + ) - if (WITH_DEBUG_SYMBOLS AND MSVC AND (is_exe OR BUILD_SHARED_LIBS)) - message("add PDB for ${OUTPUT_FILENAME}") - set_target_properties( - ${target} - PROPERTIES - PDB_NAME ${OUTPUT_FILENAME} - ) - install(FILES $ DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT symbols) + list(APPEND ${sources} ${CMAKE_CURRENT_BINARY_DIR}/version.rc) + endif() + + set(OUTPUT_FILENAME "${name}") + if(VERSIONING) + string(APPEND OUTPUT_FILENAME "${RC_VERSION_MAJOR}") + endif() + + if(IS_EXE) + message("add_executable(${target}) [${exe_options}]") + add_executable(${target} ${exe_options} ${${sources}}) + + set_target_properties(${target} PROPERTIES OUTPUT_NAME ${OUTPUT_FILENAME}) + string(APPEND OUTPUT_FILENAME "${CMAKE_EXECUTABLE_SUFFIX}") + else() + message("add_library(${target}) [${lib_options}]") + add_library(${target} ${lib_options} ${${sources}}) + + if(VERSIONING) + set_target_properties(${target} PROPERTIES VERSION ${version} SOVERSION ${RC_VERSION_MAJOR}) + else() + set_target_properties(${target} PROPERTIES PREFIX "") endif() + + set_target_properties(${target} PROPERTIES OUTPUT_NAME ${OUTPUT_FILENAME}) + set(OUTPUT_FILENAME "${CMAKE_SHARED_LIBRARY_PREFIX}${OUTPUT_FILENAME}${CMAKE_SHARED_LIBRARY_SUFFIX}") + endif() + + if(WITH_DEBUG_SYMBOLS AND MSVC AND (is_exe OR BUILD_SHARED_LIBS)) + message("add PDB for ${OUTPUT_FILENAME}") + set_target_properties(${target} PROPERTIES PDB_NAME ${OUTPUT_FILENAME}) + install(FILES $ DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT symbols) + endif() endmacro() diff --git a/cmake/CFlagsToVar.cmake b/cmake/CFlagsToVar.cmake index b6b1af6bd..24a13f8ea 100644 --- a/cmake/CFlagsToVar.cmake +++ b/cmake/CFlagsToVar.cmake @@ -1,14 +1,13 @@ function(CFlagsToVar NAME) - set(C_FLAGS ${CMAKE_C_FLAGS}) - string(REPLACE "${CMAKE_SOURCE_DIR}" "" C_FLAGS "${C_FLAGS}") - string(REPLACE "${CMAKE_BINARY_DIR}" "" C_FLAGS "${C_FLAGS}") + set(C_FLAGS ${CMAKE_C_FLAGS}) + string(REPLACE "${CMAKE_SOURCE_DIR}" "" C_FLAGS "${C_FLAGS}") + string(REPLACE "${CMAKE_BINARY_DIR}" "" C_FLAGS "${C_FLAGS}") - if (CMAKE_BUILD_TYPE) - string(TOUPPER "${CMAKE_BUILD_TYPE}" CAPS_BUILD_TYPE) - string(APPEND C_FLAGS " ${CMAKE_C_FLAGS_${CAPS_BUILD_TYPE}}") - endif() - string(REPLACE "\$" "\\\$" C_FLAGS "${C_FLAGS}") - string(REPLACE "\"" "\\\"" C_FLAGS "${C_FLAGS}") - set(${NAME} ${C_FLAGS} PARENT_SCOPE) + if(CMAKE_BUILD_TYPE) + string(TOUPPER "${CMAKE_BUILD_TYPE}" CAPS_BUILD_TYPE) + string(APPEND C_FLAGS " ${CMAKE_C_FLAGS_${CAPS_BUILD_TYPE}}") + endif() + string(REPLACE "\$" "\\\$" C_FLAGS "${C_FLAGS}") + string(REPLACE "\"" "\\\"" C_FLAGS "${C_FLAGS}") + set(${NAME} ${C_FLAGS} PARENT_SCOPE) endfunction() - diff --git a/cmake/CXXCompilerFlags.cmake b/cmake/CXXCompilerFlags.cmake index 70e86eb5f..ecb516ab0 100644 --- a/cmake/CXXCompilerFlags.cmake +++ b/cmake/CXXCompilerFlags.cmake @@ -1,83 +1,75 @@ include(CheckCXXCompilerFlag) -macro (checkCXXFlag FLAG) - check_cxx_compiler_flag("${FLAG}" CXXFLAG${FLAG}) - if(CXXFLAG${FLAG}) - string(APPEND CMAKE_CXX_FLAGS " ${FLAG}") - else() - message(WARNING "compiler does not support ${FLAG}") - endif() +macro(checkCXXFlag FLAG) + check_cxx_compiler_flag("${FLAG}" CXXFLAG${FLAG}) + if(CXXFLAG${FLAG}) + string(APPEND CMAKE_CXX_FLAGS " ${FLAG}") + else() + message(WARNING "compiler does not support ${FLAG}") + endif() endmacro() option(ENABLE_WARNING_VERBOSE "enable -Weveryting (and some exceptions) for compile" OFF) 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_CXX_FLAGS - CMAKE_CXX_FLAGS_DEBUG - CMAKE_CXX_FLAGS_RELEASE - CMAKE_CXX_FLAGS_RELWITHDEBINFO - CMAKE_CXX_FLAGS_MINSIZEREL) - string (REGEX REPLACE "(^| )[/-]W[ ]*[1-9]" " " - "${flags_var_to_scrub}" "${${flags_var_to_scrub}}") - endforeach() +if(ENABLE_WARNING_VERBOSE) + if(MSVC) + # Remove previous warning definitions, + # NMake is otherwise complaining. + foreach(flags_var_to_scrub CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE + CMAKE_CXX_FLAGS_RELWITHDEBINFO CMAKE_CXX_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-switch-enum - -Wno-cast-align - -Wno-declaration-after-statement - -Wno-unsafe-buffer-usage - -Wno-reserved-identifier - -Wno-covered-switch-default - -Wno-disabled-macro-expansion - -Wno-ctad-maybe-unsupported - -Wno-c++98-compat - -Wno-c++98-compat-pedantic - -Wno-pre-c++17-compat - -Wno-exit-time-destructors - -Wno-gnu-zero-variadic-macro-arguments - ) - endif() + set(C_WARNING_FLAGS /W4 /wo4324) + else() + set(C_WARNING_FLAGS + -Weverything + -Wall + -Wpedantic + -Wno-padded + -Wno-switch-enum + -Wno-cast-align + -Wno-declaration-after-statement + -Wno-unsafe-buffer-usage + -Wno-reserved-identifier + -Wno-covered-switch-default + -Wno-disabled-macro-expansion + -Wno-ctad-maybe-unsupported + -Wno-c++98-compat + -Wno-c++98-compat-pedantic + -Wno-pre-c++17-compat + -Wno-exit-time-destructors + -Wno-gnu-zero-variadic-macro-arguments + ) + endif() - foreach(FLAG ${C_WARNING_FLAGS}) - CheckCXXFlag(${FLAG}) - endforeach() + foreach(FLAG ${C_WARNING_FLAGS}) + checkcxxflag(${FLAG}) + endforeach() endif() - -if (ENABLE_WARNING_ERROR) - CheckCXXFlag(-Werror) +if(ENABLE_WARNING_ERROR) + checkcxxflag(-Werror) endif() -CheckCXXFlag(-fno-omit-frame-pointer) +checkcxxflag(-fno-omit-frame-pointer) -if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU") - if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 10) - add_compile_options($<$>:-fdebug-prefix-map=${CMAKE_SOURCE_DIR}=.>) - add_compile_options($<$>:-fmacro-prefix-map=${CMAKE_SOURCE_DIR}=.>) - add_compile_options($<$>:-ffile-prefix-map=${CMAKE_SOURCE_DIR}=.>) - add_compile_options($<$>:-fdebug-prefix-map=${CMAKE_BINARY_DIR}=./build>) - add_compile_options($<$>:-fmacro-prefix-map=${CMAKE_BINARY_DIR}=./build>) - add_compile_options($<$>:-ffile-prefix-map=${CMAKE_BINARY_DIR}=./build>) - endif() +if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU") + if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 10) + add_compile_options($<$>:-fdebug-prefix-map=${CMAKE_SOURCE_DIR}=.>) + add_compile_options($<$>:-fmacro-prefix-map=${CMAKE_SOURCE_DIR}=.>) + add_compile_options($<$>:-ffile-prefix-map=${CMAKE_SOURCE_DIR}=.>) + add_compile_options($<$>:-fdebug-prefix-map=${CMAKE_BINARY_DIR}=./build>) + add_compile_options($<$>:-fmacro-prefix-map=${CMAKE_BINARY_DIR}=./build>) + add_compile_options($<$>:-ffile-prefix-map=${CMAKE_BINARY_DIR}=./build>) + endif() endif() # https://stackoverflow.com/questions/4913922/possible-problems-with-nominmax-on-visual-c -if (WIN32) - add_compile_options($<$:-DNOMINMAX>) +if(WIN32) + add_compile_options($<$:-DNOMINMAX>) endif() set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} CACHE STRING "default CXXFLAGS") diff --git a/cmake/CheckCmakeCompat.cmake b/cmake/CheckCmakeCompat.cmake index 460e59dca..1f5e69348 100644 --- a/cmake/CheckCmakeCompat.cmake +++ b/cmake/CheckCmakeCompat.cmake @@ -17,9 +17,9 @@ #============================================================================= macro(enable_cmake_compat CMVERSION) - if(${CMAKE_VERSION} VERSION_LESS ${CMVERSION}) - LIST(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/compat_${CMVERSION}/") - endif() + if(${CMAKE_VERSION} VERSION_LESS ${CMVERSION}) + list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/compat_${CMVERSION}/") + endif() endmacro() # Compatibility includes - order does matter! diff --git a/cmake/ClangDetectTool.cmake b/cmake/ClangDetectTool.cmake index a7e0f5ff4..3be473698 100644 --- a/cmake/ClangDetectTool.cmake +++ b/cmake/ClangDetectTool.cmake @@ -1,48 +1,42 @@ -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}) +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() + 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 - ) + 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 encountered with ${${VAR}}") - message(WARNING "${_CLANG_TOOL_VERSION_FAILED}") - unset(${VAR}) - return() - endif() + if(_CLANG_TOOL_VERSION_FAILED) + message(WARNING "A problem was encountered 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}") + 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() + 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() + 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 index b815822fa..0f56dafa7 100644 --- a/cmake/ClangFormat.cmake +++ b/cmake/ClangFormat.cmake @@ -1,17 +1,19 @@ # get all project files -file(GLOB_RECURSE ALL_SOURCE_FILES *.cpp *.c *.h *.m *.java) +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.") +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} - ) + add_custom_target(clangformat COMMAND ${CLANG_FORMAT} -style=file -i ${ALL_SOURCE_FILES}) endif() diff --git a/cmake/ClangTidy.cmake b/cmake/ClangTidy.cmake index 4298a043c..d6b504d45 100644 --- a/cmake/ClangTidy.cmake +++ b/cmake/ClangTidy.cmake @@ -1,16 +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) +if(BUILD_WITH_CLANG_TIDY) + include(ClangDetectTool) + clang_detect_tool(CLANG_TIDY_EXE clang-tidy REQUIRED) - set(CLANG_TIDY_COMMAND "${CLANG_TIDY_EXE}") + set(CLANG_TIDY_COMMAND "${CLANG_TIDY_EXE}") - 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}") + 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) + 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 index b5ae35af2..1450e1973 100644 --- a/cmake/ClangToolchain.cmake +++ b/cmake/ClangToolchain.cmake @@ -1,17 +1,19 @@ -if ($ENV{CLANG_VERSION}) - SET (CLANG_VERSION "-$ENV{CLANG_VERSION}") +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(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_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_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 "") +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/CleaningConfigureFile.cmake b/cmake/CleaningConfigureFile.cmake index 52ee56e12..8a83c7511 100644 --- a/cmake/CleaningConfigureFile.cmake +++ b/cmake/CleaningConfigureFile.cmake @@ -5,18 +5,7 @@ # function(cleaning_configure_file SRC DST) - configure_file(${SRC} ${DST} ${ARGN}) - set_property( - DIRECTORY - APPEND - PROPERTY ADDITIONAL_CLEAN_FILES - ${DST} - ) - set_property( - DIRECTORY - APPEND - PROPERTY CMAKE_CONFIGURE_DEPENDS - ${SRC} - ${DST} - ) + configure_file(${SRC} ${DST} ${ARGN}) + set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_CLEAN_FILES ${DST}) + set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${SRC} ${DST}) endfunction() diff --git a/cmake/CommonConfigOptions.cmake b/cmake/CommonConfigOptions.cmake index 25ae9c060..634c8d3bf 100644 --- a/cmake/CommonConfigOptions.cmake +++ b/cmake/CommonConfigOptions.cmake @@ -8,26 +8,26 @@ option(BUILD_SHARED_LIBS "Build shared libraries" ON) # We want to control the winpr assert for the whole project option(WITH_VERBOSE_WINPR_ASSERT "Compile with verbose WINPR_ASSERT." ON) -if (WITH_VERBOSE_WINPR_ASSERT) - add_definitions(-DWITH_VERBOSE_WINPR_ASSERT) +if(WITH_VERBOSE_WINPR_ASSERT) + add_definitions(-DWITH_VERBOSE_WINPR_ASSERT) endif() # 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() +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}) + option(CMAKE_INTERPROCEDURAL_OPTIMIZATION "build with link time optimization" ${supported}) endif() set(SUPPORTED_BUILD_TYPES "Debug" "Release" "MinSizeRel" "RelWithDebInfo") @@ -38,17 +38,15 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) set(default_build_type "Release") message(STATUS "Setting build type to '${default_build_type}' as none was specified.") - set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE - STRING "Choose the type of build." FORCE) + set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE STRING "Choose the type of build." FORCE) # Set the possible values of build type for cmake-gui - set_property(CACHE CMAKE_BUILD_TYPE PROPERTY - STRINGS ${SUPPORTED_BUILD_TYPES}) + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS ${SUPPORTED_BUILD_TYPES}) endif() -if (CMAKE_BUILD_TYPE) - if (NOT "${CMAKE_BUILD_TYPE}" IN_LIST SUPPORTED_BUILD_TYPES) - message(FATAL_ERROR "CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} not supported. Set to any of ${SUPPORTED_BUILD_TYPES}") - endif() +if(CMAKE_BUILD_TYPE) + if(NOT "${CMAKE_BUILD_TYPE}" IN_LIST SUPPORTED_BUILD_TYPES) + message(FATAL_ERROR "CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} not supported. Set to any of ${SUPPORTED_BUILD_TYPES}") + endif() endif() include(PlatformDefaults) diff --git a/cmake/CompilerDetect.cmake b/cmake/CompilerDetect.cmake index b1390f7fb..b2492584e 100644 --- a/cmake/CompilerDetect.cmake +++ b/cmake/CompilerDetect.cmake @@ -1,6 +1,6 @@ if(CMAKE_C_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") - set(CMAKE_COMPILER_IS_CLANG 1) + set(CMAKE_COMPILER_IS_CLANG 1) endif() if(CMAKE_C_COMPILER_ID MATCHES "AppleClang" OR CMAKE_CXX_COMPILER_ID MATCHES "AppleClang") - set(CMAKE_COMPILER_IS_CLANG 1) + set(CMAKE_COMPILER_IS_CLANG 1) endif() diff --git a/cmake/CompilerFlags.cmake b/cmake/CompilerFlags.cmake index ee2e6c214..44ca8eb5b 100644 --- a/cmake/CompilerFlags.cmake +++ b/cmake/CompilerFlags.cmake @@ -1,73 +1,66 @@ 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() +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" OFF) 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() +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-switch-enum - -Wno-cast-align - -Wno-declaration-after-statement - -Wno-unsafe-buffer-usage - -Wno-reserved-identifier - -Wno-covered-switch-default - -Wno-disabled-macro-expansion - -Wno-pre-c11-compat - -Wno-gnu-zero-variadic-macro-arguments - ) - endif() + set(C_WARNING_FLAGS /W4 /wo4324) + else() + set(C_WARNING_FLAGS + -Weverything + -Wall + -Wpedantic + -Wno-padded + -Wno-switch-enum + -Wno-cast-align + -Wno-declaration-after-statement + -Wno-unsafe-buffer-usage + -Wno-reserved-identifier + -Wno-covered-switch-default + -Wno-disabled-macro-expansion + -Wno-pre-c11-compat + -Wno-gnu-zero-variadic-macro-arguments + ) + endif() - foreach(FLAG ${C_WARNING_FLAGS}) - CheckCFlag(${FLAG}) - endforeach() + foreach(FLAG ${C_WARNING_FLAGS}) + checkcflag(${FLAG}) + endforeach() endif() -if (ENABLE_WARNING_ERROR) - CheckCFlag(-Werror) +if(ENABLE_WARNING_ERROR) + checkcflag(-Werror) endif() -CheckCFlag(-fno-omit-frame-pointer) +checkcflag(-fno-omit-frame-pointer) -if (CMAKE_C_COMPILER_ID MATCHES "Clang" OR CMAKE_C_COMPILER_ID MATCHES "GNU") - if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 10) - add_compile_options($<$>:-fdebug-prefix-map=${CMAKE_SOURCE_DIR}=.>) - add_compile_options($<$>:-fmacro-prefix-map=${CMAKE_SOURCE_DIR}=.>) - add_compile_options($<$>:-ffile-prefix-map=${CMAKE_SOURCE_DIR}=.>) - add_compile_options($<$>:-fdebug-prefix-map=${CMAKE_BINARY_DIR}=./build>) - add_compile_options($<$>:-fmacro-prefix-map=${CMAKE_BINARY_DIR}=./build>) - add_compile_options($<$>:-ffile-prefix-map=${CMAKE_BINARY_DIR}=./build>) - endif() +if(CMAKE_C_COMPILER_ID MATCHES "Clang" OR CMAKE_C_COMPILER_ID MATCHES "GNU") + if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 10) + add_compile_options($<$>:-fdebug-prefix-map=${CMAKE_SOURCE_DIR}=.>) + add_compile_options($<$>:-fmacro-prefix-map=${CMAKE_SOURCE_DIR}=.>) + add_compile_options($<$>:-ffile-prefix-map=${CMAKE_SOURCE_DIR}=.>) + add_compile_options($<$>:-fdebug-prefix-map=${CMAKE_BINARY_DIR}=./build>) + add_compile_options($<$>:-fmacro-prefix-map=${CMAKE_BINARY_DIR}=./build>) + add_compile_options($<$>:-ffile-prefix-map=${CMAKE_BINARY_DIR}=./build>) + endif() endif() set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} CACHE STRING "default CFLAGS") diff --git a/cmake/ConfigOptions.cmake b/cmake/ConfigOptions.cmake index 358ff685a..03fd2cb87 100644 --- a/cmake/ConfigOptions.cmake +++ b/cmake/ConfigOptions.cmake @@ -1,29 +1,29 @@ include(CMakeDependentOption) if((CMAKE_SYSTEM_PROCESSOR MATCHES "i386|i686|x86|AMD64") AND (CMAKE_SIZEOF_VOID_P EQUAL 4)) - set(TARGET_ARCH "x86") + set(TARGET_ARCH "x86") elseif((CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|AMD64") AND (CMAKE_SIZEOF_VOID_P EQUAL 8)) - set(TARGET_ARCH "x64") + 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") + # Mac is weird like that. + set(TARGET_ARCH "x64") elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm*") - set(TARGET_ARCH "ARM") + set(TARGET_ARCH "ARM") elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "sparc") - set(TARGET_ARCH "sparc") + set(TARGET_ARCH "sparc") elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "e2k") - set(TARGET_ARCH "e2k") + set(TARGET_ARCH "e2k") endif() -if (NOT OPENBSD AND NOT WIN32) - set(MANPAGE_DEF ON) +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) -cmake_dependent_option(WITH_AVX2 "Compile AVX2 optimizations" ON "WITH_SSE2" OFF) +cmake_dependent_option(WITH_AVX2 "Compile AVX2 optimizations" ON "WITH_SSE2" OFF) option(WITH_NEON "Enable NEON optimization." OFF) @@ -32,35 +32,45 @@ option(WITH_JPEG "Use JPEG decoding." OFF) include(CompilerDetect) 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) + 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() + 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) + option(WITH_WINMM "Use Windows Multimedia" ON) + option(WITH_WIN8 "Use Windows 8 libraries" OFF) endif() option(BUILD_TESTING "Build unit tests (compatible with packaging)" OFF) -CMAKE_DEPENDENT_OPTION(BUILD_TESTING_INTERNAL "Build unit tests (CI only, not for packaging!)" OFF "NOT BUILD_TESTING" OFF) -CMAKE_DEPENDENT_OPTION(TESTS_WTSAPI_EXTRA "Build extra WTSAPI tests (interactive)" OFF "BUILD_TESTING_INTERNAL" OFF) -CMAKE_DEPENDENT_OPTION(BUILD_COMM_TESTS "Build comm related tests (require comm port)" OFF "BUILD_TESTING_INTERNAL" OFF) +cmake_dependent_option( + BUILD_TESTING_INTERNAL "Build unit tests (CI only, not for packaging!)" OFF "NOT BUILD_TESTING" OFF +) +cmake_dependent_option(TESTS_WTSAPI_EXTRA "Build extra WTSAPI tests (interactive)" OFF "BUILD_TESTING_INTERNAL" OFF) +cmake_dependent_option(BUILD_COMM_TESTS "Build comm related tests (require comm port)" OFF "BUILD_TESTING_INTERNAL" 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) +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) @@ -68,33 +78,39 @@ 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_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) +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) + 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) -CMAKE_DEPENDENT_OPTION(CLIENT_INTERFACE_SHARED "Build clients as a shared library with an interface" OFF "WITH_CLIENT_INTERFACE" OFF) +cmake_dependent_option( + CLIENT_INTERFACE_SHARED "Build clients as a shared library with an interface" OFF "WITH_CLIENT_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") + 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") + 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!") + 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}) @@ -102,22 +118,24 @@ option(WITH_DEBUG_CLIPRDR "Print clipboard redirection debug messages" ${DEFAULT 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) +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!") + 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!") + 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!") + 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!") + 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}) @@ -144,106 +162,96 @@ option(WITH_CLANG_FORMAT "Detect clang-format. run 'cmake --build . --target cla 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) +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) +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) +if(ANDROID) + include(ConfigOptionsAndroid) endif(ANDROID) -if (IOS) - include(ConfigOptionsiOS) +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}) +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() - -}) +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(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_INTERNAL ON CACHE BOOL "fuzzer default" FORCE) - - 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 - $<$>: - -fsanitize=fuzzer - > - $<$: - ${CXX} - ${CXXFLAGS} - > - ) - target_link_libraries( - fuzzer_config - INTERFACE - $<$>: - -fsanitize=fuzzer - > - $<$: - $ENV{LIB_FUZZING_ENGINE} - > + 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_INTERNAL ON CACHE BOOL "fuzzer default" FORCE) + + 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 $<$>: + -fsanitize=fuzzer + > + $<$: + ${CXX} + ${CXXFLAGS} + > + ) + target_link_libraries( + fuzzer_config INTERFACE $<$>: -fsanitize=fuzzer > $<$: + $ENV{LIB_FUZZING_ENGINE} > + ) endif() -option(WITH_FULL_CONFIG_PATH "Use /Vendor/Product instead of /product (lowercase, only if vendor equals product) as config directory" OFF) +option( + WITH_FULL_CONFIG_PATH + "Use /Vendor/Product instead of /product (lowercase, only if vendor equals product) as config directory" + OFF +) # Configuration settings for manpages -if (NOT WITH_FULL_CONFIG_PATH AND "${VENDOR}" STREQUAL "${PRODUCT}") - string(TOLOWER "${VENDOR}" VENDOR_PRODUCT) +if(NOT WITH_FULL_CONFIG_PATH AND "${VENDOR}" STREQUAL "${PRODUCT}") + string(TOLOWER "${VENDOR}" VENDOR_PRODUCT) else() - set(VENDOR_PRODUCT "${VENDOR}/${PRODUCT}") + set(VENDOR_PRODUCT "${VENDOR}/${PRODUCT}") endif() diff --git a/cmake/ConfigOptionsiOS.cmake b/cmake/ConfigOptionsiOS.cmake index 16f626765..a167a10bc 100644 --- a/cmake/ConfigOptionsiOS.cmake +++ b/cmake/ConfigOptionsiOS.cmake @@ -15,11 +15,11 @@ # 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") +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") + set(IOS_TARGET_SDK 12.0 CACHE STRING "Application target iOS SDK") endif() diff --git a/cmake/ConfigureFreeRDP.cmake b/cmake/ConfigureFreeRDP.cmake index 419667e7c..7b8ef8285 100644 --- a/cmake/ConfigureFreeRDP.cmake +++ b/cmake/ConfigureFreeRDP.cmake @@ -1,10 +1,10 @@ -if (NOT FREERDP_UNIFIED_BUILD) - find_package(WinPR 3 REQUIRED) - include_directories(SYSTEM ${WinPR_INCLUDE_DIR}) +if(NOT FREERDP_UNIFIED_BUILD) + find_package(WinPR 3 REQUIRED) + include_directories(SYSTEM ${WinPR_INCLUDE_DIR}) - find_package(FreeRDP 3 REQUIRED) - include_directories(SYSTEM ${FreeRDP_INCLUDE_DIR}) + find_package(FreeRDP 3 REQUIRED) + include_directories(SYSTEM ${FreeRDP_INCLUDE_DIR}) - find_package(FreeRDP-Client 3 REQUIRED) - include_directories(SYSTEM ${FreeRDP-Client_INCLUDE_DIR}) + find_package(FreeRDP-Client 3 REQUIRED) + include_directories(SYSTEM ${FreeRDP-Client_INCLUDE_DIR}) endif() diff --git a/cmake/ConfigureRPATH.cmake b/cmake/ConfigureRPATH.cmake index 284511f62..0082d13de 100644 --- a/cmake/ConfigureRPATH.cmake +++ b/cmake/ConfigureRPATH.cmake @@ -3,22 +3,24 @@ option(CMAKE_SKIP_BUILD_RPATH "skip build RPATH" OFF) option(CMAKE_BUILD_WITH_INSTALL_RPATH "build with install RPATH" OFF) option(CMAKE_INSTALL_RPATH_USE_LINK_PATH "build with link RPATH" OFF) -if (APPLE) - if (BUILD_SHARED_LIBS) - option(CMAKE_MACOSX_RPATH "MacOSX RPATH" ON) - endif() +if(APPLE) + if(BUILD_SHARED_LIBS) + option(CMAKE_MACOSX_RPATH "MacOSX RPATH" ON) + endif() - file(RELATIVE_PATH FRAMEWORK_PATH ${CMAKE_INSTALL_FULL_BINDIR} ${CMAKE_INSTALL_FULL_LIBDIR}) - set(CFG_INSTALL_RPATH "@loader_path/${FRAMEWORK_PATH}") + file(RELATIVE_PATH FRAMEWORK_PATH ${CMAKE_INSTALL_FULL_BINDIR} ${CMAKE_INSTALL_FULL_LIBDIR}) + set(CFG_INSTALL_RPATH "@loader_path/${FRAMEWORK_PATH}") elseif(NOT WIN32) - if (NOT FREEBSD) - option(WITH_ADD_PLUGIN_TO_RPATH "Add extension and plugin path to RPATH" OFF) - if (WITH_ADD_PLUGIN_TO_RPATH) - set(CFG_INSTALL_RPATH "\$ORIGIN/../${FREERDP_EXTENSION_REL_PATH}:\$ORIGIN/../${FREERDP_PLUGIN_PATH}:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}:\$ORIGIN/..") - else() - set(CFG_INSTALL_RPATH "\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}:\$ORIGIN/..") - endif() - endif() + if(NOT FREEBSD) + option(WITH_ADD_PLUGIN_TO_RPATH "Add extension and plugin path to RPATH" OFF) + if(WITH_ADD_PLUGIN_TO_RPATH) + set(CFG_INSTALL_RPATH + "\$ORIGIN/../${FREERDP_EXTENSION_REL_PATH}:\$ORIGIN/../${FREERDP_PLUGIN_PATH}:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}:\$ORIGIN/.." + ) + else() + set(CFG_INSTALL_RPATH "\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}:\$ORIGIN/..") + endif() + endif() endif(APPLE) set(CMAKE_INSTALL_RPATH ${CFG_INSTALL_RPATH} CACHE INTERNAL "ConfigureRPATH") diff --git a/cmake/ConvertFileToHexArray.cmake b/cmake/ConvertFileToHexArray.cmake index 3a54ddfb3..48c47f113 100644 --- a/cmake/ConvertFileToHexArray.cmake +++ b/cmake/ConvertFileToHexArray.cmake @@ -1,16 +1,16 @@ function(file_to_hex_array FILE DATA) - # Read the ASCII file as hex. - file(READ "${FILE}" HEX_CONTENTS HEX) + # Read the ASCII file as hex. + file(READ "${FILE}" HEX_CONTENTS HEX) - # Separate into individual bytes. - string(REGEX MATCHALL "([A-Za-z0-9][A-Za-z0-9])" SEPARATED_HEX "${HEX_CONTENTS}") + # Separate into individual bytes. + string(REGEX MATCHALL "([A-Za-z0-9][A-Za-z0-9])" SEPARATED_HEX "${HEX_CONTENTS}") - # Append the "0x" to each byte. - list(JOIN SEPARATED_HEX ", 0x" FORMATTED_HEX) + # Append the "0x" to each byte. + list(JOIN SEPARATED_HEX ", 0x" FORMATTED_HEX) - # JOIN misses the first byte's "0x", so add it here. - string(PREPEND FORMATTED_HEX "0x") + # JOIN misses the first byte's "0x", so add it here. + string(PREPEND FORMATTED_HEX "0x") - # Set the variable named by DATA argument to the formatted hex string. - set(${DATA} ${FORMATTED_HEX} PARENT_SCOPE) + # Set the variable named by DATA argument to the formatted hex string. + set(${DATA} ${FORMATTED_HEX} PARENT_SCOPE) endfunction() diff --git a/cmake/DetectIntrinsicSupport.cmake b/cmake/DetectIntrinsicSupport.cmake index a25b916ab..ed50c6453 100644 --- a/cmake/DetectIntrinsicSupport.cmake +++ b/cmake/DetectIntrinsicSupport.cmake @@ -1,45 +1,44 @@ include(CheckSymbolExists) -check_symbol_exists("__i586__" "" X86_i586) -check_symbol_exists("__i686__" "" X86_i686) -check_symbol_exists("__X86__" "" X86_X86) -check_symbol_exists("_X86_" "" X86_X862) -check_symbol_exists("__I86__" "" X86_I86) -check_symbol_exists("__IA32__" "" X86_IA32) -check_symbol_exists("_M_IX86" "" X86_M_IX86) -check_symbol_exists("__amd64" "" X86_AMD64) -check_symbol_exists("__amd64__" "" X86_AMD642) -check_symbol_exists("__x86_64" "" X86_X86_64) -check_symbol_exists("__x86_64__" "" X86_X86_642) -check_symbol_exists("_M_X64" "" X86_X64) -check_symbol_exists("__ia64" "" X86_IA64) -check_symbol_exists("__ia64__" "" X86_IA642) -check_symbol_exists("_M_IA64" "" X86_M_IA64) -check_symbol_exists("_M_ARM64" "" MSVC_ARM64) -check_symbol_exists("__aarch64__" "" ARCH_ARM64) +check_symbol_exists("__i586__" "" X86_i586) +check_symbol_exists("__i686__" "" X86_i686) +check_symbol_exists("__X86__" "" X86_X86) +check_symbol_exists("_X86_" "" X86_X862) +check_symbol_exists("__I86__" "" X86_I86) +check_symbol_exists("__IA32__" "" X86_IA32) +check_symbol_exists("_M_IX86" "" X86_M_IX86) +check_symbol_exists("__amd64" "" X86_AMD64) +check_symbol_exists("__amd64__" "" X86_AMD642) +check_symbol_exists("__x86_64" "" X86_X86_64) +check_symbol_exists("__x86_64__" "" X86_X86_642) +check_symbol_exists("_M_X64" "" X86_X64) +check_symbol_exists("__ia64" "" X86_IA64) +check_symbol_exists("__ia64__" "" X86_IA642) +check_symbol_exists("_M_IA64" "" X86_M_IA64) +check_symbol_exists("_M_ARM64" "" MSVC_ARM64) +check_symbol_exists("__aarch64__" "" ARCH_ARM64) check_symbol_exists("M_ARM" "" ARCH_M_ARM) check_symbol_exists("_arm__" "" ARCH_ARM) check_symbol_exists("_thumb__" "" ARCH_THUMB) check_symbol_exists("_TARGET_ARCH_ARM" "" ARCH_ARM_TARGET) check_symbol_exists("_TARGET_ARCH_THUMB" "" ARCH_ARM_TARGET_THUMB) - -if (X86_i586 OR X86_i686 OR X86_X86 OR X86_X862 OR X86_I86 OR X86_IA32 OR - X86_M_IX86 OR X86_AMD64 OR X86_AMD642 OR X86_X86_64 OR X86_X86_642 OR - X86_X64 OR X86_IA64 OR X86_IA642 OR X86_M_IA64) - set(HAVE_SSE_OR_AVX ON CACHE INTERNAL "internal") +if(X86_i586 OR X86_i686 OR X86_X86 OR X86_X862 OR X86_I86 OR X86_IA32 OR X86_M_IX86 OR X86_AMD64 OR X86_AMD642 + OR X86_X86_64 OR X86_X86_642 OR X86_X64 OR X86_IA64 OR X86_IA642 OR X86_M_IA64 +) + set(HAVE_SSE_OR_AVX ON CACHE INTERNAL "internal") else() - set(HAVE_SSE_OR_AVX OFF CACHE INTERNAL "internal") + set(HAVE_SSE_OR_AVX OFF CACHE INTERNAL "internal") endif() -if (MSVC_ARM64 OR ARCH_ARM64 OR ARCH_M_ARM OR ARCH_ARM OR ARCH_THUMB OR ARCH_ARM_TARGET OR ARCH_ARM_TARGET_THUMB) - set(HAVE_NEON ON CACHE INTERNAL "internal") +if(MSVC_ARM64 OR ARCH_ARM64 OR ARCH_M_ARM OR ARCH_ARM OR ARCH_THUMB OR ARCH_ARM_TARGET OR ARCH_ARM_TARGET_THUMB) + set(HAVE_NEON ON CACHE INTERNAL "internal") else() - set(HAVE_NEON OFF CACHE INTERNAL "internal") + set(HAVE_NEON OFF CACHE INTERNAL "internal") endif() -if (MSVC_ARM64 OR ARCH_ARM64) - set(HAVE_NEON64 ON CACHE INTERNAL "internal") +if(MSVC_ARM64 OR ARCH_ARM64) + set(HAVE_NEON64 ON CACHE INTERNAL "internal") else() - set(HAVE_NEON64 OFF CACHE INTERNAL "internal") + set(HAVE_NEON64 OFF CACHE INTERNAL "internal") endif() diff --git a/cmake/DisableCompilerWarnings.cmake b/cmake/DisableCompilerWarnings.cmake index de7de5fda..d08b721f8 100644 --- a/cmake/DisableCompilerWarnings.cmake +++ b/cmake/DisableCompilerWarnings.cmake @@ -1,21 +1,18 @@ -if (MSVC) - set(COMPILE_WARN_OPTS "/W0") +if(MSVC) + set(COMPILE_WARN_OPTS "/W0") else() - set(COMPILE_WARN_OPTS "-w") + set(COMPILE_WARN_OPTS "-w") endif() set(COMPILE_WARN_OPTS "${COMPILE_WARN_OPTS}" CACHE STRING "cached value") -function (disable_warnings_for_directory dir) - if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.19.0") - set_property( - DIRECTORY "${dir}" - PROPERTY COMPILE_OPTIONS ${COMPILE_WARN_OPTS} - ) - endif() +function(disable_warnings_for_directory dir) + if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.19.0") + set_property(DIRECTORY "${dir}" PROPERTY COMPILE_OPTIONS ${COMPILE_WARN_OPTS}) + endif() - file(MAKE_DIRECTORY "${dir}") - set(ctidy "${dir}/.clang-tidy") - file(WRITE ${ctidy} "Checks: '-*,misc-definitions-in-headers'\n") - file(APPEND ${ctidy} "CheckOptions:\n") - file(APPEND ${ctidy} "\t- { key: HeaderFileExtensions, value: \"x\" }\n") + file(MAKE_DIRECTORY "${dir}") + set(ctidy "${dir}/.clang-tidy") + file(WRITE ${ctidy} "Checks: '-*,misc-definitions-in-headers'\n") + file(APPEND ${ctidy} "CheckOptions:\n") + file(APPEND ${ctidy} "\t- { key: HeaderFileExtensions, value: \"x\" }\n") endfunction() diff --git a/cmake/Doxygen.cmake b/cmake/Doxygen.cmake index 0d954b953..0e1888ef3 100644 --- a/cmake/Doxygen.cmake +++ b/cmake/Doxygen.cmake @@ -1,29 +1,21 @@ option(WITH_DOCUMENTATION "Add target to build doxygen documentation" OFF) -if (WITH_DOCUMENTATION) - if (CMAKE_VERSION VERSION_LESS "3.27") - message(WARNING "Building with CMake ${CMAKE_VERSION} but >= 3.27 required for doxygen target") - else() - include (FindDoxygen) - find_package(Doxygen - REQUIRED dot - OPTIONAL_COMPONENTS mscgen dia) +if(WITH_DOCUMENTATION) + if(CMAKE_VERSION VERSION_LESS "3.27") + message(WARNING "Building with CMake ${CMAKE_VERSION} but >= 3.27 required for doxygen target") + else() + include(FindDoxygen) + find_package(Doxygen REQUIRED dot OPTIONAL_COMPONENTS mscgen dia) - set(DOXYGEN_PROJECT_NAME ${PROJECT_NAME}) - set(DOXYGEN_PROJECT_NUMBER ${PROJECT_VERSION}) - set(DOXYGEN_EXCLUDE_PATTERNS "*/uwac/protocols/*") - set(DOXYGEN_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/docs") + set(DOXYGEN_PROJECT_NAME ${PROJECT_NAME}) + set(DOXYGEN_PROJECT_NUMBER ${PROJECT_VERSION}) + set(DOXYGEN_EXCLUDE_PATTERNS "*/uwac/protocols/*") + set(DOXYGEN_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/docs") - doxygen_add_docs( - docs - "${CMAKE_SOURCE_DIR}" - ALL - COMMENT "Generate doxygen docs" - WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/docs" - CONFIG_FILE "${CMAKE_SOURCE_DIR}/docs/Doxyfile" - ) - install(DIRECTORY "${CMAKE_SOURCE_DIR}/docs/api" - DESTINATION ${CMAKE_INSTALL_DOCDIR} - ) - endif() + doxygen_add_docs( + docs "${CMAKE_SOURCE_DIR}" ALL COMMENT "Generate doxygen docs" + WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/docs" CONFIG_FILE "${CMAKE_SOURCE_DIR}/docs/Doxyfile" + ) + install(DIRECTORY "${CMAKE_SOURCE_DIR}/docs/api" DESTINATION ${CMAKE_INSTALL_DOCDIR}) + endif() endif() diff --git a/cmake/EchoTarget.cmake b/cmake/EchoTarget.cmake index 12759256b..1daa877f2 100644 --- a/cmake/EchoTarget.cmake +++ b/cmake/EchoTarget.cmake @@ -1,178 +1,177 @@ 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() + # 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() + 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 - ) + 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("") + 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() + set(tgts ${ARGV}) + foreach(t ${tgts}) + echo_target("${t}") + endforeach() endfunction() - diff --git a/cmake/FindCairo.cmake b/cmake/FindCairo.cmake index 164b70629..c9ec7f072 100644 --- a/cmake/FindCairo.cmake +++ b/cmake/FindCairo.cmake @@ -25,117 +25,60 @@ find_package(PkgConfig) if(PKG_CONFIG_FOUND) - pkg_check_modules(_CAIRO cairo) -endif (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} - ) +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" +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) +if(NOT PKGCONFIG_FOUND AND WIN32 AND NOT CYGWIN) # MINGW should go here too - IF(MSVC) + if(MSVC) # Implementation details: # We are using the libraries located in the VC subdir instead of the parent directory even though : - FIND_LIBRARY(CAIRO_DEBUG - NAMES - cairod - ${_CAIRO_ROOT_HINTS_AND_PATHS} - PATH_SUFFIXES - "lib" - "VC" - "lib/VC" - ) + 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" - ) + 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} - ) + 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}) + set(CAIRO_LIBRARIES ${CAIRO_RELEASE}) endif() - MARK_AS_ADVANCED(CAIRO_DEBUG CAIRO_RELEASE) - ELSEIF(MINGW) + 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" - ) + 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) + 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 - ) + 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() + 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" + find_library( + CAIRO_LIBRARY NAMES cairo HINTS ${_CAIRO_LIBDIR} ${_CAIRO_ROOT_HINTS_AND_PATHS} PATH_SUFFIXES "lib" "local/lib" ) - MARK_AS_ADVANCED(CAIRO_LIBRARY) + mark_as_advanced(CAIRO_LIBRARY) # compat defines - SET(CAIRO_LIBRARIES ${CAIRO_LIBRARY}) + set(CAIRO_LIBRARIES ${CAIRO_LIBRARY}) -ENDIF() +endif() #message( STATUS "Cairo_FIND_VERSION=${Cairo_FIND_VERSION}.") #message( STATUS "CAIRO_INCLUDE_DIR=${CAIRO_INCLUDE_DIR}.") @@ -143,24 +86,22 @@ ENDIF() # 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}) + 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") + 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 -) +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) +mark_as_advanced(CAIRO_INCLUDE_DIR CAIRO_LIBRARIES) diff --git a/cmake/FindFAAC.cmake b/cmake/FindFAAC.cmake index 61e0d2747..0f2d262d7 100644 --- a/cmake/FindFAAC.cmake +++ b/cmake/FindFAAC.cmake @@ -1,4 +1,3 @@ - find_path(FAAC_INCLUDE_DIR faac.h) find_library(FAAC_LIBRARY faac) @@ -6,8 +5,8 @@ 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}) + 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 index d9387de49..125d328e5 100644 --- a/cmake/FindFAAD2.cmake +++ b/cmake/FindFAAD2.cmake @@ -1,4 +1,3 @@ - find_path(FAAD2_INCLUDE_DIR faad.h) find_library(FAAD2_LIBRARY faad) @@ -6,8 +5,8 @@ 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}) + 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 index f3d4a1624..0e5f7bec7 100644 --- a/cmake/FindFFmpeg.cmake +++ b/cmake/FindFFmpeg.cmake @@ -56,7 +56,16 @@ else() set(_FFmpeg_REQUIRED_VERSION 0) endif() -set(_FFmpeg_ALL_COMPONENTS AVCODEC AVDEVICE AVFORMAT AVFILTER AVUTIL POSTPROCESS SWSCALE SWRESAMPLE) +set(_FFmpeg_ALL_COMPONENTS + AVCODEC + AVDEVICE + AVFORMAT + AVFILTER + AVUTIL + POSTPROCESS + SWSCALE + SWRESAMPLE +) # # ## Macro: set_component_found @@ -87,45 +96,30 @@ macro(find_component _component _pkgconfig _library _header) endif() endif(NOT WIN32) - find_path(${_component}_INCLUDE_DIRS ${_header} - HINTS - ${PC_LIB${_component}_INCLUDEDIR} - ${PC_LIB${_component}_INCLUDE_DIRS} - PATH_SUFFIXES - ffmpeg + find_path(${_component}_INCLUDE_DIRS ${_header} HINTS ${PC_LIB${_component}_INCLUDEDIR} + ${PC_LIB${_component}_INCLUDE_DIRS} PATH_SUFFIXES ffmpeg ) - find_library(${_component}_LIBRARIES NAMES ${_library} - HINTS - ${PC_LIB${_component}_LIBDIR} - ${PC_LIB${_component}_LIBRARY_DIRS} + find_library( + ${_component}_LIBRARIES NAMES ${_library} HINTS ${PC_LIB${_component}_LIBDIR} ${PC_LIB${_component}_LIBRARY_DIRS} ) set(${_component}_DEFINITIONS ${PC_${_component}_CFLAGS_OTHER} CACHE STRING "The ${_component} CFLAGS.") # Fallback version detection: # Read version.h (and version_major.h if it exists) and try to extract the version - if ("${PC_${_component}_VERSION}_" STREQUAL "_") - get_filename_component(${_component}_suffix - "${_header}" - DIRECTORY + if("${PC_${_component}_VERSION}_" STREQUAL "_") + get_filename_component(${_component}_suffix "${_header}" DIRECTORY) + find_file(${_component}_hdr_version_major NAMES version_major.h PATH_SUFFIXES ${${_component}_suffix} + HINTS ${${_component}_INCLUDE_DIRS} ) - find_file(${_component}_hdr_version_major - NAMES version_major.h - PATH_SUFFIXES ${${_component}_suffix} - HINTS - ${${_component}_INCLUDE_DIRS} + find_file(${_component}_hdr_version NAMES version.h PATH_SUFFIXES ${${_component}_suffix} + HINTS ${${_component}_INCLUDE_DIRS} ) - find_file(${_component}_hdr_version - NAMES version.h - PATH_SUFFIXES ${${_component}_suffix} - HINTS - ${${_component}_INCLUDE_DIRS} - ) - if (NOT ${${_component}_hdr_version} MATCHES ".*-NOTFOUND") + if(NOT ${${_component}_hdr_version} MATCHES ".*-NOTFOUND") file(READ "${${_component}_hdr_version}" ${_component}_version_text) endif() - if (NOT ${${_component}_hdr_version_major} MATCHES ".*-NOTFOUND") + if(NOT ${${_component}_hdr_version_major} MATCHES ".*-NOTFOUND") file(READ "${${_component}_hdr_version_major}" ${_component}_version_major_text) else() set(${_component}_version_major_text "${${_component}_version_text}") @@ -138,18 +132,17 @@ macro(find_component _component _pkgconfig _library _header) string(REGEX MATCH "#define[ \t]+.*_VERSION_MICRO[ \t]+([0-9]+)" _ "${${_component}_version_text}") set(${_component}_version_micro ${CMAKE_MATCH_1}) - set(${_component}_VERSION "${${_component}_version_major}.${${_component}_version_minor}.${${_component}_version_micro}" CACHE STRING "The ${_component} version number.") + set(${_component}_VERSION + "${${_component}_version_major}.${${_component}_version_minor}.${${_component}_version_micro}" + CACHE STRING "The ${_component} version number." + ) else() set(${_component}_VERSION ${PC_${_component}_VERSION} CACHE STRING "The ${_component} version number.") endif() set_component_found(${_component}) - mark_as_advanced( - ${_component}_INCLUDE_DIRS - ${_component}_LIBRARIES - ${_component}_DEFINITIONS - ${_component}_VERSION) + mark_as_advanced(${_component}_INCLUDE_DIRS ${_component}_LIBRARIES ${_component}_DEFINITIONS ${_component}_VERSION) endmacro() # Check for cached results. If there are skip the costly part. @@ -183,9 +176,7 @@ if(NOT FFMPEG_LIBRARIES) set(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} CACHE STRING "The FFmpeg libraries." FORCE) set(FFMPEG_DEFINITIONS ${FFMPEG_DEFINITIONS} CACHE STRING "The FFmpeg cflags." FORCE) - mark_as_advanced(FFMPEG_INCLUDE_DIRS - FFMPEG_LIBRARIES - FFMPEG_DEFINITIONS) + mark_as_advanced(FFMPEG_INCLUDE_DIRS FFMPEG_LIBRARIES FFMPEG_DEFINITIONS) else() # Set the noncached _FOUND vars for the components. @@ -214,6 +205,4 @@ endforeach() list(INSERT _FFmpeg_REQUIRED_VARS 0 _FFmpeg_FOUND_LIBRARIES) # Give a nice error message if some of the required vars are missing. -find_package_handle_standard_args(FFmpeg - REQUIRED_VARS ${_FFmpeg_REQUIRED_VARS} - HANDLE_COMPONENTS) +find_package_handle_standard_args(FFmpeg REQUIRED_VARS ${_FFmpeg_REQUIRED_VARS} HANDLE_COMPONENTS) diff --git a/cmake/FindFeature.cmake b/cmake/FindFeature.cmake index 63c4b6fed..11bd9f1b1 100644 --- a/cmake/FindFeature.cmake +++ b/cmake/FindFeature.cmake @@ -4,61 +4,61 @@ include(FeatureSummary) macro(find_feature _feature _type _purpose _description) - string(TOUPPER ${_feature} _feature_upper) - string(TOLOWER ${_type} _type_lower) + 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(${_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() + 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}) + option(WITH_${_feature_upper} "Enable feature ${_feature} for ${_purpose}" ${_feature_default}) - set_package_properties(${_feature} PROPERTIES - TYPE ${_type} - PURPOSE "${_purpose}" - DESCRIPTION "${_description}") - endif() + 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 index 366fd6764..c2078fd44 100644 --- a/cmake/FindGSM.cmake +++ b/cmake/FindGSM.cmake @@ -1,4 +1,3 @@ - find_path(GSM_INCLUDE_DIR gsm/gsm.h) find_library(GSM_LIBRARY gsm) @@ -6,8 +5,8 @@ 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}) + 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/FindJSONC.cmake b/cmake/FindJSONC.cmake index 464f0359c..68ccc7359 100644 --- a/cmake/FindJSONC.cmake +++ b/cmake/FindJSONC.cmake @@ -7,21 +7,18 @@ find_package(PkgConfig) if(PKG_CONFIG_FOUND) - pkg_check_modules(PC_JSONC json-c) + pkg_check_modules(PC_JSONC json-c) endif() -find_path(JSONC_INCLUDE_DIR NAMES json.h - HINTS ${PC_JSONC_INCLUDE_DIRS} - PATH_SUFFIXES json-c) -find_library(JSONC_LIBRARY NAMES json-c - HINTS ${PC_JSONC_LIBRARY_DIRS}) +find_path(JSONC_INCLUDE_DIR NAMES json.h HINTS ${PC_JSONC_INCLUDE_DIRS} PATH_SUFFIXES json-c) +find_library(JSONC_LIBRARY NAMES json-c HINTS ${PC_JSONC_LIBRARY_DIRS}) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(JSONC DEFAULT_MSG JSONC_LIBRARY JSONC_INCLUDE_DIR) if(JSONC_FOUND) - set(JSONC_LIBRARIES ${JSONC_LIBRARY}) - set(JSONC_INCLUDE_DIRS ${JSONC_INCLUDE_DIR}) + set(JSONC_LIBRARIES ${JSONC_LIBRARY}) + set(JSONC_INCLUDE_DIRS ${JSONC_INCLUDE_DIR}) endif() mark_as_advanced(JSONC_LIBRARY JSONC_INCLUDE_DIR) diff --git a/cmake/FindKRB5.cmake b/cmake/FindKRB5.cmake index 7c96e85ba..ee627089b 100644 --- a/cmake/FindKRB5.cmake +++ b/cmake/FindKRB5.cmake @@ -19,46 +19,34 @@ include(CheckIncludeFile) include(CheckIncludeFiles) include(CheckTypeSize) -set(_KRB5_REQUIRED_VARS - KRB5_FOUND - KRB5_VERSION - KRB5_FLAVOUR - KRB5_INCLUDE_DIRS - KRB5_LIBRARIES) +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}) + 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") + 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}) + 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) + 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() @@ -76,80 +64,70 @@ function(string_starts_with str search RES) endfunction() function(GET_KRB5_BY_CONFIG KRB5_CONFIG) - if (NOT KRB5_CONFIG) - find_program(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}") - if (NOT KRB5_CONFIG) - return() - endif() + if(NOT KRB5_CONFIG) + find_program( + 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}") + if(NOT KRB5_CONFIG) + return() + endif() else() - message("using krb5-config ${KRB5_CONFIG} provided by KRB5_ROOT_CONFIG") + message("using krb5-config ${KRB5_CONFIG} provided by KRB5_ROOT_CONFIG") endif() - GET_KRB5_CONFIG("${KRB5_CONFIG}" "--vendor" _KRB5_VENDOR) + get_krb5_config("${KRB5_CONFIG}" "--vendor" _KRB5_VENDOR) - if ("${_KRB5_VENDOR}" STREQUAL "Apple MITKerberosShim") + if("${_KRB5_VENDOR}" STREQUAL "Apple MITKerberosShim") message(FATAL_ERROR "Apple MITKerberosShim is deprecated and not supported") - elseif ("${_KRB5_VENDOR}" STREQUAL "Massachusetts Institute of Technology") + 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) + 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") + 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) + 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) + if(RES) string(SUBSTRING "${FLAG}" 2 -1 FLAG) endif() - if (IS_DIRECTORY "${FLAG}") + if(IS_DIRECTORY "${FLAG}") list(APPEND KRB5_INCLUDEDIR ${FLAG}) endif() endforeach() - if (NOT KRB5_INCLUDEDIR) - find_file(KRB5_INCLUDEDIR_HEADER - NAMES krb5.h - REQUIRED - ) + 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) + if(RES) string(SUBSTRING "${FLAG}" 2 -1 SUBFLAG) list(APPEND KRB5_LIBRARY_DIRS ${SUBFLAG}) endif() string_starts_with("${FLAG}" "-l" RES) - if (RES) + if(RES) string(SUBSTRING "${FLAG}" 2 -1 SUBFLAG) list(APPEND KRB5_LIBRARIES ${SUBFLAG}) endif() @@ -172,33 +150,33 @@ endfunction() # * Then try to find krb5-config (generic, krb5-config.mit and last krb5-config.heimdal) find_package(PkgConfig REQUIRED) -if (KRB5_ROOT_CONFIG) +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) +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") + 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") +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") + provides_krb5(NAME "Heimdal") elseif(KRB5_ANY_FOUND) - GET_KRB5_VENDOR(ANY_VENDOR) - PROVIDES_KRB5(NAME "${ANY_VENDOR}") + get_krb5_vendor(ANY_VENDOR) + provides_krb5(NAME "${ANY_VENDOR}") else() - GET_KRB5_BY_CONFIG("${KRB5_ROOT_CONFIG}") + get_krb5_by_config("${KRB5_ROOT_CONFIG}") endif() message("using KRB5_FOUND ${KRB5_FOUND} ") @@ -212,13 +190,9 @@ 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" +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 index 0fec8e8fb..9ba4225a0 100644 --- a/cmake/FindLAME.cmake +++ b/cmake/FindLAME.cmake @@ -1,13 +1,12 @@ - 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}) +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 index ceb6cfb43..8d57768de 100644 --- a/cmake/FindMbedTLS.cmake +++ b/cmake/FindMbedTLS.cmake @@ -1,38 +1,24 @@ +find_path(MBEDTLS_INCLUDE_DIR NAMES mbedtls/ssl.h PATH_SUFFIXES include HINTS ${MBEDTLS_ROOT}) -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(MBEDTLS_LIBRARY - NAMES mbedtls - PATH_SUFFIXES lib - HINTS ${MBEDTLS_ROOT}) +find_library(MBEDCRYPTO_LIBRARY NAMES mbedcrypto 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}) +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}) + 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() + 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() + 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 index a750db65e..e58254048 100644 --- a/cmake/FindOSS.cmake +++ b/cmake/FindOSS.cmake @@ -2,42 +2,33 @@ # 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(PLATFORM_PREFIX "linux/") - ELSEIF(CMAKE_SYSTEM_NAME MATCHES "FreeBSD") - set(PLATFORM_PREFIX "sys/") - ELSEIF(CMAKE_SYSTEM_NAME MATCHES "OpenBSD") - set(PLATFORM_PREFIX "machine/") - ENDIF() -ENDIF(UNIX) +if(UNIX) + if(CMAKE_SYSTEM_NAME MATCHES "Linux") + set(PLATFORM_PREFIX "linux/") + elseif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD") + set(PLATFORM_PREFIX "sys/") + elseif(CMAKE_SYSTEM_NAME MATCHES "OpenBSD") + set(PLATFORM_PREFIX "machine/") + endif() +endif(UNIX) set(OSS_HDR_NAME "${PLATFORM_PREFIX}soundcard.h" CACHE STRING "oss header include file name") -FIND_PATH(OSS_INCLUDE_DIRS ${OSS_HDR_NAME} - PATHS - "/usr/local/include" - PATH_SUFFIXES - ${PLATFORM_SUFFIX} -) +find_path(OSS_INCLUDE_DIRS ${OSS_HDR_NAME} PATHS "/usr/local/include" PATH_SUFFIXES ${PLATFORM_SUFFIX}) -IF(OSS_INCLUDE_DIRS) - SET(OSS_FOUND ON CACHE BOOL "oss detection status") -ELSE(OSS_INCLUDE_DIRS) - SET(OSS_FOUND OFF CACHE BOOL "oss detection status") -ENDIF(OSS_INCLUDE_DIRS) +if(OSS_INCLUDE_DIRS) + set(OSS_FOUND ON CACHE BOOL "oss detection status") +else(OSS_INCLUDE_DIRS) + set(OSS_FOUND OFF CACHE BOOL "oss detection status") +endif(OSS_INCLUDE_DIRS) -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) +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_HDR_NAME - OSS_INCLUDE_DIRS -) +mark_as_advanced(OSS_FOUND OSS_HDR_NAME OSS_INCLUDE_DIRS) diff --git a/cmake/FindOpenH264.cmake b/cmake/FindOpenH264.cmake index 2efe2cd59..51b5a6332 100644 --- a/cmake/FindOpenH264.cmake +++ b/cmake/FindOpenH264.cmake @@ -7,40 +7,39 @@ # OPENH264_INCLUDE_DIR - the OpenH264 include directory # OPENH264_LIBRARIES - libopenh264 library -if (UNIX AND NOT ANDROID) +if(UNIX AND NOT ANDROID) find_package(PkgConfig QUIET) pkg_check_modules(PC_OPENH264 QUIET openh264) -endif (UNIX AND NOT ANDROID) +endif(UNIX AND NOT ANDROID) -if (OPENH264_INCLUDE_DIR AND OPENH264_LIBRARY) - set(OPENH264_FIND_QUIETLY TRUE) -endif (OPENH264_INCLUDE_DIR AND OPENH264_LIBRARY) +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}) +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) +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_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) +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 index 033b274e4..466dcbbe9 100644 --- a/cmake/FindOpenSLES.cmake +++ b/cmake/FindOpenSLES.cmake @@ -13,16 +13,15 @@ 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) - +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}) + 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() + if(OpenSLES_FIND_REQUIRED) + message(FATAL_ERROR "Could NOT find OpenSLES") + endif() endif(OpenSLES_FOUND) mark_as_advanced(OpenSLES_INCLUDE_DIR OpenSLES_LIBRARY) diff --git a/cmake/FindPAM.cmake b/cmake/FindPAM.cmake index 1fdaa6cae..5ce7b23b1 100644 --- a/cmake/FindPAM.cmake +++ b/cmake/FindPAM.cmake @@ -5,36 +5,35 @@ # 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) +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(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(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) +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 index e0272420c..5309581f2 100644 --- a/cmake/FindPCSC.cmake +++ b/cmake/FindPCSC.cmake @@ -7,15 +7,12 @@ find_package(PkgConfig) if(PKG_CONFIG_FOUND) - pkg_check_modules(PC_PCSC QUIET libpcsclite) + 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_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}) +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) @@ -24,5 +21,3 @@ 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 index 70a53d1fd..acc6e6009 100644 --- a/cmake/FindPCSCWinPR.cmake +++ b/cmake/FindPCSCWinPR.cmake @@ -1,15 +1,8 @@ - -find_library(PCSC_WINPR_LIBRARY - NAMES libpcsc-winpr.a - PATHS - /opt/lib - /usr/lib - /usr/local/lib - ) +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}") + 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 index a19a684bb..372c5018d 100644 --- a/cmake/FindPixman.cmake +++ b/cmake/FindPixman.cmake @@ -33,9 +33,9 @@ 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}) + 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/FindV4L.cmake b/cmake/FindV4L.cmake index da1bb203e..0003fe84f 100644 --- a/cmake/FindV4L.cmake +++ b/cmake/FindV4L.cmake @@ -44,77 +44,54 @@ # HAVE_LINUX_VIDEODEV_H - If the v4l library provides the linux/videodev.h header file # HAVE_LINUX_VIDEODEV2_H - If the v4l library provides the linux/videodev2.h header file - set(_V4L_REQUIRED_VARS V4L_TARGETS V4L_TARGET V4L_convert_TARGET) set(_V4L_CACHE_VARS ${_V4L_REQUIRED_VARS} HAVE_LINUX_VIDEODEV_H HAVE_LINUX_VIDEODEV2_H) set(_V4L_ROOT_PATHS ${CMAKE_INSTALL_PREFIX}) -find_path(_V4L1_INCLUDE_DIRS - NAMES linux/videodev.h - HINTS _V4L_ROOT_PATHS - PATH_SUFFIXES include -) +find_path(_V4L1_INCLUDE_DIRS NAMES linux/videodev.h HINTS _V4L_ROOT_PATHS PATH_SUFFIXES include) if(_V4L1_INCLUDE_DIRS) - set(HAVE_LINUX_VIDEODEV_H 1) + set(HAVE_LINUX_VIDEODEV_H 1) endif() -find_path(_V4L2_INCLUDE_DIRS - NAMES linux/videodev2.h - HINTS _V4L_ROOT_PATHS - PATH_SUFFIXES include -) +find_path(_V4L2_INCLUDE_DIRS NAMES linux/videodev2.h HINTS _V4L_ROOT_PATHS PATH_SUFFIXES include) if(_V4L2_INCLUDE_DIRS) - set(HAVE_LINUX_VIDEODEV2_H 1) + set(HAVE_LINUX_VIDEODEV2_H 1) endif() if(_V4L1_INCLUDE_DIRS OR _V4L2_INCLUDE_DIRS) - find_library(_V4L1_LIBRARY - NAMES v4l1 - HINTS _V4L_ROOT_PATHS - PATH_SUFFIXES bin lib - ) - find_library(_V4L2_LIBRARY - NAMES v4l2 - HINTS _V4L_ROOT_PATHS - PATH_SUFFIXES bin lib - ) - find_library(_V4LCONVERT_LIBRARY - NAMES v4lconvert - HINTS _V4L_ROOT_PATHS - PATH_SUFFIXES bin lib - ) + find_library(_V4L1_LIBRARY NAMES v4l1 HINTS _V4L_ROOT_PATHS PATH_SUFFIXES bin lib) + find_library(_V4L2_LIBRARY NAMES v4l2 HINTS _V4L_ROOT_PATHS PATH_SUFFIXES bin lib) + find_library(_V4LCONVERT_LIBRARY NAMES v4lconvert HINTS _V4L_ROOT_PATHS PATH_SUFFIXES bin lib) endif() if(_V4L1_LIBRARY OR _V4L2_LIBRARY OR _V4LCONVERT_LIBRARY) - set(V4L_TARGETS ) - if(_V4L2_LIBRARY) - add_library(v4l2 UNKNOWN IMPORTED) - set_target_properties(v4l2 PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${_V4L2_INCLUDE_DIRS}" - IMPORTED_LOCATION "${_V4L2_LIBRARY}" - ) - set(V4L_TARGET v4l2) - list(APPEND V4L_TARGETS v4l2) - set(_V4L_INCLUDE_DIRS "${_V4L2_INCLUDE_DIRS}") - elseif(_V4L1_LIBRARY) - add_library(v4l1 UNKNOWN IMPORTED) - set_target_properties(v4l1 PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${_V4L1_INCLUDE_DIRS}" - IMPORTED_LOCATION "${_V4L1_LIBRARY}" - ) - set(V4L_TARGET v4l1) - list(APPEND V4L_TARGETS v4l1) - set(_V4L_INCLUDE_DIRS "${_V4L1_INCLUDE_DIRS}") - endif() - if(_V4LCONVERT_LIBRARY) - add_library(v4lconvert UNKNOWN IMPORTED) - set_target_properties(v4lconvert PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${_V4L_INCLUDE_DIRS}" - IMPORTED_LOCATION "${_V4LCONVERT_LIBRARY}" - ) - set(V4L_convert_TARGET v4lconvert) - list(APPEND V4L_TARGETS v4lconvert) - endif() + set(V4L_TARGETS) + if(_V4L2_LIBRARY) + add_library(v4l2 UNKNOWN IMPORTED) + set_target_properties( + v4l2 PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${_V4L2_INCLUDE_DIRS}" IMPORTED_LOCATION "${_V4L2_LIBRARY}" + ) + set(V4L_TARGET v4l2) + list(APPEND V4L_TARGETS v4l2) + set(_V4L_INCLUDE_DIRS "${_V4L2_INCLUDE_DIRS}") + elseif(_V4L1_LIBRARY) + add_library(v4l1 UNKNOWN IMPORTED) + set_target_properties( + v4l1 PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${_V4L1_INCLUDE_DIRS}" IMPORTED_LOCATION "${_V4L1_LIBRARY}" + ) + set(V4L_TARGET v4l1) + list(APPEND V4L_TARGETS v4l1) + set(_V4L_INCLUDE_DIRS "${_V4L1_INCLUDE_DIRS}") + endif() + if(_V4LCONVERT_LIBRARY) + add_library(v4lconvert UNKNOWN IMPORTED) + set_target_properties( + v4lconvert PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${_V4L_INCLUDE_DIRS}" IMPORTED_LOCATION + "${_V4LCONVERT_LIBRARY}" + ) + set(V4L_convert_TARGET v4lconvert) + list(APPEND V4L_TARGETS v4lconvert) + endif() endif() include(FindPackageHandleStandardArgs) diff --git a/cmake/FindWayland.cmake b/cmake/FindWayland.cmake index c95ccc93d..a9eca7480 100644 --- a/cmake/FindWayland.cmake +++ b/cmake/FindWayland.cmake @@ -28,48 +28,41 @@ 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) + 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_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_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_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}" -) +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) +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_path(XKBCOMMON_INCLUDE_DIR xkbcommon/xkbcommon.h HINTS ${XKBCOMMON_PC_INCLUDE_DIRS}) -find_library(XKBCOMMON_LIBS - NAMES xkbcommon - HINTS "${XKBCOMMON_PC_LIBRARY_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) +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 index ee00c782c..dde8f48f5 100644 --- a/cmake/Findlibsystemd.cmake +++ b/cmake/Findlibsystemd.cmake @@ -9,36 +9,29 @@ # 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}) + # 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_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_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) + 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) + 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() + 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 index c7f046d2f..35b135168 100644 --- a/cmake/Findlibusb-1.0.cmake +++ b/cmake/Findlibusb-1.0.cmake @@ -42,57 +42,36 @@ # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # - -if (LIBUSB_1_LIBRARIES AND LIBUSB_1_INCLUDE_DIRS) +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 +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 - ) + 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} -) + 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_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) + 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) + 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) + 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) +endif(LIBUSB_1_LIBRARIES AND LIBUSB_1_INCLUDE_DIRS) diff --git a/cmake/Findlodepng.cmake b/cmake/Findlodepng.cmake index 57484d683..2c3e14791 100644 --- a/cmake/Findlodepng.cmake +++ b/cmake/Findlodepng.cmake @@ -4,16 +4,14 @@ # lodepng_INCLUDE_DIRS - lodepng include directories # lodepng_LIBRARIES - lodepng libraries for linking -find_path(lodepng_INCLUDE_DIR - NAMES lodepng.h) +find_path(lodepng_INCLUDE_DIR NAMES lodepng.h) -find_library(lodepng_LIBRARY - NAMES lodepng) +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}) +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 index 8a19946cb..f8953057e 100644 --- a/cmake/Findsoxr.cmake +++ b/cmake/Findsoxr.cmake @@ -22,41 +22,35 @@ # SOXR_INCLUDE_DIR - the soxr include directory # SOXR_LIBRARIES - libsoxr library -if (UNIX AND NOT ANDROID) +if(UNIX AND NOT ANDROID) find_package(PkgConfig QUIET) pkg_check_modules(PC_SOXR QUIET soxr) -endif (UNIX AND NOT ANDROID) +endif(UNIX AND NOT ANDROID) -if (SOXR_INCLUDE_DIR AND SOXR_LIBRARY) - set(SOXR_FIND_QUIETLY TRUE) -endif (SOXR_INCLUDE_DIR AND SOXR_LIBRARY) +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}) +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) +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_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) +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 index 53e9fc970..a79484b6a 100644 --- a/cmake/GNUInstallDirsWrapper.cmake +++ b/cmake/GNUInstallDirsWrapper.cmake @@ -1,21 +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_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() + 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() + 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) + mark_as_advanced(CMAKE_INSTALL_BINDIR CMAKE_INSTALL_LIBDIR) endif() diff --git a/cmake/GenerateManpages.cmake b/cmake/GenerateManpages.cmake index 915d020f9..24b3d0c5d 100644 --- a/cmake/GenerateManpages.cmake +++ b/cmake/GenerateManpages.cmake @@ -12,37 +12,37 @@ file(WRITE ${CURRENT_BINARY_DIR}/${manpage} "${CONTENTS}") string(REPLACE " " ";" DEPS ${dependencies}) foreach(DEP IN LISTS DEPS) - get_filename_component(DNAME "${DEP}" NAME) - set(SRC_IN ${CURRENT_SOURCE_DIR}/${DEP}.in) - set(DST_IN ${CURRENT_BINARY_DIR}/${DEP}.in) - set(SRC ${CURRENT_SOURCE_DIR}/${DEP}) - set(BIN ${CURRENT_BINARY_DIR}/${DEP}) - set(DST ${CURRENT_BINARY_DIR}/${DNAME}) + get_filename_component(DNAME "${DEP}" NAME) + set(SRC_IN ${CURRENT_SOURCE_DIR}/${DEP}.in) + set(DST_IN ${CURRENT_BINARY_DIR}/${DEP}.in) + set(SRC ${CURRENT_SOURCE_DIR}/${DEP}) + set(BIN ${CURRENT_BINARY_DIR}/${DEP}) + set(DST ${CURRENT_BINARY_DIR}/${DNAME}) - if (EXISTS ${SRC_IN}) - message("using generated ${DST} from ${SRC_IN}") - cleaning_configure_file(${SRC_IN} ${DST} @ONLY IMMEDIATE) - elseif (EXISTS ${DST_IN}) - message("using generated ${DST} from ${DST_IN}") - cleaning_configure_file(${DST_IN} ${DST} @ONLY IMMEDIATE) - elseif (EXISTS ${SRC}) - set(DST ${SRC}) - message("using ${DST}") - elseif (EXISTS ${BIN}) - set(DST ${BIN}) - message("using ${DST}") - elseif (EXISTS ${DST}) - message("using ${DST}") - else() - message(WARNING "Missing manpage section, considered:") - message(WARNING " ${SRC_IN}") - message(WARNING " ${DST_IN}") - message(WARNING " ${SRC}") - message(WARNING " ${BIN}") - message(WARNING " ${DST}") - message(FATAL_ERROR "Can not continue, terminating") - endif() + if(EXISTS ${SRC_IN}) + message("using generated ${DST} from ${SRC_IN}") + cleaning_configure_file(${SRC_IN} ${DST} @ONLY IMMEDIATE) + elseif(EXISTS ${DST_IN}) + message("using generated ${DST} from ${DST_IN}") + cleaning_configure_file(${DST_IN} ${DST} @ONLY IMMEDIATE) + elseif(EXISTS ${SRC}) + set(DST ${SRC}) + message("using ${DST}") + elseif(EXISTS ${BIN}) + set(DST ${BIN}) + message("using ${DST}") + elseif(EXISTS ${DST}) + message("using ${DST}") + else() + message(WARNING "Missing manpage section, considered:") + message(WARNING " ${SRC_IN}") + message(WARNING " ${DST_IN}") + message(WARNING " ${SRC}") + message(WARNING " ${BIN}") + message(WARNING " ${DST}") + message(FATAL_ERROR "Can not continue, terminating") + endif() - file(READ ${DST} CONTENTS) - file(APPEND ${CURRENT_BINARY_DIR}/${manpage} "${CONTENTS}") + file(READ ${DST} CONTENTS) + file(APPEND ${CURRENT_BINARY_DIR}/${manpage} "${CONTENTS}") endforeach() diff --git a/cmake/GetGitRevisionDescription.cmake b/cmake/GetGitRevisionDescription.cmake index 2367b3e8e..166030aba 100644 --- a/cmake/GetGitRevisionDescription.cmake +++ b/cmake/GetGitRevisionDescription.cmake @@ -33,7 +33,7 @@ include(CleaningConfigureFile) if(__get_git_revision_description) - return() + return() endif() set(__get_git_revision_description YES) @@ -43,95 +43,88 @@ 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() + 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") - cleaning_configure_file("${GIT_DIR}/HEAD" "${HEAD_FILE}" COPYONLY) + if(NOT EXISTS "${GIT_DIR}/HEAD") + return() + endif() + set(HEAD_FILE "${GIT_DATA}/HEAD") + cleaning_configure_file("${GIT_DIR}/HEAD" "${HEAD_FILE}" COPYONLY) - cleaning_configure_file("${_gitdescmoddir}/GetGitRevisionDescription.cmake.in" - "${GIT_DATA}/grabRef.cmake" - @ONLY) - include("${GIT_DATA}/grabRef.cmake") + cleaning_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) + 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() + 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() + 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) + 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() + 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() + 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) + set(${_var} "${out}" PARENT_SCOPE) endfunction() function(git_get_exact_tag _var) - git_describe(out --exact-match ${ARGN}) - set(${_var} "${out}" PARENT_SCOPE) + git_describe(out --exact-match ${ARGN}) + set(${_var} "${out}" PARENT_SCOPE) endfunction() diff --git a/cmake/InstallFreeRDPDesktop.cmake b/cmake/InstallFreeRDPDesktop.cmake index 0307274e8..015a6b5ce 100644 --- a/cmake/InstallFreeRDPDesktop.cmake +++ b/cmake/InstallFreeRDPDesktop.cmake @@ -5,35 +5,18 @@ option(WITH_INSTALL_CLIENT_DESKTOP_FILES "Install .desktop files for clients" OF set(DESKTOP_RESOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/../resources" CACHE INTERNAL "") function(install_freerdp_desktop name) - if(WITH_INSTALL_CLIENT_DESKTOP_FILES) - get_target_property(FREERDP_APP_NAME ${name} OUTPUT_NAME) - set(FREERDP_BIN_NAME "${CMAKE_INSTALL_FULL_BINDIR}/${FREERDP_APP_NAME}") - set(FREERDP_DESKTOP_NAME "${CMAKE_CURRENT_BINARY_DIR}/${FREERDP_BIN_NAME}.desktop") - set(FREERDP_DESKTOP_FILE_NAME "${CMAKE_CURRENT_BINARY_DIR}/${FREERDP_BIN_NAME}-file.desktop") - configure_file( - ${DESKTOP_RESOURCE_DIR}/freerdp.desktop.template - ${FREERDP_DESKTOP_NAME} - @ONLY - ) - configure_file( - ${DESKTOP_RESOURCE_DIR}/freerdp-file.desktop.template - ${FREERDP_DESKTOP_FILE_NAME} - @ONLY - ) - install( - FILES - ${FREERDP_DESKTOP_NAME} - ${FREERDP_DESKTOP_FILE_NAME} - DESTINATION - ${CMAKE_INSTALL_DATAROOTDIR}/applications - ) - install( - FILES - ${DESKTOP_RESOURCE_DIR}/FreeRDP_Icon.svg - DESTINATION - ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/apps - RENAME - FreeRDP.svg - ) - endif() + if(WITH_INSTALL_CLIENT_DESKTOP_FILES) + get_target_property(FREERDP_APP_NAME ${name} OUTPUT_NAME) + set(FREERDP_BIN_NAME "${CMAKE_INSTALL_FULL_BINDIR}/${FREERDP_APP_NAME}") + set(FREERDP_DESKTOP_NAME "${CMAKE_CURRENT_BINARY_DIR}/${FREERDP_BIN_NAME}.desktop") + set(FREERDP_DESKTOP_FILE_NAME "${CMAKE_CURRENT_BINARY_DIR}/${FREERDP_BIN_NAME}-file.desktop") + configure_file(${DESKTOP_RESOURCE_DIR}/freerdp.desktop.template ${FREERDP_DESKTOP_NAME} @ONLY) + configure_file(${DESKTOP_RESOURCE_DIR}/freerdp-file.desktop.template ${FREERDP_DESKTOP_FILE_NAME} @ONLY) + install(FILES ${FREERDP_DESKTOP_NAME} ${FREERDP_DESKTOP_FILE_NAME} + DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications + ) + install(FILES ${DESKTOP_RESOURCE_DIR}/FreeRDP_Icon.svg + DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/apps RENAME FreeRDP.svg + ) + endif() endfunction() diff --git a/cmake/InstallFreeRDPMan.cmake b/cmake/InstallFreeRDPMan.cmake index a40401275..6dba37e8e 100644 --- a/cmake/InstallFreeRDPMan.cmake +++ b/cmake/InstallFreeRDPMan.cmake @@ -5,21 +5,21 @@ include(CleaningConfigureFile) get_filename_component(INSTALL_FREERDP_MAN_SCRIPT_DIR "${CMAKE_CURRENT_LIST_DIR}" ABSOLUTE) function(install_freerdp_man manpage section) - if(WITH_MANPAGES) - install(FILES ${manpage} DESTINATION ${CMAKE_INSTALL_MANDIR}/man${section}) - endif() + if(WITH_MANPAGES) + install(FILES ${manpage} DESTINATION ${CMAKE_INSTALL_MANDIR}/man${section}) + endif() endfunction() function(generate_and_install_freerdp_man_from_template name_base section api) - if(WITH_MANPAGES) - if (WITH_BINARY_VERSIONING) - set(manpage "${CMAKE_CURRENT_BINARY_DIR}/${name_base}${api}.${section}") - else() - set(manpage "${CMAKE_CURRENT_BINARY_DIR}/${name_base}.${section}") - endif() - cleaning_configure_file(${name_base}.${section}.in ${manpage}) - install_freerdp_man(${manpage} ${section}) - endif() + if(WITH_MANPAGES) + if(WITH_BINARY_VERSIONING) + set(manpage "${CMAKE_CURRENT_BINARY_DIR}/${name_base}${api}.${section}") + else() + set(manpage "${CMAKE_CURRENT_BINARY_DIR}/${name_base}.${section}") + endif() + cleaning_configure_file(${name_base}.${section}.in ${manpage}) + install_freerdp_man(${manpage} ${section}) + endif() endfunction() # Generate an install target for a manpage. @@ -36,46 +36,36 @@ endfunction() # * concatenate all manpage sections to the target manpage # 6. create the actual install target function(generate_and_install_freerdp_man_from_xml target section dependencies variable_names) - if(WITH_MANPAGES) - get_target_property(name_base "${target}" OUTPUT_NAME) - set(template "${target}.${section}") - set(MANPAGE_NAME "${name_base}") - set(manpage "${name_base}.${section}") + if(WITH_MANPAGES) + get_target_property(name_base "${target}" OUTPUT_NAME) + set(template "${target}.${section}") + set(MANPAGE_NAME "${name_base}") + set(manpage "${name_base}.${section}") - # We need the variable ${MAN_TODAY} to contain the current date in ISO - # format to replace it in the cleaning_configure_file step. - include(today) + # We need the variable ${MAN_TODAY} to contain the current date in ISO + # format to replace it in the cleaning_configure_file step. + include(today) - TODAY(MAN_TODAY) + today(MAN_TODAY) - set(GENERATE_COMMAND - -Dtemplate=\"${template}\" - -DMANPAGE_NAME=\"${MANPAGE_NAME}\" - -Dmanpage=\"${manpage}\" - -DMAN_TODAY=\"${MAN_TODAY}\" - -DCURRENT_SOURCE_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}\" - -DCURRENT_BINARY_DIR=\"${CMAKE_CURRENT_BINARY_DIR}\" - -Dtarget="${target}" - -Dsection="${section}" - -Ddependencies="${dependencies}" - ) + set(GENERATE_COMMAND + -Dtemplate=\"${template}\" -DMANPAGE_NAME=\"${MANPAGE_NAME}\" -Dmanpage=\"${manpage}\" + -DMAN_TODAY=\"${MAN_TODAY}\" -DCURRENT_SOURCE_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}\" + -DCURRENT_BINARY_DIR=\"${CMAKE_CURRENT_BINARY_DIR}\" -Dtarget="${target}" -Dsection="${section}" + -Ddependencies="${dependencies}" + ) - foreach(var IN ITEMS ${variable_names}) - list(APPEND GENERATE_COMMAND - -D${var}=${${var}} - ) - endforeach() + foreach(var IN ITEMS ${variable_names}) + list(APPEND GENERATE_COMMAND -D${var}=${${var}}) + endforeach() - list(APPEND GENERATE_COMMAND - -P \"${INSTALL_FREERDP_MAN_SCRIPT_DIR}/GenerateManpages.cmake\" - ) + list(APPEND GENERATE_COMMAND -P \"${INSTALL_FREERDP_MAN_SCRIPT_DIR}/GenerateManpages.cmake\") - add_custom_target(${manpage}.target ALL - COMMAND ${CMAKE_COMMAND} ${GENERATE_COMMAND} - DEPENDS generate_argument_manpage.target - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - ) + add_custom_target( + ${manpage}.target ALL COMMAND ${CMAKE_COMMAND} ${GENERATE_COMMAND} DEPENDS generate_argument_manpage.target + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + ) - install_freerdp_man(${CMAKE_CURRENT_BINARY_DIR}/${manpage} ${section}) - endif() + install_freerdp_man(${CMAKE_CURRENT_BINARY_DIR}/${manpage} ${section}) + endif() endfunction() diff --git a/cmake/JsonDetect.cmake b/cmake/JsonDetect.cmake index c23041b4e..af7628d03 100644 --- a/cmake/JsonDetect.cmake +++ b/cmake/JsonDetect.cmake @@ -1,51 +1,49 @@ include(CMakeDependentOption) -option(WITH_JSON_DISABLED "Build without any JSON support" OFF) -CMAKE_DEPENDENT_OPTION(WITH_CJSON_REQUIRED "Build with cJSON (fail if not found)" OFF "NOT WITH_JSON_DISABLED" OFF) -CMAKE_DEPENDENT_OPTION(WITH_JSONC_REQUIRED "Build with JSON-C (fail if not found)" OFF "NOT WITH_JSON_DISABLED" OFF) -if (NOT WITH_JSON_DISABLED) - find_package(cJSON) +option(WITH_JSON_DISABLED "Build without any JSON support" OFF) +cmake_dependent_option(WITH_CJSON_REQUIRED "Build with cJSON (fail if not found)" OFF "NOT WITH_JSON_DISABLED" OFF) +cmake_dependent_option(WITH_JSONC_REQUIRED "Build with JSON-C (fail if not found)" OFF "NOT WITH_JSON_DISABLED" OFF) +if(NOT WITH_JSON_DISABLED) + find_package(cJSON) - # Fallback detection: - # older ubuntu releases did not ship CMake or pkg-config files - # for cJSON. Be optimistic and try pkg-config and as last resort - # try manual detection - if (NOT CJSON_FOUND) - find_package(PkgConfig) - if (PKG_CONFIG_FOUND) - pkg_check_modules(CJSON libcjson) - endif() + # Fallback detection: + # older ubuntu releases did not ship CMake or pkg-config files + # for cJSON. Be optimistic and try pkg-config and as last resort + # try manual detection + if(NOT CJSON_FOUND) + find_package(PkgConfig) + if(PKG_CONFIG_FOUND) + pkg_check_modules(CJSON libcjson) + endif() - if (NOT CJSON_FOUND) - find_path(CJSON_INCLUDE_DIRS - NAMES cjson/cJSON.h - ) - find_library(CJSON_LIBRARIES - NAMES cjson - ) - if (NOT "${CJSON_LIBRARIES}" STREQUAL "CJSON_LIBRARIES-NOTFOUND" AND NOT "${CJSON_INCLUDE_DIRS}" STREQUAL "CJSON_INCLUDE_DIRS-NOTFOUND") - set(CJSON_FOUND ON) - endif() - endif() - endif() + if(NOT CJSON_FOUND) + find_path(CJSON_INCLUDE_DIRS NAMES cjson/cJSON.h) + find_library(CJSON_LIBRARIES NAMES cjson) + if(NOT "${CJSON_LIBRARIES}" STREQUAL "CJSON_LIBRARIES-NOTFOUND" AND NOT "${CJSON_INCLUDE_DIRS}" STREQUAL + "CJSON_INCLUDE_DIRS-NOTFOUND" + ) + set(CJSON_FOUND ON) + endif() + endif() + endif() - if (WITH_CJSON_REQUIRED) - if (NOT CJSON_FOUND) - message(FATAL_ERROR "cJSON was requested but not found") - endif() - endif() + if(WITH_CJSON_REQUIRED) + if(NOT CJSON_FOUND) + message(FATAL_ERROR "cJSON was requested but not found") + endif() + endif() - if (WITH_JSONC_REQUIRED) - find_package(JSONC REQUIRED) - else() - find_package(JSONC) - endif() + if(WITH_JSONC_REQUIRED) + find_package(JSONC REQUIRED) + else() + find_package(JSONC) + endif() - if (NOT JSONC_FOUND AND NOT CJSON_FOUND) - set(WITH_WINPR_JSON OFF CACHE INTERNAL "internal") - message("compiling without JSON support. Install cJSON or json-c to enable") - endif() + if(NOT JSONC_FOUND AND NOT CJSON_FOUND) + set(WITH_WINPR_JSON OFF CACHE INTERNAL "internal") + message("compiling without JSON support. Install cJSON or json-c to enable") + endif() else() - set(WITH_WINPR_JSON OFF CACHE INTERNAL "internal") - message("forced compile without JSON support. Set -DWITH_JSON_DISABLED=OFF to enable compile time detection") + set(WITH_WINPR_JSON OFF CACHE INTERNAL "internal") + message("forced compile without JSON support. Set -DWITH_JSON_DISABLED=OFF to enable compile time detection") endif() diff --git a/cmake/LibFindMacros.cmake b/cmake/LibFindMacros.cmake index 0e47404c5..3350435ff 100644 --- a/cmake/LibFindMacros.cmake +++ b/cmake/LibFindMacros.cmake @@ -3,31 +3,31 @@ # 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}) + 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) +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 @@ -35,82 +35,81 @@ endmacro (libfind_pkg_check_modules) # 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) +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 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) + # 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) + # 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}) + 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]+") +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) - - +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/ListTargetProperties.cmake b/cmake/ListTargetProperties.cmake index 8b1969e0d..e38bd3d32 100644 --- a/cmake/ListTargetProperties.cmake +++ b/cmake/ListTargetProperties.cmake @@ -1,35 +1,35 @@ # Get all properties that cmake supports if(NOT CMAKE_PROPERTY_LIST) - execute_process(COMMAND cmake --help-property-list OUTPUT_VARIABLE CMAKE_PROPERTY_LIST) - - # Convert command output into a CMake list - string(REGEX REPLACE ";" "\\\\;" CMAKE_PROPERTY_LIST "${CMAKE_PROPERTY_LIST}") - string(REGEX REPLACE "\n" ";" CMAKE_PROPERTY_LIST "${CMAKE_PROPERTY_LIST}") - list(REMOVE_DUPLICATES CMAKE_PROPERTY_LIST) + execute_process(COMMAND cmake --help-property-list OUTPUT_VARIABLE CMAKE_PROPERTY_LIST) + + # Convert command output into a CMake list + string(REGEX REPLACE ";" "\\\\;" CMAKE_PROPERTY_LIST "${CMAKE_PROPERTY_LIST}") + string(REGEX REPLACE "\n" ";" CMAKE_PROPERTY_LIST "${CMAKE_PROPERTY_LIST}") + list(REMOVE_DUPLICATES CMAKE_PROPERTY_LIST) endif() - + function(print_properties) - message("CMAKE_PROPERTY_LIST = ${CMAKE_PROPERTY_LIST}") + message("CMAKE_PROPERTY_LIST = ${CMAKE_PROPERTY_LIST}") endfunction() - + function(list_target_properties target) - if(NOT TARGET ${target}) - message(STATUS "There is no target named '${target}'") - return() + if(NOT TARGET ${target}) + message(STATUS "There is no target named '${target}'") + return() + endif() + + foreach(property ${CMAKE_PROPERTY_LIST}) + string(REPLACE "" "${CMAKE_BUILD_TYPE}" property ${property}) + + # Fix https://stackoverflow.com/questions/32197663/how-can-i-remove-the-the-location-property-may-not-be-read-from-target-error-i + if(property STREQUAL "LOCATION" OR property MATCHES "^LOCATION_" OR property MATCHES "_LOCATION$") + continue() endif() - foreach(property ${CMAKE_PROPERTY_LIST}) - string(REPLACE "" "${CMAKE_BUILD_TYPE}" property ${property}) - - # Fix https://stackoverflow.com/questions/32197663/how-can-i-remove-the-the-location-property-may-not-be-read-from-target-error-i - if(property STREQUAL "LOCATION" OR property MATCHES "^LOCATION_" OR property MATCHES "_LOCATION$") - continue() - endif() - - get_property(was_set TARGET ${target} PROPERTY ${property} SET) - if(was_set) - get_target_property(value ${target} ${property}) - message("${target} ${property} = ${value}") - endif() - endforeach() + get_property(was_set TARGET ${target} PROPERTY ${property} SET) + if(was_set) + get_target_property(value ${target} ${property}) + message("${target} ${property} = ${value}") + endif() + endforeach() endfunction() diff --git a/cmake/MSVCRuntime.cmake b/cmake/MSVCRuntime.cmake index 7fb9fabdb..aa4587d0c 100644 --- a/cmake/MSVCRuntime.cmake +++ b/cmake/MSVCRuntime.cmake @@ -1,47 +1,49 @@ -if (MSVC) - 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) + 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(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(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() + 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() + set(CMAKE_MSVC_RUNTIME_LIBRARY ${MSVC_DEFAULT_RUNTIME} CACHE STRING "MSVC runtime") + endif() - message("build is using MSVC runtime ${CMAKE_MSVC_RUNTIME_LIBRARY}") + 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() + 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() + if(NOT DEFINED CMAKE_SUPPRESS_REGENERATION) + set(CMAKE_SUPPRESS_REGENERATION ON) + endif() endif() diff --git a/cmake/MergeStaticLibs.cmake b/cmake/MergeStaticLibs.cmake index 8f34e3021..b803ba376 100644 --- a/cmake/MergeStaticLibs.cmake +++ b/cmake/MergeStaticLibs.cmake @@ -1,4 +1,3 @@ - # Copyright (C) 2012 Modelon AB # This program is free software: you can redistribute it and/or modify @@ -15,89 +14,90 @@ # 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}) + set(output_target "${output_library}") + string(REGEX REPLACE "-" "_" output_library ${output_library}) + set(libs ${ARGV}) + list(REMOVE_AT libs 0) - 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() + # 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}\";") - # 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) + add_library(${output_target} STATIC ${dummyfile}) - # Now the easy part for MSVC and for MAC + 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 convert 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() - + 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(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}) + if(${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/cmake.check_cache IS_NEWER_THAN ${objlistcmake}) - file(WRITE ${objlistcmake} " + file( + WRITE ${objlistcmake} + " # delete previous object files message(STATUS \"Removing previous object files from ${lib}\") EXECUTE_PROCESS(COMMAND ls . @@ -115,37 +115,37 @@ function(merge_static_libs output_library) COMMAND xargs -I {} mv {} ${libname}_{} WORKING_DIRECTORY ${objdir}) # save the list of object files - EXECUTE_PROCESS(COMMAND ls . + 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}) + " + ) + + 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}) + add_custom_command( + OUTPUT ${dummyfile} COMMAND ${CMAKE_COMMAND} -E copy ${dummyfile}.base ${dummyfile} DEPENDS ${libs} ${extrafiles} + ) endfunction() diff --git a/cmake/PlatformDefaults.cmake b/cmake/PlatformDefaults.cmake index f7742ef27..11337d9f4 100644 --- a/cmake/PlatformDefaults.cmake +++ b/cmake/PlatformDefaults.cmake @@ -3,106 +3,108 @@ # # Compilation will fail without a replacement defining the symbols, but that can be # done by supplying a TOOLCHAIN_FILE defining these. -option(USE_PLATFORM_DEFAULT "Use this configuration file for platform defaults. Supply -DCMAKE_TOOLCHAIN_FILE=." ON) -if (USE_PLATFORM_DEFAULT) - # default defines or other required preferences per platform - if((CMAKE_SYSTEM_NAME MATCHES "WindowsStore") AND (CMAKE_SYSTEM_VERSION MATCHES "10.0")) - set(UWP 1 CACHE BOOL "platform default") - add_definitions("-D_UWP") - set(CMAKE_WINDOWS_VERSION "WIN10" CACHE STRING "platform default") +option(USE_PLATFORM_DEFAULT + "Use this configuration file for platform defaults. Supply -DCMAKE_TOOLCHAIN_FILE=." ON +) +if(USE_PLATFORM_DEFAULT) + # default defines or other required preferences per platform + if((CMAKE_SYSTEM_NAME MATCHES "WindowsStore") AND (CMAKE_SYSTEM_VERSION MATCHES "10.0")) + set(UWP 1 CACHE BOOL "platform default") + add_definitions("-D_UWP") + set(CMAKE_WINDOWS_VERSION "WIN10" CACHE STRING "platform default") + endif() + + if("${CMAKE_SYSTEM_NAME}" MATCHES "Linux") + # Linux already does define _POSIX_C_SOURCE by default, nothing to do + add_definitions("-D_FILE_OFFSET_BITS=64") + set(WINPR_TIMEZONE_FILE "/etc/timezone") + endif() + + if("${CMAKE_SYSTEM_NAME}" MATCHES "FreeBSD") + set(BSD TRUE CACHE INTERNAL "platform default") + set(FREEBSD TRUE CACHE INTERNAL "platform default") + # we want POSIX 2008. FreeBSD 14 does only support 2001 fully, but the subset we require from 2008 + # is implemented, so ignore _POSIX_VERSION from unistd.h + add_definitions("-D_POSIX_C_SOURCE=200809L") + # TODO: FreeBSD allows mixing POSIX and BSD API calls if we do not set + # _POSIX_C_SOURCE but lack a macro to re-enable the BSD calls... + add_definitions("-D__BSD_VISIBLE") + + # There are some symbols only visible for XOpen standard + add_definitions("-D_XOPEN_SOURCE=700") + add_definitions("-D_FILE_OFFSET_BITS=64") + set(WINPR_TIMEZONE_FILE "/var/db/zoneinfo") + endif() + + if("${CMAKE_SYSTEM_NAME}" MATCHES "SunOS") + # TODO: Does somebody still use this? please show yourself and + # tell us if this still works. + add_definitions("-D_POSIX_PTHREAD_SEMANTICS") + list(APPEND CMAKE_STANDARD_LIBRARIES rt) + set(CMAKE_STANDARD_LIBRARIES ${CMAKE_STANDARD_LIBRARIES} CACHE STRING "platform default") + set(WITH_SUN true CACHE BOOL "platform default") + endif() + + if("${CMAKE_SYSTEM_NAME}" MATCHES "Darwin") + # we want POSIX 2008. MacOS does only support 2001 fully, but the subset we require from 2008 + # is implemented, so ignore _POSIX_VERSION from unistd.h + add_definitions("-D_POSIX_C_SOURCE=200809L") + + # as _POSIX_C_SOURCE sets a fully POSIX confirmant environment re-enable + # MacOS API visibility by defining the following feature test macro + add_definitions("-D_DARWIN_C_SOURCE") + endif() + + if(${CMAKE_SYSTEM_NAME} MATCHES "kFreeBSD") + set(BSD TRUE CACHE INTERNAL "platform default") + set(KFREEBSD TRUE CACHE INTERNAL "platform default") + add_definitions(-DKFREEBSD) + add_definitions("-D_GNU_SOURCE") + endif() + + if(${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD") + set(BSD TRUE CACHE INTERNAL "platform default") + set(OPENBSD TRUE CACHE INTERNAL "platform default") + endif() + + if(${CMAKE_SYSTEM_NAME} MATCHES "DragonFly") + set(BSD TRUE CACHE INTERNAL "platform default") + set(FREEBSD TRUE CACHE INTERNAL "platform default") + + # we want POSIX 2008. FreeBSD 14 does only support 2001 fully, but the subset we require from 2008 + # is implemented, so ignore _POSIX_VERSION from unistd.h + add_definitions("-D_POSIX_C_SOURCE=200809L") + # TODO: FreeBSD allows mixing POSIX and BSD API calls if we do not set + # _POSIX_C_SOURCE but lack a macro to re-enable the BSD calls... + add_definitions("-D__BSD_VISIBLE") + + # There are some symbols only visible for XOpen standard + add_definitions("-D_XOPEN_SOURCE=700") + add_definitions("-D_FILE_OFFSET_BITS=64") + set(WINPR_TIMEZONE_FILE "/var/db/zoneinfo") + endif() + + if(BSD) + if(IS_DIRECTORY /usr/local/include) + include_directories(SYSTEM /usr/local/include) + link_directories(/usr/local/lib) endif() - - if("${CMAKE_SYSTEM_NAME}" MATCHES "Linux") - # Linux already does define _POSIX_C_SOURCE by default, nothing to do - add_definitions("-D_FILE_OFFSET_BITS=64") - set(WINPR_TIMEZONE_FILE "/etc/timezone") + if(OPENBSD) + if(IS_DIRECTORY /usr/X11R6/include) + include_directories(SYSTEM /usr/X11R6/include) + endif() endif() + endif() - if("${CMAKE_SYSTEM_NAME}" MATCHES "FreeBSD") - set(BSD TRUE CACHE INTERNAL "platform default") - set(FREEBSD TRUE CACHE INTERNAL "platform default") - # we want POSIX 2008. FreeBSD 14 does only support 2001 fully, but the subset we require from 2008 - # is implemented, so ignore _POSIX_VERSION from unistd.h - add_definitions("-D_POSIX_C_SOURCE=200809L") - # TODO: FreeBSD allows mixing POSIX and BSD API calls if we do not set - # _POSIX_C_SOURCE but lack a macro to re-enable the BSD calls... - add_definitions("-D__BSD_VISIBLE") + # define a fallback for systems that do not support a timezone file or we did not yet test. + # since most of these are BSD try a sensible default + if(NOT WINPR_TIMEZONE_FILE) + set(WINPR_TIMEZONE_FILE "/var/db/zoneinfo") + endif() + add_definitions("-DWINPR_TIMEZONE_FILE=\"${WINPR_TIMEZONE_FILE}\"") - # There are some symbols only visible for XOpen standard - add_definitions("-D_XOPEN_SOURCE=700") - add_definitions("-D_FILE_OFFSET_BITS=64") - set(WINPR_TIMEZONE_FILE "/var/db/zoneinfo") - endif() - - if("${CMAKE_SYSTEM_NAME}" MATCHES "SunOS") - # TODO: Does somebody still use this? please show yourself and - # tell us if this still works. - add_definitions("-D_POSIX_PTHREAD_SEMANTICS") - list(APPEND CMAKE_STANDARD_LIBRARIES rt) - set(CMAKE_STANDARD_LIBRARIES ${CMAKE_STANDARD_LIBRARIES} CACHE STRING "platform default") - set(WITH_SUN true CACHE BOOL "platform default") - endif() - - if("${CMAKE_SYSTEM_NAME}" MATCHES "Darwin") - # we want POSIX 2008. MacOS does only support 2001 fully, but the subset we require from 2008 - # is implemented, so ignore _POSIX_VERSION from unistd.h - add_definitions("-D_POSIX_C_SOURCE=200809L") - - # as _POSIX_C_SOURCE sets a fully POSIX confirmant environment re-enable - # MacOS API visibility by defining the following feature test macro - add_definitions("-D_DARWIN_C_SOURCE") - endif() - - if(${CMAKE_SYSTEM_NAME} MATCHES "kFreeBSD") - set(BSD TRUE CACHE INTERNAL "platform default") - set(KFREEBSD TRUE CACHE INTERNAL "platform default") - add_definitions(-DKFREEBSD) - add_definitions("-D_GNU_SOURCE") - endif() - - if(${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD") - set(BSD TRUE CACHE INTERNAL "platform default") - set(OPENBSD TRUE CACHE INTERNAL "platform default") - endif() - - if(${CMAKE_SYSTEM_NAME} MATCHES "DragonFly") - set(BSD TRUE CACHE INTERNAL "platform default") - set(FREEBSD TRUE CACHE INTERNAL "platform default") - - # we want POSIX 2008. FreeBSD 14 does only support 2001 fully, but the subset we require from 2008 - # is implemented, so ignore _POSIX_VERSION from unistd.h - add_definitions("-D_POSIX_C_SOURCE=200809L") - # TODO: FreeBSD allows mixing POSIX and BSD API calls if we do not set - # _POSIX_C_SOURCE but lack a macro to re-enable the BSD calls... - add_definitions("-D__BSD_VISIBLE") - - # There are some symbols only visible for XOpen standard - add_definitions("-D_XOPEN_SOURCE=700") - add_definitions("-D_FILE_OFFSET_BITS=64") - set(WINPR_TIMEZONE_FILE "/var/db/zoneinfo") - endif() - - if(BSD) - if(IS_DIRECTORY /usr/local/include) - include_directories(SYSTEM /usr/local/include) - link_directories(/usr/local/lib) - endif() - if(OPENBSD) - if(IS_DIRECTORY /usr/X11R6/include) - include_directories(SYSTEM /usr/X11R6/include) - endif() - endif() - endif() - - # define a fallback for systems that do not support a timezone file or we did not yet test. - # since most of these are BSD try a sensible default - if (NOT WINPR_TIMEZONE_FILE) - set(WINPR_TIMEZONE_FILE "/var/db/zoneinfo") - endif() - add_definitions("-DWINPR_TIMEZONE_FILE=\"${WINPR_TIMEZONE_FILE}\"") - - if(FREEBSD) - find_path(EPOLLSHIM_INCLUDE_DIR NAMES sys/epoll.h sys/timerfd.h HINTS /usr/local/include/libepoll-shim) - find_library(EPOLLSHIM_LIBS NAMES epoll-shim libepoll-shim HINTS /usr/local/lib) - endif() + if(FREEBSD) + find_path(EPOLLSHIM_INCLUDE_DIR NAMES sys/epoll.h sys/timerfd.h HINTS /usr/local/include/libepoll-shim) + find_library(EPOLLSHIM_LIBS NAMES epoll-shim libepoll-shim HINTS /usr/local/lib) + endif() endif() diff --git a/cmake/PreventInSourceBuilds.cmake b/cmake/PreventInSourceBuilds.cmake index 6488cedd9..5fe93d865 100644 --- a/cmake/PreventInSourceBuilds.cmake +++ b/cmake/PreventInSourceBuilds.cmake @@ -9,23 +9,25 @@ 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() +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") + 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) + # 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 "\ + # 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. \ @@ -35,12 +37,15 @@ 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() -# Check for remnants of in source builds - if(EXISTS "${CMAKE_SOURCE_DIR}/CMakeCache.txt" OR EXISTS "${CMAKE_SOURCE_DIR}/CMakeFiles") - message(FATAL_ERROR " \ + # 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! @@ -50,6 +55,7 @@ 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() endif() diff --git a/cmake/SetFreeRDPCMakeInstallDir.cmake b/cmake/SetFreeRDPCMakeInstallDir.cmake index 125e2f42d..f088ed907 100644 --- a/cmake/SetFreeRDPCMakeInstallDir.cmake +++ b/cmake/SetFreeRDPCMakeInstallDir.cmake @@ -1,7 +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() + 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 index de9e2df88..045a0b5da 100644 --- a/cmake/ShowCMakeVars.cmake +++ b/cmake/ShowCMakeVars.cmake @@ -1,15 +1,14 @@ 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() + 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 index de470e156..62ff5eae4 100644 --- a/cmake/WarnUnmaintained.cmake +++ b/cmake/WarnUnmaintained.cmake @@ -1,9 +1,14 @@ - 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") + 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/WebView2.cmake b/cmake/WebView2.cmake index a833ec5a5..52f012b62 100644 --- a/cmake/WebView2.cmake +++ b/cmake/WebView2.cmake @@ -8,51 +8,34 @@ if(WIN32) if(NOT EXISTS ${WEBVIEW2_PACKAGE_DIR}) unset(WEBVIEW2_PACKAGE_DIR CACHE) endif() - find_path(WEBVIEW2_PACKAGE_DIR - NAMES - "build/native/include/WebView2.h" - NO_DEFAULT_PATH - NO_CMAKE_FIND_ROOT_PATH # dont prepend CMAKE_PREFIX + find_path(WEBVIEW2_PACKAGE_DIR NAMES "build/native/include/WebView2.h" + NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH # dont prepend CMAKE_PREFIX ) if(NOT WEBVIEW2_PACKAGE_DIR) message(WARNING "WebView2 SDK not found locally, downloading ${WEBVIEW2_VERSION} ...") set(WEBVIEW2_PACKAGE_DIR ${WEBVIEW2_DEFAULT_PACKAGE_DIR} CACHE PATH "WebView2 SDK PATH" FORCE) - file( - DOWNLOAD - ${WEBVIEW2_URL} - ${CMAKE_CURRENT_BINARY_DIR}/webview2.nuget - EXPECTED_HASH - SHA256=${WEBVIEW2_SHA256} - ) + file(DOWNLOAD ${WEBVIEW2_URL} ${CMAKE_CURRENT_BINARY_DIR}/webview2.nuget EXPECTED_HASH SHA256=${WEBVIEW2_SHA256}) file(MAKE_DIRECTORY ${WEBVIEW2_PACKAGE_DIR}) execute_process( - COMMAND - "${CMAKE_COMMAND}" -E tar x "${CMAKE_CURRENT_BINARY_DIR}/webview2.nuget" - WORKING_DIRECTORY - "${WEBVIEW2_PACKAGE_DIR}" + COMMAND "${CMAKE_COMMAND}" -E tar x "${CMAKE_CURRENT_BINARY_DIR}/webview2.nuget" + WORKING_DIRECTORY "${WEBVIEW2_PACKAGE_DIR}" ) endif() set(WEBVIEW2_PACKAGE_DIR ${WEBVIEW2_PACKAGE_DIR} CACHE INTERNAL "" FORCE) endif() function(target_link_webview2 target) - if(WIN32) - if (CMAKE_CXX_COMPILER_ARCHITECTURE_ID) - set(ARCH ${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}) - elseif (CMAKE_C_COMPILER_ARCHITECTURE_ID) - set(ARCH ${CMAKE_C_COMPILER_ARCHITECTURE_ID}) - else() - message(FATAL_ERROR "Unknown CMAKE__COMPILER_ARCHITECTURE_ID") - endif() - target_include_directories(${target} - PRIVATE - "${WEBVIEW2_PACKAGE_DIR}/build/native/include" - ) - target_link_libraries(${target} - PRIVATE - shlwapi - version - "${WEBVIEW2_PACKAGE_DIR}/build/native/${ARCH}/WebView2LoaderStatic.lib" - ) - endif() + if(WIN32) + if(CMAKE_CXX_COMPILER_ARCHITECTURE_ID) + set(ARCH ${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}) + elseif(CMAKE_C_COMPILER_ARCHITECTURE_ID) + set(ARCH ${CMAKE_C_COMPILER_ARCHITECTURE_ID}) + else() + message(FATAL_ERROR "Unknown CMAKE__COMPILER_ARCHITECTURE_ID") + endif() + target_include_directories(${target} PRIVATE "${WEBVIEW2_PACKAGE_DIR}/build/native/include") + target_link_libraries( + ${target} PRIVATE shlwapi version "${WEBVIEW2_PACKAGE_DIR}/build/native/${ARCH}/WebView2LoaderStatic.lib" + ) + endif() endfunction() diff --git a/cmake/ios.toolchain.cmake b/cmake/ios.toolchain.cmake index a04d0a8e3..36ace3783 100644 --- a/cmake/ios.toolchain.cmake +++ b/cmake/ios.toolchain.cmake @@ -148,12 +148,26 @@ option(DROP_32_BIT "Drops the 32-bit targets universally." YES) ############################################################################### # List of supported platform values -list(APPEND _supported_platforms - "OS" "OS64" "OS64COMBINED" "SIMULATOR" "SIMULATOR64" "SIMULATORARM64" - "TVOS" "TVOSCOMBINED" "SIMULATOR_TVOS" - "WATCHOS" "WATCHOSCOMBINED" "SIMULATOR_WATCHOS" - "MAC" "MAC_ARM64" - "MAC_CATALYST" "MAC_CATALYST_ARM64") +list( + APPEND + _supported_platforms + "OS" + "OS64" + "OS64COMBINED" + "SIMULATOR" + "SIMULATOR64" + "SIMULATORARM64" + "TVOS" + "TVOSCOMBINED" + "SIMULATOR_TVOS" + "WATCHOS" + "WATCHOSCOMBINED" + "SIMULATOR_WATCHOS" + "MAC" + "MAC_ARM64" + "MAC_CATALYST" + "MAC_CATALYST_ARM64" +) # Cache what generator is used set(USED_CMAKE_GENERATOR "${CMAKE_GENERATOR}") @@ -178,10 +192,10 @@ elseif(NOT DEFINED XCODE_VERSION_INT) if(NOT XCODEBUILD_EXECUTABLE) message(FATAL_ERROR "xcodebuild not found. Please install either the standalone commandline tools or Xcode.") endif() - execute_process(COMMAND ${XCODEBUILD_EXECUTABLE} -version - OUTPUT_VARIABLE XCODE_VERSION_INT - ERROR_QUIET - OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process( + COMMAND ${XCODEBUILD_EXECUTABLE} -version OUTPUT_VARIABLE XCODE_VERSION_INT ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE + ) string(REGEX MATCH "Xcode [0-9\\.]+" XCODE_VERSION_INT "${XCODE_VERSION_INT}") string(REGEX REPLACE "Xcode ([0-9\\.]+)" "\\1" XCODE_VERSION_INT "${XCODE_VERSION_INT}") set(XCODE_VERSION_INT "${XCODE_VERSION_INT}" CACHE INTERNAL "") @@ -201,19 +215,25 @@ if(DEFINED PLATFORM) elseif(DEFINED ENV{_PLATFORM}) set(PLATFORM "$ENV{_PLATFORM}") elseif(NOT DEFINED PLATFORM) - message(FATAL_ERROR "PLATFORM argument not set. Bailing configure since I don't know what target you want to build for!") -endif () + message( + FATAL_ERROR "PLATFORM argument not set. Bailing configure since I don't know what target you want to build for!" + ) +endif() if(PLATFORM MATCHES ".*COMBINED" AND NOT CMAKE_GENERATOR MATCHES "Xcode") - message(FATAL_ERROR "The combined builds support requires Xcode to be used as generator via '-G Xcode' command-line argument in CMake") + message( + FATAL_ERROR + "The combined builds support requires Xcode to be used as generator via '-G Xcode' command-line argument in CMake" + ) endif() # Safeguard that the platform value is set and is one of the supported values list(FIND _supported_platforms ${PLATFORM} contains_PLATFORM) if("${contains_PLATFORM}" EQUAL "-1") - string(REPLACE ";" "\n * " _supported_platforms_formatted "${_supported_platforms}") + string(REPLACE ";" "\n * " _supported_platforms_formatted "${_supported_platforms}") message(FATAL_ERROR " Invalid PLATFORM specified! Current value: ${PLATFORM}.\n" - " Supported PLATFORM values: \n * ${_supported_platforms_formatted}") + " Supported PLATFORM values: \n * ${_supported_platforms_formatted}" + ) endif() # Check if Apple Silicon is supported @@ -224,6 +244,7 @@ endif() # Touch toolchain variable to suppress "unused variable" warning. # This happens if CMake is invoked with the same command line the second time. if(CMAKE_TOOLCHAIN_FILE) + endif() # Fix for PThread library not in path @@ -234,7 +255,7 @@ set(CMAKE_USE_PTHREADS_INIT 1) # Specify minimum version of deployment target. if(NOT DEFINED DEPLOYMENT_TARGET) - if (PLATFORM MATCHES "WATCHOS") + if(PLATFORM MATCHES "WATCHOS") # Unless specified, SDK version 4.0 is used by default as minimum target version (watchOS). set(DEPLOYMENT_TARGET "4.0") elseif(PLATFORM STREQUAL "MAC") @@ -281,13 +302,15 @@ if(PLATFORM_INT STREQUAL "OS") set(ARCHS armv7 armv7s arm64) set(APPLE_TARGET_TRIPLE_INT arm-apple-ios$${DEPLOYMENT_TARGET}) else() - set(APPLE_TARGET_TRIPLE_INT ${ARCHS_SPLIT}-apple-ios${DEPLOYMENT_TARGET}) + set(APPLE_TARGET_TRIPLE_INT ${ARCHS_SPLIT}-apple-ios${DEPLOYMENT_TARGET}) endif() elseif(PLATFORM_INT STREQUAL "OS64") set(SDK_NAME iphoneos) if(NOT ARCHS) - if (XCODE_VERSION_INT VERSION_GREATER 10.0) - set(ARCHS arm64) # Add arm64e when Apple have fixed the integration issues with it, libarclite_iphoneos.a is currently missung bitcode markers for example + if(XCODE_VERSION_INT VERSION_GREATER 10.0) + set(ARCHS arm64) + + # Add arm64e when Apple have fixed the integration issues with it, libarclite_iphoneos.a is currently missung bitcode markers for example else() set(ARCHS arm64) endif() @@ -299,8 +322,10 @@ elseif(PLATFORM_INT STREQUAL "OS64COMBINED") set(SDK_NAME iphoneos) if(MODERN_CMAKE) if(NOT ARCHS) - if (XCODE_VERSION_INT VERSION_GREATER 10.0) - set(ARCHS arm64 x86_64) # Add arm64e when Apple have fixed the integration issues with it, libarclite_iphoneos.a is currently missung bitcode markers for example + if(XCODE_VERSION_INT VERSION_GREATER 10.0) + set(ARCHS arm64 x86_64) + + # Add arm64e when Apple have fixed the integration issues with it, libarclite_iphoneos.a is currently missung bitcode markers for example set(CMAKE_XCODE_ATTRIBUTE_ARCHS[sdk=iphoneos*] "arm64") set(CMAKE_XCODE_ATTRIBUTE_ARCHS[sdk=iphonesimulator*] "x86_64") set(CMAKE_XCODE_ATTRIBUTE_VALID_ARCHS[sdk=iphoneos*] "arm64") @@ -352,7 +377,7 @@ elseif(PLATFORM_INT STREQUAL "TVOS") else() set(APPLE_TARGET_TRIPLE_INT ${ARCHS_SPLIT}-apple-tvos${DEPLOYMENT_TARGET}) endif() -elseif (PLATFORM_INT STREQUAL "TVOSCOMBINED") +elseif(PLATFORM_INT STREQUAL "TVOSCOMBINED") set(SDK_NAME appletvos) if(MODERN_CMAKE) if(NOT ARCHS) @@ -379,7 +404,7 @@ elseif(PLATFORM_INT STREQUAL "SIMULATOR_TVOS") elseif(PLATFORM_INT STREQUAL "WATCHOS") set(SDK_NAME watchos) if(NOT ARCHS) - if (XCODE_VERSION_INT VERSION_GREATER 10.0) + if(XCODE_VERSION_INT VERSION_GREATER 10.0) set(ARCHS armv7k arm64_32) set(APPLE_TARGET_TRIPLE_INT aarch64_32-apple-watchos${DEPLOYMENT_TARGET}) else() @@ -393,7 +418,7 @@ elseif(PLATFORM_INT STREQUAL "WATCHOSCOMBINED") set(SDK_NAME watchos) if(MODERN_CMAKE) if(NOT ARCHS) - if (XCODE_VERSION_INT VERSION_GREATER 10.0) + if(XCODE_VERSION_INT VERSION_GREATER 10.0) set(ARCHS armv7k arm64_32 i386) set(APPLE_TARGET_TRIPLE_INT aarch64_32-i386-apple-watchos${DEPLOYMENT_TARGET}) set(CMAKE_XCODE_ATTRIBUTE_ARCHS[sdk=watchos*] "armv7k arm64_32") @@ -476,19 +501,19 @@ if(DEFINED CMAKE_OSX_SYSROOT_INT) elseif(DEFINED ENV{_CMAKE_OSX_SYSROOT_INT}) set(CMAKE_OSX_SYSROOT_INT "$ENV{_CMAKE_OSX_SYSROOT_INT}") elseif(NOT DEFINED CMAKE_OSX_SYSROOT_INT) - execute_process(COMMAND ${XCODEBUILD_EXECUTABLE} -version -sdk ${SDK_NAME} Path - OUTPUT_VARIABLE CMAKE_OSX_SYSROOT_INT - ERROR_QUIET - OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process( + COMMAND ${XCODEBUILD_EXECUTABLE} -version -sdk ${SDK_NAME} Path OUTPUT_VARIABLE CMAKE_OSX_SYSROOT_INT + ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE + ) endif() -if (NOT DEFINED CMAKE_OSX_SYSROOT_INT AND NOT DEFINED CMAKE_OSX_SYSROOT) +if(NOT DEFINED CMAKE_OSX_SYSROOT_INT AND NOT DEFINED CMAKE_OSX_SYSROOT) message(SEND_ERROR "Please make sure that Xcode is installed and that the toolchain" - "is pointing to the correct path. Please run:" - "sudo xcode-select -s /Applications/Xcode.app/Contents/Developer" - "and see if that fixes the problem for you.") - message(FATAL_ERROR "Invalid CMAKE_OSX_SYSROOT: ${CMAKE_OSX_SYSROOT} " - "does not exist.") + "is pointing to the correct path. Please run:" + "sudo xcode-select -s /Applications/Xcode.app/Contents/Developer" + "and see if that fixes the problem for you." + ) + message(FATAL_ERROR "Invalid CMAKE_OSX_SYSROOT: ${CMAKE_OSX_SYSROOT} " "does not exist.") elseif(DEFINED CMAKE_OSX_SYSROOT_INT) set(CMAKE_OSX_SYSROOT_INT "${CMAKE_OSX_SYSROOT_INT}" CACHE INTERNAL "") # Specify the location or name of the platform SDK to be used in CMAKE_OSX_SYSROOT. @@ -501,11 +526,12 @@ if(NOT DEFINED ENABLE_BITCODE AND NOT ARCHS MATCHES "((^|;|, )(i386|x86_64))+") message(STATUS "[DEFAULTS] Enabling bitcode support by default. ENABLE_BITCODE not provided!") set(ENABLE_BITCODE TRUE) elseif(NOT DEFINED ENABLE_BITCODE) - message(STATUS "[DEFAULTS] Disabling bitcode support by default on simulators. ENABLE_BITCODE not provided for override!") + message( + STATUS "[DEFAULTS] Disabling bitcode support by default on simulators. ENABLE_BITCODE not provided for override!" + ) set(ENABLE_BITCODE FALSE) endif() -set(ENABLE_BITCODE_INT ${ENABLE_BITCODE} CACHE BOOL - "Whether or not to enable bitcode" FORCE) +set(ENABLE_BITCODE_INT ${ENABLE_BITCODE} CACHE BOOL "Whether or not to enable bitcode" FORCE) # Use ARC or not if(NOT DEFINED ENABLE_ARC) # Unless specified, enable ARC support by default @@ -519,15 +545,18 @@ if(NOT DEFINED ENABLE_VISIBILITY) set(ENABLE_VISIBILITY FALSE) message(STATUS "[DEFAULTS] Hiding symbols visibility by default. ENABLE_VISIBILITY not provided!") endif() -set(ENABLE_VISIBILITY_INT ${ENABLE_VISIBILITY} CACHE BOOL "Whether or not to hide symbols from the dynamic linker (-fvisibility=hidden)" FORCE) +set(ENABLE_VISIBILITY_INT ${ENABLE_VISIBILITY} + CACHE BOOL "Whether or not to hide symbols from the dynamic linker (-fvisibility=hidden)" FORCE +) # Set strict compiler checks or not if(NOT DEFINED ENABLE_STRICT_TRY_COMPILE) # Unless specified, disable strict try_compile() set(ENABLE_STRICT_TRY_COMPILE FALSE) message(STATUS "[DEFAULTS] Using NON-strict compiler checks by default. ENABLE_STRICT_TRY_COMPILE not provided!") endif() -set(ENABLE_STRICT_TRY_COMPILE_INT ${ENABLE_STRICT_TRY_COMPILE} CACHE BOOL - "Whether or not to use strict compiler checks" FORCE) +set(ENABLE_STRICT_TRY_COMPILE_INT ${ENABLE_STRICT_TRY_COMPILE} + CACHE BOOL "Whether or not to use strict compiler checks" FORCE +) # Get the SDK version information. if(DEFINED SDK_VERSION) @@ -536,20 +565,20 @@ if(DEFINED SDK_VERSION) elseif(DEFINED ENV{_SDK_VERSION}) set(SDK_VERSION "$ENV{_SDK_VERSION}") elseif(NOT DEFINED SDK_VERSION) - execute_process(COMMAND ${XCODEBUILD_EXECUTABLE} -sdk ${CMAKE_OSX_SYSROOT_INT} -version SDKVersion - OUTPUT_VARIABLE SDK_VERSION - ERROR_QUIET - OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process( + COMMAND ${XCODEBUILD_EXECUTABLE} -sdk ${CMAKE_OSX_SYSROOT_INT} -version SDKVersion OUTPUT_VARIABLE SDK_VERSION + ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE + ) endif() # Find the Developer root for the specific iOS platform being compiled for # from CMAKE_OSX_SYSROOT. Should be ../../ from SDK specified in # CMAKE_OSX_SYSROOT. There does not appear to be a direct way to obtain # this information from xcrun or xcodebuild. -if (NOT DEFINED CMAKE_DEVELOPER_ROOT AND NOT CMAKE_GENERATOR MATCHES "Xcode") +if(NOT DEFINED CMAKE_DEVELOPER_ROOT AND NOT CMAKE_GENERATOR MATCHES "Xcode") get_filename_component(PLATFORM_SDK_DIR ${CMAKE_OSX_SYSROOT_INT} PATH) get_filename_component(CMAKE_DEVELOPER_ROOT ${PLATFORM_SDK_DIR} PATH) - if (NOT EXISTS "${CMAKE_DEVELOPER_ROOT}") + if(NOT EXISTS "${CMAKE_DEVELOPER_ROOT}") message(FATAL_ERROR "Invalid CMAKE_DEVELOPER_ROOT: ${CMAKE_DEVELOPER_ROOT} does not exist.") endif() endif() @@ -562,10 +591,10 @@ elseif(DEFINED ENV{_CMAKE_C_COMPILER}) set(CMAKE_C_COMPILER "$ENV{_CMAKE_C_COMPILER}") set(CMAKE_ASM_COMPILER ${CMAKE_C_COMPILER}) elseif(NOT DEFINED CMAKE_C_COMPILER) - execute_process(COMMAND xcrun -sdk ${CMAKE_OSX_SYSROOT_INT} -find clang - OUTPUT_VARIABLE CMAKE_C_COMPILER - ERROR_QUIET - OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process( + COMMAND xcrun -sdk ${CMAKE_OSX_SYSROOT_INT} -find clang OUTPUT_VARIABLE CMAKE_C_COMPILER + ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE + ) set(CMAKE_ASM_COMPILER ${CMAKE_C_COMPILER}) endif() if(DEFINED CMAKE_CXX_COMPILER) @@ -574,10 +603,10 @@ if(DEFINED CMAKE_CXX_COMPILER) elseif(DEFINED ENV{_CMAKE_CXX_COMPILER}) set(CMAKE_CXX_COMPILER "$ENV{_CMAKE_CXX_COMPILER}") elseif(NOT DEFINED CMAKE_CXX_COMPILER) - execute_process(COMMAND xcrun -sdk ${CMAKE_OSX_SYSROOT_INT} -find clang++ - OUTPUT_VARIABLE CMAKE_CXX_COMPILER - ERROR_QUIET - OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process( + COMMAND xcrun -sdk ${CMAKE_OSX_SYSROOT_INT} -find clang++ OUTPUT_VARIABLE CMAKE_CXX_COMPILER + ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE + ) endif() # Find (Apple's) libtool. if(DEFINED BUILD_LIBTOOL) @@ -586,10 +615,10 @@ if(DEFINED BUILD_LIBTOOL) elseif(DEFINED ENV{_BUILD_LIBTOOL}) set(BUILD_LIBTOOL "$ENV{_BUILD_LIBTOOL}") elseif(NOT DEFINED BUILD_LIBTOOL) - execute_process(COMMAND xcrun -sdk ${CMAKE_OSX_SYSROOT_INT} -find libtool - OUTPUT_VARIABLE BUILD_LIBTOOL - ERROR_QUIET - OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process( + COMMAND xcrun -sdk ${CMAKE_OSX_SYSROOT_INT} -find libtool OUTPUT_VARIABLE BUILD_LIBTOOL + ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE + ) endif() # Find the toolchain's provided install_name_tool if none is found on the host if(DEFINED CMAKE_INSTALL_NAME_TOOL) @@ -598,10 +627,10 @@ if(DEFINED CMAKE_INSTALL_NAME_TOOL) elseif(DEFINED ENV{_CMAKE_INSTALL_NAME_TOOL}) set(CMAKE_INSTALL_NAME_TOOL "$ENV{_CMAKE_INSTALL_NAME_TOOL}") elseif(NOT DEFINED CMAKE_INSTALL_NAME_TOOL) - execute_process(COMMAND xcrun -sdk ${CMAKE_OSX_SYSROOT_INT} -find install_name_tool - OUTPUT_VARIABLE CMAKE_INSTALL_NAME_TOOL_INT - ERROR_QUIET - OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process( + COMMAND xcrun -sdk ${CMAKE_OSX_SYSROOT_INT} -find install_name_tool OUTPUT_VARIABLE CMAKE_INSTALL_NAME_TOOL_INT + ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE + ) set(CMAKE_INSTALL_NAME_TOOL ${CMAKE_INSTALL_NAME_TOOL_INT} CACHE INTERNAL "") endif() @@ -610,7 +639,9 @@ endif() # Xcode. get_property(languages GLOBAL PROPERTY ENABLED_LANGUAGES) foreach(lang ${languages}) - set(CMAKE_${lang}_CREATE_STATIC_LIBRARY "${BUILD_LIBTOOL} -static -o " CACHE INTERNAL "") + set(CMAKE_${lang}_CREATE_STATIC_LIBRARY "${BUILD_LIBTOOL} -static -o " CACHE INTERNAL + "" + ) endforeach() # CMake 3.14+ support building for iOS, watchOS and tvOS out of the box. @@ -697,32 +728,24 @@ endif() if(${CMAKE_VERSION} VERSION_LESS "3.11") if(PLATFORM_INT STREQUAL "OS" OR PLATFORM_INT STREQUAL "OS64") if(XCODE_VERSION_INT VERSION_LESS 7.0) - set(SDK_NAME_VERSION_FLAGS - "-mios-version-min=${DEPLOYMENT_TARGET}") + set(SDK_NAME_VERSION_FLAGS "-mios-version-min=${DEPLOYMENT_TARGET}") else() # Xcode 7.0+ uses flags we can build directly from SDK_NAME. - set(SDK_NAME_VERSION_FLAGS - "-m${SDK_NAME}-version-min=${DEPLOYMENT_TARGET}") + set(SDK_NAME_VERSION_FLAGS "-m${SDK_NAME}-version-min=${DEPLOYMENT_TARGET}") endif() elseif(PLATFORM_INT STREQUAL "TVOS") - set(SDK_NAME_VERSION_FLAGS - "-mtvos-version-min=${DEPLOYMENT_TARGET}") + set(SDK_NAME_VERSION_FLAGS "-mtvos-version-min=${DEPLOYMENT_TARGET}") elseif(PLATFORM_INT STREQUAL "SIMULATOR_TVOS") - set(SDK_NAME_VERSION_FLAGS - "-mtvos-simulator-version-min=${DEPLOYMENT_TARGET}") + set(SDK_NAME_VERSION_FLAGS "-mtvos-simulator-version-min=${DEPLOYMENT_TARGET}") elseif(PLATFORM_INT STREQUAL "WATCHOS") - set(SDK_NAME_VERSION_FLAGS - "-mwatchos-version-min=${DEPLOYMENT_TARGET}") + set(SDK_NAME_VERSION_FLAGS "-mwatchos-version-min=${DEPLOYMENT_TARGET}") elseif(PLATFORM_INT STREQUAL "SIMULATOR_WATCHOS") - set(SDK_NAME_VERSION_FLAGS - "-mwatchos-simulator-version-min=${DEPLOYMENT_TARGET}") + set(SDK_NAME_VERSION_FLAGS "-mwatchos-simulator-version-min=${DEPLOYMENT_TARGET}") elseif(PLATFORM_INT STREQUAL "MAC") - set(SDK_NAME_VERSION_FLAGS - "-mmacosx-version-min=${DEPLOYMENT_TARGET}") + set(SDK_NAME_VERSION_FLAGS "-mmacosx-version-min=${DEPLOYMENT_TARGET}") else() # SIMULATOR or SIMULATOR64 both use -mios-simulator-version-min. - set(SDK_NAME_VERSION_FLAGS - "-mios-simulator-version-min=${DEPLOYMENT_TARGET}") + set(SDK_NAME_VERSION_FLAGS "-mios-simulator-version-min=${DEPLOYMENT_TARGET}") endif() elseif(NOT PLATFORM_INT MATCHES "^MAC_CATALYST") # Newer versions of CMake sets the version min flags correctly, skip this for Mac Catalyst targets @@ -737,7 +760,9 @@ if(DEFINED APPLE_TARGET_TRIPLE_INT) endif() if(PLATFORM_INT MATCHES "^MAC_CATALYST") - set(C_TARGET_FLAGS "-isystem ${CMAKE_OSX_SYSROOT_INT}/System/iOSSupport/usr/include -iframework ${CMAKE_OSX_SYSROOT_INT}/System/iOSSupport/System/Library/Frameworks") + set(C_TARGET_FLAGS + "-isystem ${CMAKE_OSX_SYSROOT_INT}/System/iOSSupport/usr/include -iframework ${CMAKE_OSX_SYSROOT_INT}/System/iOSSupport/System/Library/Frameworks" + ) endif() if(ENABLE_BITCODE_INT) @@ -780,15 +805,23 @@ if(CMAKE_GENERATOR MATCHES "Xcode") message(STATUS "Not setting any manual command-line buildflags, since Xcode is selected as generator.") else() # Hidden visibility is required for C++ on iOS. - set(CMAKE_C_FLAGS "${C_TARGET_FLAGS} ${APPLE_TARGET_TRIPLE_FLAG} ${SDK_NAME_VERSION_FLAGS} ${BITCODE} -fobjc-abi-version=2 ${FOBJC_ARC} ${CMAKE_C_FLAGS}") - set(CMAKE_CXX_FLAGS "${C_TARGET_FLAGS} ${APPLE_TARGET_TRIPLE_FLAG} ${SDK_NAME_VERSION_FLAGS} ${BITCODE} ${VISIBILITY} -fobjc-abi-version=2 ${FOBJC_ARC} ${CMAKE_CXX_FLAGS}") + set(CMAKE_C_FLAGS + "${C_TARGET_FLAGS} ${APPLE_TARGET_TRIPLE_FLAG} ${SDK_NAME_VERSION_FLAGS} ${BITCODE} -fobjc-abi-version=2 ${FOBJC_ARC} ${CMAKE_C_FLAGS}" + ) + set(CMAKE_CXX_FLAGS + "${C_TARGET_FLAGS} ${APPLE_TARGET_TRIPLE_FLAG} ${SDK_NAME_VERSION_FLAGS} ${BITCODE} ${VISIBILITY} -fobjc-abi-version=2 ${FOBJC_ARC} ${CMAKE_CXX_FLAGS}" + ) set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -O0 -g ${CMAKE_CXX_FLAGS_DEBUG}") set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS} -DNDEBUG -Os -ffast-math ${CMAKE_CXX_FLAGS_MINSIZEREL}") set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS} -DNDEBUG -O2 -g -ffast-math ${CMAKE_CXX_FLAGS_RELWITHDEBINFO}") set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -DNDEBUG -O3 -ffast-math ${CMAKE_CXX_FLAGS_RELEASE}") set(CMAKE_C_LINK_FLAGS "${C_TARGET_FLAGS} ${SDK_NAME_VERSION_FLAGS} -Wl,-search_paths_first ${CMAKE_C_LINK_FLAGS}") - set(CMAKE_CXX_LINK_FLAGS "${C_TARGET_FLAGS} ${SDK_NAME_VERSION_FLAGS} -Wl,-search_paths_first ${CMAKE_CXX_LINK_FLAGS}") - set(CMAKE_ASM_FLAGS "${CMAKE_C_FLAGS} -x assembler-with-cpp -arch ${CMAKE_OSX_ARCHITECTURES} ${APPLE_TARGET_TRIPLE_FLAG}") + set(CMAKE_CXX_LINK_FLAGS + "${C_TARGET_FLAGS} ${SDK_NAME_VERSION_FLAGS} -Wl,-search_paths_first ${CMAKE_CXX_LINK_FLAGS}" + ) + set(CMAKE_ASM_FLAGS + "${CMAKE_C_FLAGS} -x assembler-with-cpp -arch ${CMAKE_OSX_ARCHITECTURES} ${APPLE_TARGET_TRIPLE_FLAG}" + ) endif() ## Print status messages to inform of the current state @@ -801,8 +834,7 @@ message(STATUS "Using install name tool: ${CMAKE_INSTALL_NAME_TOOL}") if(DEFINED APPLE_TARGET_TRIPLE) message(STATUS "Autoconf target triple: ${APPLE_TARGET_TRIPLE}") endif() -message(STATUS "Using minimum deployment version: ${DEPLOYMENT_TARGET}" - " (SDK version: ${SDK_VERSION})") +message(STATUS "Using minimum deployment version: ${DEPLOYMENT_TARGET}" " (SDK version: ${SDK_VERSION})") if(MODERN_CMAKE) message(STATUS "Merging integrated CMake 3.14+ iOS,tvOS,watchOS,macOS toolchain(s) with this toolchain!") endif() @@ -841,31 +873,31 @@ set_property(GLOBAL PROPERTY OSX_ARCHITECTURES "${CMAKE_OSX_ARCHITECTURES}") # Export configurable variables for the try_compile() command. set(CMAKE_TRY_COMPILE_PLATFORM_VARIABLES - PLATFORM - XCODE_VERSION_INT - SDK_VERSION - DEPLOYMENT_TARGET - CMAKE_DEVELOPER_ROOT - CMAKE_OSX_SYSROOT_INT - ENABLE_BITCODE - ENABLE_ARC - CMAKE_ASM_COMPILER - CMAKE_C_COMPILER - CMAKE_C_COMPILER_TARGET - CMAKE_CXX_COMPILER - CMAKE_CXX_COMPILER_TARGET - BUILD_LIBTOOL - CMAKE_INSTALL_NAME_TOOL - CMAKE_C_FLAGS - CMAKE_CXX_FLAGS - CMAKE_CXX_FLAGS_DEBUG - CMAKE_CXX_FLAGS_MINSIZEREL - CMAKE_CXX_FLAGS_RELWITHDEBINFO - CMAKE_CXX_FLAGS_RELEASE - CMAKE_C_LINK_FLAGS - CMAKE_CXX_LINK_FLAGS - CMAKE_ASM_FLAGS - ) + PLATFORM + XCODE_VERSION_INT + SDK_VERSION + DEPLOYMENT_TARGET + CMAKE_DEVELOPER_ROOT + CMAKE_OSX_SYSROOT_INT + ENABLE_BITCODE + ENABLE_ARC + CMAKE_ASM_COMPILER + CMAKE_C_COMPILER + CMAKE_C_COMPILER_TARGET + CMAKE_CXX_COMPILER + CMAKE_CXX_COMPILER_TARGET + BUILD_LIBTOOL + CMAKE_INSTALL_NAME_TOOL + CMAKE_C_FLAGS + CMAKE_CXX_FLAGS + CMAKE_CXX_FLAGS_DEBUG + CMAKE_CXX_FLAGS_MINSIZEREL + CMAKE_CXX_FLAGS_RELWITHDEBINFO + CMAKE_CXX_FLAGS_RELEASE + CMAKE_C_LINK_FLAGS + CMAKE_CXX_LINK_FLAGS + CMAKE_ASM_FLAGS +) set(CMAKE_PLATFORM_HAS_INSTALLNAME 1) set(CMAKE_SHARED_LINKER_FLAGS "-rpath @executable_path/Frameworks -rpath @loader_path/Frameworks") @@ -887,17 +919,15 @@ endif() set(CMAKE_FIND_FRAMEWORK FIRST) # Set up the default search directories for frameworks. -if(PLATFORM_INT MATCHES "^MAC_CATALYST") +if(PLATFORM_INT MATCHES "^MAC_CATALYST") set(CMAKE_FRAMEWORK_PATH - ${CMAKE_DEVELOPER_ROOT}/Library/PrivateFrameworks - ${CMAKE_OSX_SYSROOT_INT}/System/Library/Frameworks - ${CMAKE_OSX_SYSROOT_INT}/System/iOSSupport/System/Library/Frameworks - ${CMAKE_FRAMEWORK_PATH} CACHE INTERNAL "") + ${CMAKE_DEVELOPER_ROOT}/Library/PrivateFrameworks ${CMAKE_OSX_SYSROOT_INT}/System/Library/Frameworks + ${CMAKE_OSX_SYSROOT_INT}/System/iOSSupport/System/Library/Frameworks ${CMAKE_FRAMEWORK_PATH} CACHE INTERNAL "" + ) else() - set(CMAKE_FRAMEWORK_PATH - ${CMAKE_DEVELOPER_ROOT}/Library/PrivateFrameworks - ${CMAKE_OSX_SYSROOT_INT}/System/Library/Frameworks - ${CMAKE_FRAMEWORK_PATH} CACHE INTERNAL "") + set(CMAKE_FRAMEWORK_PATH ${CMAKE_DEVELOPER_ROOT}/Library/PrivateFrameworks + ${CMAKE_OSX_SYSROOT_INT}/System/Library/Frameworks ${CMAKE_FRAMEWORK_PATH} CACHE INTERNAL "" + ) endif() # By default, search both the specified iOS SDK and the remainder of the host filesystem. @@ -924,7 +954,9 @@ macro(set_xcode_property TARGET XCODE_PROPERTY XCODE_VALUE XCODE_RELVERSION) if(XCODE_RELVERSION_I STREQUAL "All") set_property(TARGET ${TARGET} PROPERTY XCODE_ATTRIBUTE_${XCODE_PROPERTY} "${XCODE_VALUE}") else() - set_property(TARGET ${TARGET} PROPERTY XCODE_ATTRIBUTE_${XCODE_PROPERTY}[variant=${XCODE_RELVERSION_I}] "${XCODE_VALUE}") + set_property( + TARGET ${TARGET} PROPERTY XCODE_ATTRIBUTE_${XCODE_PROPERTY}[variant=${XCODE_RELVERSION_I}] "${XCODE_VALUE}" + ) endif() endmacro(set_xcode_property) diff --git a/cmake/pkg-config-install-prefix.cmake b/cmake/pkg-config-install-prefix.cmake index 600b2f7bd..cac331c1d 100644 --- a/cmake/pkg-config-install-prefix.cmake +++ b/cmake/pkg-config-install-prefix.cmake @@ -1,13 +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}") +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}) + 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 index 250d99d59..090497730 100644 --- a/cmake/today.cmake +++ b/cmake/today.cmake @@ -2,13 +2,13 @@ # # 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 - ) - else() - STRING(TIMESTAMP ${RESULT} "%Y-%m-%d" UTC) - endif() -ENDMACRO (TODAY) +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 + ) + else() + string(TIMESTAMP ${RESULT} "%Y-%m-%d" UTC) + endif() +endmacro(TODAY) diff --git a/docs/mingw-example/toolchain/cmake/aarch64-w64-mingw32-toolchain.cmake b/docs/mingw-example/toolchain/cmake/aarch64-w64-mingw32-toolchain.cmake index d144eb4ea..d89219596 100644 --- a/docs/mingw-example/toolchain/cmake/aarch64-w64-mingw32-toolchain.cmake +++ b/docs/mingw-example/toolchain/cmake/aarch64-w64-mingw32-toolchain.cmake @@ -12,4 +12,4 @@ string(STRIP ${TOOLCHAIN_DLLTOOL} TOOLCHAIN_DLLTOOL) set(DLLTOOL ${TOOLCHAIN_DLLTOOL}) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) -set(CMAKE_SYSTEM_NAME Windows) \ No newline at end of file +set(CMAKE_SYSTEM_NAME Windows) diff --git a/docs/mingw-example/toolchain/cmake/i686-w64-mingw32-toolchain.cmake b/docs/mingw-example/toolchain/cmake/i686-w64-mingw32-toolchain.cmake index 3cffb81ff..85ea20f64 100644 --- a/docs/mingw-example/toolchain/cmake/i686-w64-mingw32-toolchain.cmake +++ b/docs/mingw-example/toolchain/cmake/i686-w64-mingw32-toolchain.cmake @@ -12,4 +12,4 @@ string(STRIP ${TOOLCHAIN_DLLTOOL} TOOLCHAIN_DLLTOOL) set(DLLTOOL ${TOOLCHAIN_DLLTOOL}) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) -set(CMAKE_SYSTEM_NAME Windows) \ No newline at end of file +set(CMAKE_SYSTEM_NAME Windows) diff --git a/docs/mingw-example/toolchain/cmake/x86_64-w64-mingw32-toolchain.cmake b/docs/mingw-example/toolchain/cmake/x86_64-w64-mingw32-toolchain.cmake index 19d9a585e..15bb9797f 100644 --- a/docs/mingw-example/toolchain/cmake/x86_64-w64-mingw32-toolchain.cmake +++ b/docs/mingw-example/toolchain/cmake/x86_64-w64-mingw32-toolchain.cmake @@ -12,4 +12,4 @@ string(STRIP ${TOOLCHAIN_DLLTOOL} TOOLCHAIN_DLLTOOL) set(DLLTOOL ${TOOLCHAIN_DLLTOOL}) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) -set(CMAKE_SYSTEM_NAME Windows) \ No newline at end of file +set(CMAKE_SYSTEM_NAME Windows) diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt index cc387246b..7d38d900a 100644 --- a/include/CMakeLists.txt +++ b/include/CMakeLists.txt @@ -28,86 +28,90 @@ file(TO_NATIVE_PATH "${FREERDP_LIBRARY_PATH}" NATIVE_FREERDP_LIBRARY_PATH) file(TO_NATIVE_PATH "${FREERDP_ADDIN_PATH}" NATIVE_FREERDP_ADDIN_PATH) file(TO_NATIVE_PATH "${FREERDP_PROXY_PLUGINDIR}" NATIVE_FREERDP_PROXY_PLUGINDIR) -if (WIN32) - string(REPLACE "\\" "\\\\" NATIVE_FREERDP_DATA_PATH "${NATIVE_FREERDP_DATA_PATH}") - string(REPLACE "\\" "\\\\" NATIVE_FREERDP_KEYMAP_PATH "${NATIVE_FREERDP_KEYMAP_PATH}") - string(REPLACE "\\" "\\\\" NATIVE_FREERDP_PLUGIN_PATH "${NATIVE_FREERDP_PLUGIN_PATH}") - string(REPLACE "\\" "\\\\" NATIVE_FREERDP_INSTALL_PREFIX "${NATIVE_FREERDP_INSTALL_PREFIX}") - string(REPLACE "\\" "\\\\" NATIVE_FREERDP_LIBRARY_PATH "${NATIVE_FREERDP_LIBRARY_PATH}") - string(REPLACE "\\" "\\\\" NATIVE_FREERDP_ADDIN_PATH "${NATIVE_FREERDP_ADDIN_PATH}") - string(REPLACE "\\" "\\\\" NATIVE_FREERDP_PROXY_PLUGINDIR "${NATIVE_FREERDP_PROXY_PLUGINDIR}") +if(WIN32) + string(REPLACE "\\" "\\\\" NATIVE_FREERDP_DATA_PATH "${NATIVE_FREERDP_DATA_PATH}") + string(REPLACE "\\" "\\\\" NATIVE_FREERDP_KEYMAP_PATH "${NATIVE_FREERDP_KEYMAP_PATH}") + string(REPLACE "\\" "\\\\" NATIVE_FREERDP_PLUGIN_PATH "${NATIVE_FREERDP_PLUGIN_PATH}") + string(REPLACE "\\" "\\\\" NATIVE_FREERDP_INSTALL_PREFIX "${NATIVE_FREERDP_INSTALL_PREFIX}") + string(REPLACE "\\" "\\\\" NATIVE_FREERDP_LIBRARY_PATH "${NATIVE_FREERDP_LIBRARY_PATH}") + string(REPLACE "\\" "\\\\" NATIVE_FREERDP_ADDIN_PATH "${NATIVE_FREERDP_ADDIN_PATH}") + string(REPLACE "\\" "\\\\" NATIVE_FREERDP_PROXY_PLUGINDIR "${NATIVE_FREERDP_PROXY_PLUGINDIR}") endif() include(CFlagsToVar) -CFlagsToVar(C_FLAGS) +cflagstovar(C_FLAGS) cleaning_configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config/version.h.in ${CMAKE_CURRENT_BINARY_DIR}/freerdp/version.h) -cleaning_configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config/build-config.h.in ${CMAKE_CURRENT_BINARY_DIR}/freerdp/build-config.h) +cleaning_configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/config/build-config.h.in ${CMAKE_CURRENT_BINARY_DIR}/freerdp/build-config.h +) cleaning_configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/freerdp/config.h) -cleaning_configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config/buildflags.h.in ${CMAKE_CURRENT_BINARY_DIR}/freerdp/buildflags.h) +cleaning_configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/config/buildflags.h.in ${CMAKE_CURRENT_BINARY_DIR}/freerdp/buildflags.h +) file(STRINGS freerdp/settings_types_private.h SETTINGS_KEYS REGEX "ALIGN64[ \ta-zA-Z0-9]*") -set (SETTINGS_KEYS_BOOL "") -set (SETTINGS_KEYS_INT16 "") -set (SETTINGS_KEYS_UINT16 "") -set (SETTINGS_KEYS_INT32 "") -set (SETTINGS_KEYS_UINT32 "") -set (SETTINGS_KEYS_INT64 "") -set (SETTINGS_KEYS_UINT64 "") -set (SETTINGS_KEYS_STRING "") -set (SETTINGS_KEYS_POINTER "") +set(SETTINGS_KEYS_BOOL "") +set(SETTINGS_KEYS_INT16 "") +set(SETTINGS_KEYS_UINT16 "") +set(SETTINGS_KEYS_INT32 "") +set(SETTINGS_KEYS_UINT32 "") +set(SETTINGS_KEYS_INT64 "") +set(SETTINGS_KEYS_UINT64 "") +set(SETTINGS_KEYS_STRING "") +set(SETTINGS_KEYS_POINTER "") foreach(KEY ${SETTINGS_KEYS}) - string(STRIP "${KEY}" TRIMMED_KEY) - string(REGEX MATCH "^SETTINGS_DEPRECATED\\(ALIGN64[ \t ]+BOOL[ \t ]+" IS_BOOL "${TRIMMED_KEY}") - string(REGEX MATCH "^SETTINGS_DEPRECATED\\(ALIGN64[ \t ]+INT16[ \t ]+" IS_INT16 "${TRIMMED_KEY}") - string(REGEX MATCH "^SETTINGS_DEPRECATED\\(ALIGN64[ \t ]+UINT16[ \t ]+" IS_UINT16 "${TRIMMED_KEY}") - string(REGEX MATCH "^SETTINGS_DEPRECATED\\(ALIGN64[ \t ]+INT32[ \t ]+" IS_INT32 "${TRIMMED_KEY}") - string(REGEX MATCH "^SETTINGS_DEPRECATED\\(ALIGN64[ \t ]+UINT32[ \t ]+" IS_UINT32 "${TRIMMED_KEY}") - string(REGEX MATCH "^SETTINGS_DEPRECATED\\(ALIGN64[ \t ]+INT64[ \t ]+" IS_INT64 "${TRIMMED_KEY}") - string(REGEX MATCH "^SETTINGS_DEPRECATED\\(ALIGN64[ \t ]+UINT64[ \t ]+" IS_UINT64 "${TRIMMED_KEY}") - string(REGEX MATCH "^SETTINGS_DEPRECATED\\(ALIGN64[ \t ]+(char|CHAR)[ \t ]*\\*[ \t ]+" IS_STRING "${TRIMMED_KEY}") + string(STRIP "${KEY}" TRIMMED_KEY) + string(REGEX MATCH "^SETTINGS_DEPRECATED\\(ALIGN64[ \t ]+BOOL[ \t ]+" IS_BOOL "${TRIMMED_KEY}") + string(REGEX MATCH "^SETTINGS_DEPRECATED\\(ALIGN64[ \t ]+INT16[ \t ]+" IS_INT16 "${TRIMMED_KEY}") + string(REGEX MATCH "^SETTINGS_DEPRECATED\\(ALIGN64[ \t ]+UINT16[ \t ]+" IS_UINT16 "${TRIMMED_KEY}") + string(REGEX MATCH "^SETTINGS_DEPRECATED\\(ALIGN64[ \t ]+INT32[ \t ]+" IS_INT32 "${TRIMMED_KEY}") + string(REGEX MATCH "^SETTINGS_DEPRECATED\\(ALIGN64[ \t ]+UINT32[ \t ]+" IS_UINT32 "${TRIMMED_KEY}") + string(REGEX MATCH "^SETTINGS_DEPRECATED\\(ALIGN64[ \t ]+INT64[ \t ]+" IS_INT64 "${TRIMMED_KEY}") + string(REGEX MATCH "^SETTINGS_DEPRECATED\\(ALIGN64[ \t ]+UINT64[ \t ]+" IS_UINT64 "${TRIMMED_KEY}") + string(REGEX MATCH "^SETTINGS_DEPRECATED\\(ALIGN64[ \t ]+(char|CHAR)[ \t ]*\\*[ \t ]+" IS_STRING "${TRIMMED_KEY}") - string(REGEX REPLACE ".+/\\*" "" index "${TRIMMED_KEY}") - string(REGEX REPLACE "[ \t/\\*]" "" index "${index}") + string(REGEX REPLACE ".+/\\*" "" index "${TRIMMED_KEY}") + string(REGEX REPLACE "[ \t/\\*]" "" index "${index}") - if (index MATCHES "^[0-9]+$") - string(REGEX REPLACE "^SETTINGS_DEPRECATED\\(ALIGN64[ \t ]+[a-zA-Z0-9_\\*]+[ \t ]+" "" VALUE ${TRIMMED_KEY}) - string(STRIP "${VALUE}" VALUE) - string(FIND "${VALUE}" ")" SEMICOLON) - string(SUBSTRING "${VALUE}" 0 ${SEMICOLON} KEY_VALUE) + if(index MATCHES "^[0-9]+$") + string(REGEX REPLACE "^SETTINGS_DEPRECATED\\(ALIGN64[ \t ]+[a-zA-Z0-9_\\*]+[ \t ]+" "" VALUE ${TRIMMED_KEY}) + string(STRIP "${VALUE}" VALUE) + string(FIND "${VALUE}" ")" SEMICOLON) + string(SUBSTRING "${VALUE}" 0 ${SEMICOLON} KEY_VALUE) - if (IS_BOOL) - set(KEY_VALUE "FreeRDP_${KEY_VALUE} = ${index}") - list(APPEND SETTINGS_KEYS_BOOL ${KEY_VALUE}) - elseif(IS_INT16) - set(KEY_VALUE "FreeRDP_${KEY_VALUE} = ${index}") - list(APPEND SETTINGS_KEYS_INT16 ${KEY_VALUE}) - elseif(IS_UINT16) - set(KEY_VALUE "FreeRDP_${KEY_VALUE} = ${index}") - list(APPEND SETTINGS_KEYS_UINT16 ${KEY_VALUE}) - elseif(IS_INT32) - set(KEY_VALUE "FreeRDP_${KEY_VALUE} = ${index}") - list(APPEND SETTINGS_KEYS_INT32 ${KEY_VALUE}) - elseif(IS_UINT32) - set(KEY_VALUE "FreeRDP_${KEY_VALUE} = ${index}") - list(APPEND SETTINGS_KEYS_UINT32 ${KEY_VALUE}) - elseif(IS_INT64) - set(KEY_VALUE "FreeRDP_${KEY_VALUE} = ${index}") - list(APPEND SETTINGS_KEYS_INT64 ${KEY_VALUE}) - elseif(IS_UINT64) - set(KEY_VALUE "FreeRDP_${KEY_VALUE} = ${index}") - list(APPEND SETTINGS_KEYS_UINT64 ${KEY_VALUE}) - elseif(IS_STRING) - string(SUBSTRING "${VALUE}" 0 ${SEMICOLON} KEY_VALUE) - set(KEY_VALUE "FreeRDP_${KEY_VALUE} = ${index}") - list(APPEND SETTINGS_KEYS_STRING ${KEY_VALUE}) - else() - set(KEY_VALUE "FreeRDP_${KEY_VALUE} = ${index}") - list(APPEND SETTINGS_KEYS_POINTER ${KEY_VALUE}) - endif() + if(IS_BOOL) + set(KEY_VALUE "FreeRDP_${KEY_VALUE} = ${index}") + list(APPEND SETTINGS_KEYS_BOOL ${KEY_VALUE}) + elseif(IS_INT16) + set(KEY_VALUE "FreeRDP_${KEY_VALUE} = ${index}") + list(APPEND SETTINGS_KEYS_INT16 ${KEY_VALUE}) + elseif(IS_UINT16) + set(KEY_VALUE "FreeRDP_${KEY_VALUE} = ${index}") + list(APPEND SETTINGS_KEYS_UINT16 ${KEY_VALUE}) + elseif(IS_INT32) + set(KEY_VALUE "FreeRDP_${KEY_VALUE} = ${index}") + list(APPEND SETTINGS_KEYS_INT32 ${KEY_VALUE}) + elseif(IS_UINT32) + set(KEY_VALUE "FreeRDP_${KEY_VALUE} = ${index}") + list(APPEND SETTINGS_KEYS_UINT32 ${KEY_VALUE}) + elseif(IS_INT64) + set(KEY_VALUE "FreeRDP_${KEY_VALUE} = ${index}") + list(APPEND SETTINGS_KEYS_INT64 ${KEY_VALUE}) + elseif(IS_UINT64) + set(KEY_VALUE "FreeRDP_${KEY_VALUE} = ${index}") + list(APPEND SETTINGS_KEYS_UINT64 ${KEY_VALUE}) + elseif(IS_STRING) + string(SUBSTRING "${VALUE}" 0 ${SEMICOLON} KEY_VALUE) + set(KEY_VALUE "FreeRDP_${KEY_VALUE} = ${index}") + list(APPEND SETTINGS_KEYS_STRING ${KEY_VALUE}) + else() + set(KEY_VALUE "FreeRDP_${KEY_VALUE} = ${index}") + list(APPEND SETTINGS_KEYS_POINTER ${KEY_VALUE}) endif() + endif() endforeach() list(APPEND SETTINGS_KEYS_BOOL "FreeRDP_BOOL_UNUSED = -1") @@ -130,64 +134,46 @@ string(REPLACE ";" ",\n\t" SETTINGS_KEYS_UINT64 "${SETTINGS_KEYS_UINT64}") string(REPLACE ";" ",\n\t" SETTINGS_KEYS_STRING "${SETTINGS_KEYS_STRING}") string(REPLACE ";" ",\n\t" SETTINGS_KEYS_POINTER "${SETTINGS_KEYS_POINTER}") -cleaning_configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config/settings_keys.h.in ${CMAKE_CURRENT_BINARY_DIR}/freerdp/settings_keys.h) +cleaning_configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/config/settings_keys.h.in ${CMAKE_CURRENT_BINARY_DIR}/freerdp/settings_keys.h +) -file(GLOB_RECURSE PUBLIC_COMMON_HEADERS - LIST_DIRECTORIES false - "freerdp/*.h" -) -file(GLOB_RECURSE PUBLIC_COMMON_BIN_HEADERS - LIST_DIRECTORIES false - "${CMAKE_CURRENT_BINARY_DIR}/freerdp/*.h" -) +file(GLOB_RECURSE PUBLIC_COMMON_HEADERS LIST_DIRECTORIES false "freerdp/*.h") +file(GLOB_RECURSE PUBLIC_COMMON_BIN_HEADERS LIST_DIRECTORIES false "${CMAKE_CURRENT_BINARY_DIR}/freerdp/*.h") list(SORT PUBLIC_COMMON_HEADERS) -if (WITH_SERVER) - set(PUBLIC_SERVER_HEADERS ${PUBLIC_COMMON_HEADERS}) - list(FILTER PUBLIC_SERVER_HEADERS INCLUDE REGEX ".*freerdp/server.*") +if(WITH_SERVER) + set(PUBLIC_SERVER_HEADERS ${PUBLIC_COMMON_HEADERS}) + list(FILTER PUBLIC_SERVER_HEADERS INCLUDE REGEX ".*freerdp/server.*") - set(PUBLIC_PROXY_HEADERS ${PUBLIC_SERVER_HEADERS}) - list(FILTER PUBLIC_SERVER_HEADERS EXCLUDE REGEX ".*freerdp/server/proxy.*") - list(FILTER PUBLIC_PROXY_HEADERS INCLUDE REGEX ".*freerdp/server/proxy.*") - if (WITH_SERVER) - set_property(TARGET freerdp-server APPEND PROPERTY SOURCES - ${PUBLIC_SERVER_HEADERS} - ) - endif() - if (WITH_PROXY) - set_property(TARGET freerdp-server-proxy APPEND PROPERTY SOURCES - ${PUBLIC_PROXY_HEADERS} - ) - endif() + set(PUBLIC_PROXY_HEADERS ${PUBLIC_SERVER_HEADERS}) + list(FILTER PUBLIC_SERVER_HEADERS EXCLUDE REGEX ".*freerdp/server/proxy.*") + list(FILTER PUBLIC_PROXY_HEADERS INCLUDE REGEX ".*freerdp/server/proxy.*") + if(WITH_SERVER) + set_property(TARGET freerdp-server APPEND PROPERTY SOURCES ${PUBLIC_SERVER_HEADERS}) + endif() + if(WITH_PROXY) + set_property(TARGET freerdp-server-proxy APPEND PROPERTY SOURCES ${PUBLIC_PROXY_HEADERS}) + endif() endif() -if (WITH_CLIENT_COMMON) - set(PUBLIC_CLIENT_HEADERS ${PUBLIC_COMMON_HEADERS}) - list(FILTER PUBLIC_CLIENT_HEADERS INCLUDE REGEX ".*freerdp/client.*") - set_property( TARGET freerdp-client APPEND PROPERTY SOURCES - ${PUBLIC_CLIENT_HEADERS} - ) +if(WITH_CLIENT_COMMON) + set(PUBLIC_CLIENT_HEADERS ${PUBLIC_COMMON_HEADERS}) + list(FILTER PUBLIC_CLIENT_HEADERS INCLUDE REGEX ".*freerdp/client.*") + set_property(TARGET freerdp-client APPEND PROPERTY SOURCES ${PUBLIC_CLIENT_HEADERS}) endif() -if (WITH_SERVER) - list(FILTER PUBLIC_COMMON_HEADERS EXCLUDE REGEX ".*freerdp/server.*") +if(WITH_SERVER) + list(FILTER PUBLIC_COMMON_HEADERS EXCLUDE REGEX ".*freerdp/server.*") endif() list(FILTER PUBLIC_COMMON_HEADERS EXCLUDE REGEX ".*freerdp/client.*") list(APPEND PUBLIC_COMMON_HEADERS ${PUBLIC_COMMON_BIN_HEADERS}) -set_property(TARGET freerdp APPEND PROPERTY SOURCES - ${PUBLIC_COMMON_HEADERS} -) +set_property(TARGET freerdp APPEND PROPERTY SOURCES ${PUBLIC_COMMON_HEADERS}) add_library(freerdp-headers INTERFACE) -target_sources(freerdp-headers INTERFACE - ${PUBLIC_COMMON_HEADERS} -) +target_sources(freerdp-headers INTERFACE ${PUBLIC_COMMON_HEADERS}) -install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/freerdp - DESTINATION ${FREERDP_INCLUDE_DIR} - FILES_MATCHING PATTERN "*.h") +install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/freerdp DESTINATION ${FREERDP_INCLUDE_DIR} FILES_MATCHING PATTERN "*.h") -install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/freerdp - DESTINATION ${FREERDP_INCLUDE_DIR} - FILES_MATCHING PATTERN "*.h") +install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/freerdp DESTINATION ${FREERDP_INCLUDE_DIR} FILES_MATCHING PATTERN "*.h") diff --git a/libfreerdp/CMakeLists.txt b/libfreerdp/CMakeLists.txt index b6be5d9fe..1aee01888 100644 --- a/libfreerdp/CMakeLists.txt +++ b/libfreerdp/CMakeLists.txt @@ -20,13 +20,13 @@ set(MODULE_PREFIX "FREERDP") option(FREERDP_USE_VENDOR_PRODUCT_CONFIG_DIR "Use / path for resources" OFF) set(FREERDP_RESOURCE_ROOT ${CMAKE_INSTALL_FULL_DATAROOTDIR}) -if (FREERDP_USE_VENDOR_PRODUCT_CONFIG_DIR) - string(APPEND FREERDP_RESOURCE_ROOT "/${VENDOR}") +if(FREERDP_USE_VENDOR_PRODUCT_CONFIG_DIR) + string(APPEND FREERDP_RESOURCE_ROOT "/${VENDOR}") endif() string(APPEND FREERDP_RESOURCE_ROOT "/${PRODUCT}") -if (WITH_RESOURCE_VERSIONING) - string(APPEND FREERDP_RESOURCE_ROOT "${FREERDP_VERSION_MAJOR}") +if(WITH_RESOURCE_VERSIONING) + string(APPEND FREERDP_RESOURCE_ROOT "${FREERDP_VERSION_MAJOR}") endif() # CMake modules includes @@ -40,160 +40,152 @@ set(LIBFREERDP_INCLUDES "") set(LIBFREERDP_DEFINITIONS "") set(LIBFREERDP_COMPILE_OPTIONS "") -macro (freerdp_module_add) - file (RELATIVE_PATH _relPath "${LIBFREERDP_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}") - foreach (_src ${ARGN}) - if (_relPath) - list (APPEND LIBFREERDP_SRCS "${_relPath}/${_src}") - else() - list (APPEND LIBFREERDP_SRCS "${_src}") - endif() - endforeach() - if (_relPath) - set (LIBFREERDP_SRCS ${LIBFREERDP_SRCS} PARENT_SCOPE) - endif() +macro(freerdp_module_add) + file(RELATIVE_PATH _relPath "${LIBFREERDP_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}") + foreach(_src ${ARGN}) + if(_relPath) + list(APPEND LIBFREERDP_SRCS "${_relPath}/${_src}") + else() + list(APPEND LIBFREERDP_SRCS "${_src}") + endif() + endforeach() + if(_relPath) + set(LIBFREERDP_SRCS ${LIBFREERDP_SRCS} PARENT_SCOPE) + endif() endmacro() -macro (freerdp_include_directory_add) - file (RELATIVE_PATH _relPath "${LIBFREERDP_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}") - foreach (_inc ${ARGN}) - if (IS_ABSOLUTE ${_inc}) - list (APPEND LIBFREERDP_INCLUDES "${_inc}") - else() - if (_relPath) - list (APPEND LIBFREERDP_INCLUDES "${_relPath}/${_inc}") - else() - list (APPEND LIBFREERDP_INCLUDES "${_inc}") - endif() - endif() - endforeach() - if (_relPath) - set (LIBFREERDP_INCLUDES ${LIBFREERDP_INCLUDES} PARENT_SCOPE) - endif() +macro(freerdp_include_directory_add) + file(RELATIVE_PATH _relPath "${LIBFREERDP_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}") + foreach(_inc ${ARGN}) + if(IS_ABSOLUTE ${_inc}) + list(APPEND LIBFREERDP_INCLUDES "${_inc}") + else() + if(_relPath) + list(APPEND LIBFREERDP_INCLUDES "${_relPath}/${_inc}") + else() + list(APPEND LIBFREERDP_INCLUDES "${_inc}") + endif() + endif() + endforeach() + if(_relPath) + set(LIBFREERDP_INCLUDES ${LIBFREERDP_INCLUDES} PARENT_SCOPE) + endif() endmacro() -macro (freerdp_library_add_public) - foreach (_lib ${ARGN}) - list (APPEND LIBFREERDP_PUB_LIBS "${_lib}") - endforeach() - set (LIBFREERDP_PUB_LIBS ${LIBFREERDP_PUB_LIBS} PARENT_SCOPE) +macro(freerdp_library_add_public) + foreach(_lib ${ARGN}) + list(APPEND LIBFREERDP_PUB_LIBS "${_lib}") + endforeach() + set(LIBFREERDP_PUB_LIBS ${LIBFREERDP_PUB_LIBS} PARENT_SCOPE) endmacro() -macro (freerdp_object_library_add) - foreach (_lib ${ARGN}) - list (APPEND LIBFREERDP_OBJECT_LIBS "$") - endforeach() - set (LIBFREERDP_OBJECT_LIBS ${LIBFREERDP_OBJECT_LIBS} PARENT_SCOPE) +macro(freerdp_object_library_add) + foreach(_lib ${ARGN}) + list(APPEND LIBFREERDP_OBJECT_LIBS "$") + endforeach() + set(LIBFREERDP_OBJECT_LIBS ${LIBFREERDP_OBJECT_LIBS} PARENT_SCOPE) endmacro() -macro (freerdp_library_add) - foreach (_lib ${ARGN}) - list (APPEND LIBFREERDP_LIBS "${_lib}") - endforeach() - set (LIBFREERDP_LIBS ${LIBFREERDP_LIBS} PARENT_SCOPE) +macro(freerdp_library_add) + foreach(_lib ${ARGN}) + list(APPEND LIBFREERDP_LIBS "${_lib}") + endforeach() + set(LIBFREERDP_LIBS ${LIBFREERDP_LIBS} PARENT_SCOPE) endmacro() -macro (freerdp_definition_add) - foreach (_define ${ARGN}) - list (APPEND LIBFREERDP_DEFINITIONS "${_define}") - endforeach() - set (LIBFREERDP_DEFINITIONS ${LIBFREERDP_DEFINITIONS} PARENT_SCOPE) +macro(freerdp_definition_add) + foreach(_define ${ARGN}) + list(APPEND LIBFREERDP_DEFINITIONS "${_define}") + endforeach() + set(LIBFREERDP_DEFINITIONS ${LIBFREERDP_DEFINITIONS} PARENT_SCOPE) endmacro() -macro (freerdp_compile_options_add) - foreach (_lib ${ARGN}) - list (APPEND LIBFREERDP_COMPILE_OPTIONS "${_lib}") - endforeach() - set (LIBFREERDP_COMPILE_OPTIONS ${LIBFREERDP_COMPILE_OPTIONS} PARENT_SCOPE) +macro(freerdp_compile_options_add) + foreach(_lib ${ARGN}) + list(APPEND LIBFREERDP_COMPILE_OPTIONS "${_lib}") + endforeach() + set(LIBFREERDP_COMPILE_OPTIONS ${LIBFREERDP_COMPILE_OPTIONS} PARENT_SCOPE) endmacro() option(WITH_FDK_AAC "Enable FDK_AAC support" OFF) -if (WITH_FDK_AAC) - find_package(PkgConfig REQUIRED) - pkg_check_modules(FDK_AAC REQUIRED fdk-aac) +if(WITH_FDK_AAC) + find_package(PkgConfig REQUIRED) + pkg_check_modules(FDK_AAC REQUIRED fdk-aac) - add_definitions(-DWITH_FDK_AAC) - include_directories(SYSTEM ${FDK_AAC_INCLUDE_DIRS}) + add_definitions(-DWITH_FDK_AAC) + include_directories(SYSTEM ${FDK_AAC_INCLUDE_DIRS}) - link_directories(${FDK_AAC_LIBRARY_DIRS}) - freerdp_library_add(${FDK_AAC_LIBRARIES}) + link_directories(${FDK_AAC_LIBRARY_DIRS}) + freerdp_library_add(${FDK_AAC_LIBRARIES}) endif() set(OPUS_DEFAULT OFF) -if (NOT WITH_DSP_FFMPEG) - find_package(Opus) - if (Opus_FOUND) - set(OPUS_DEFAULT ${OPUS_FOUND}) - else() - find_package(PkgConfig) - if (PkgConfig_FOUND) - pkg_check_modules(OPUS opus) - set(OPUS_DEFAULT ${OPUS_FOUND}) - endif() - endif() +if(NOT WITH_DSP_FFMPEG) + find_package(Opus) + if(Opus_FOUND) + set(OPUS_DEFAULT ${OPUS_FOUND}) + else() + find_package(PkgConfig) + if(PkgConfig_FOUND) + pkg_check_modules(OPUS opus) + set(OPUS_DEFAULT ${OPUS_FOUND}) + endif() + endif() - message("Using OPUS: ${OPUS_DEFAULT}") + message("Using OPUS: ${OPUS_DEFAULT}") endif() option(WITH_OPUS "compile with opus codec support" ${OPUS_DEFAULT}) -if (WITH_OPUS) - find_package(Opus) - if (Opus_FOUND) - freerdp_library_add(${OPUS_LIBRARIES}) - else() - find_package(PkgConfig REQUIRED) - pkg_check_modules(OPUS REQUIRED opus) - freerdp_library_add(${OPUS_LIBRARIES}) - freerdp_include_directory_add(${OPUS_INCLUDE_DIRS}) - link_directories(${OPUS_LIBRARY_DIRS}) - endif() +if(WITH_OPUS) + find_package(Opus) + if(Opus_FOUND) + freerdp_library_add(${OPUS_LIBRARIES}) + else() + find_package(PkgConfig REQUIRED) + pkg_check_modules(OPUS REQUIRED opus) + freerdp_library_add(${OPUS_LIBRARIES}) + freerdp_include_directory_add(${OPUS_INCLUDE_DIRS}) + link_directories(${OPUS_LIBRARY_DIRS}) + endif() endif() -if (WITH_SWSCALE) - find_package(FFmpeg REQUIRED COMPONENTS SWSCALE) +if(WITH_SWSCALE) + find_package(FFmpeg REQUIRED COMPONENTS SWSCALE) endif(WITH_SWSCALE) -if (WITH_CAIRO) - find_package(Cairo REQUIRED) +if(WITH_CAIRO) + find_package(Cairo REQUIRED) endif(WITH_CAIRO) # Prefer SWScale over Cairo, both at the same time are not possible. -if (WITH_SWSCALE) - include_directories(SYSTEM ${SWSCALE_INCLUDE_DIRS}) - freerdp_library_add(${SWSCALE_LIBRARIES}) +if(WITH_SWSCALE) + include_directories(SYSTEM ${SWSCALE_INCLUDE_DIRS}) + freerdp_library_add(${SWSCALE_LIBRARIES}) endif() -if (WITH_CAIRO) - include_directories(SYSTEM ${CAIRO_INCLUDE_DIR}) - freerdp_library_add(${CAIRO_LIBRARY}) +if(WITH_CAIRO) + include_directories(SYSTEM ${CAIRO_INCLUDE_DIR}) + freerdp_library_add(${CAIRO_LIBRARY}) endif() -if (NOT WITH_SWSCALE AND NOT WITH_CAIRO) - message(WARNING "-DWITH_SWSCALE=OFF and -DWITH_CAIRO=OFF, compiling without image scaling support!") +if(NOT WITH_SWSCALE AND NOT WITH_CAIRO) + message(WARNING "-DWITH_SWSCALE=OFF and -DWITH_CAIRO=OFF, compiling without image scaling support!") endif() -set(${MODULE_PREFIX}_SUBMODULES - emu - utils - common - gdi - cache - crypto - locale - core) +set(${MODULE_PREFIX}_SUBMODULES emu utils common gdi cache crypto locale core) foreach(${MODULE_PREFIX}_SUBMODULE ${${MODULE_PREFIX}_SUBMODULES}) - add_subdirectory(${${MODULE_PREFIX}_SUBMODULE}) + add_subdirectory(${${MODULE_PREFIX}_SUBMODULE}) endforeach() -if (NOT WITH_DSP_FFMPEG AND NOT WITH_FAAC AND NOT WITH_FDK_AAC) - message(WARNING "Compiling without WITH_DSP_FFMPEG, WITH_FAAC and WITH_FDK_AAC. AAC encoder support disabled") -endif () +if(NOT WITH_DSP_FFMPEG AND NOT WITH_FAAC AND NOT WITH_FDK_AAC) + message(WARNING "Compiling without WITH_DSP_FFMPEG, WITH_FAAC and WITH_FDK_AAC. AAC encoder support disabled") +endif() add_subdirectory(codec) add_subdirectory(primitives) -if (WITH_AAD) - if (NOT WITH_WINPR_JSON) - message(FATAL_ERROR "Trying to build -DWITH_AAD=ON but WITH_WINPR_JSON is not defined") - endif() +if(WITH_AAD) + if(NOT WITH_WINPR_JSON) + message(FATAL_ERROR "Trying to build -DWITH_AAD=ON but WITH_WINPR_JSON is not defined") + endif() endif() list(APPEND LIBFREERDP_PUB_LIBS winpr) @@ -202,38 +194,37 @@ list(REMOVE_DUPLICATES LIBFREERDP_DEFINITIONS) list(REMOVE_DUPLICATES LIBFREERDP_INCLUDES) include_directories(SYSTEM ${LIBFREERDP_INCLUDES}) -if (LIBFREERDP_OBJECT_LIBS) - list(REMOVE_DUPLICATES LIBFREERDP_OBJECT_LIBS) - list(APPEND LIBFREERDP_SRCS ${LIBFREERDP_OBJECT_LIBS}) +if(LIBFREERDP_OBJECT_LIBS) + list(REMOVE_DUPLICATES LIBFREERDP_OBJECT_LIBS) + list(APPEND LIBFREERDP_SRCS ${LIBFREERDP_OBJECT_LIBS}) endif() -AddTargetWithResourceFile(${MODULE_NAME} FALSE "${FREERDP_VERSION}" LIBFREERDP_SRCS) +addtargetwithresourcefile(${MODULE_NAME} FALSE "${FREERDP_VERSION}" LIBFREERDP_SRCS) -if (WITH_RESOURCE_VERSIONING) - target_compile_definitions(${MODULE_NAME} PRIVATE -DWITH_RESOURCE_VERSIONING) +if(WITH_RESOURCE_VERSIONING) + target_compile_definitions(${MODULE_NAME} PRIVATE -DWITH_RESOURCE_VERSIONING) endif() -if (FREERDP_USE_VENDOR_PRODUCT_CONFIG_DIR) - target_compile_definitions(${MODULE_NAME} PRIVATE -DFREERDP_USE_VENDOR_PRODUCT_CONFIG_DIR) +if(FREERDP_USE_VENDOR_PRODUCT_CONFIG_DIR) + target_compile_definitions(${MODULE_NAME} PRIVATE -DFREERDP_USE_VENDOR_PRODUCT_CONFIG_DIR) endif() add_definitions(${LIBFREERDP_DEFINITIONS}) -if (LIBFREERDP_COMPILE_OPTIONS) - list(REMOVE_DUPLICATES LIBFREERDP_COMPILE_OPTIONS) - target_compile_options(${MODULE_NAME} PRIVATE ${LIBFREERDP_COMPILE_OPTIONS}) +if(LIBFREERDP_COMPILE_OPTIONS) + list(REMOVE_DUPLICATES LIBFREERDP_COMPILE_OPTIONS) + target_compile_options(${MODULE_NAME} PRIVATE ${LIBFREERDP_COMPILE_OPTIONS}) endif() -if (WITH_FULL_CONFIG_PATH) - add_definitions(-DWITH_FULL_CONFIG_PATH) +if(WITH_FULL_CONFIG_PATH) + add_definitions(-DWITH_FULL_CONFIG_PATH) endif() target_include_directories(${MODULE_NAME} INTERFACE $) target_link_libraries(${MODULE_NAME} PRIVATE ${LIBFREERDP_LIBS}) target_link_libraries(${MODULE_NAME} PUBLIC ${LIBFREERDP_PUB_LIBS}) -install(TARGETS ${MODULE_NAME} COMPONENT libraries EXPORT FreeRDPTargets - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) +install(TARGETS ${MODULE_NAME} COMPONENT libraries EXPORT FreeRDPTargets ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +) set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "FreeRDP/libfreerdp") @@ -241,26 +232,31 @@ include(pkg-config-install-prefix) set(FREERDP_REQUIRES_PRIVATE "") if(WITH_SMARTCARD_EMULATE) - string(APPEND FREERDP_REQUIRES_PRIVATE " zlib") - list(APPEND FREERDP_PC_PRIVATE_LIBS "-lz") + string(APPEND FREERDP_REQUIRES_PRIVATE " zlib") + list(APPEND FREERDP_PC_PRIVATE_LIBS "-lz") endif() list(JOIN FREERDP_PC_PRIVATE_LIBS " " FREERDP_PC_PRIVATE_LIBS) -cleaning_configure_file(${CMAKE_CURRENT_SOURCE_DIR}/freerdp.pc.in ${CMAKE_CURRENT_BINARY_DIR}/freerdp${FREERDP_VERSION_MAJOR}.pc @ONLY) +cleaning_configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/freerdp.pc.in ${CMAKE_CURRENT_BINARY_DIR}/freerdp${FREERDP_VERSION_MAJOR}.pc @ONLY +) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/freerdp${FREERDP_VERSION_MAJOR}.pc DESTINATION ${PKG_CONFIG_PC_INSTALL_DIR}) ## cmake project export(PACKAGE freerdp) -SetFreeRDPCMakeInstallDir(FREERDP_CMAKE_INSTALL_DIR "FreeRDP${FREERDP_VERSION_MAJOR}") +setfreerdpcmakeinstalldir(FREERDP_CMAKE_INSTALL_DIR "FreeRDP${FREERDP_VERSION_MAJOR}") -configure_package_config_file(FreeRDPConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/FreeRDPConfig.cmake -INSTALL_DESTINATION ${FREERDP_CMAKE_INSTALL_DIR} -PATH_VARS FREERDP_INCLUDE_DIR FREERDP_PLUGIN_PATH) +configure_package_config_file( + FreeRDPConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/FreeRDPConfig.cmake + INSTALL_DESTINATION ${FREERDP_CMAKE_INSTALL_DIR} PATH_VARS FREERDP_INCLUDE_DIR FREERDP_PLUGIN_PATH +) -write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/FreeRDPConfigVersion.cmake -VERSION ${FREERDP_VERSION} COMPATIBILITY SameMajorVersion) +write_basic_package_version_file( + ${CMAKE_CURRENT_BINARY_DIR}/FreeRDPConfigVersion.cmake VERSION ${FREERDP_VERSION} COMPATIBILITY SameMajorVersion +) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/FreeRDPConfig.cmake ${CMAKE_CURRENT_BINARY_DIR}/FreeRDPConfigVersion.cmake -DESTINATION ${FREERDP_CMAKE_INSTALL_DIR}) + DESTINATION ${FREERDP_CMAKE_INSTALL_DIR} +) install(EXPORT FreeRDPTargets DESTINATION ${FREERDP_CMAKE_INSTALL_DIR}) diff --git a/libfreerdp/cache/CMakeLists.txt b/libfreerdp/cache/CMakeLists.txt index 369faecbb..2c3064682 100644 --- a/libfreerdp/cache/CMakeLists.txt +++ b/libfreerdp/cache/CMakeLists.txt @@ -19,21 +19,21 @@ set(MODULE_NAME "freerdp-cache") set(MODULE_PREFIX "FREERDP_CACHE") freerdp_module_add( - brush.c - brush.h - pointer.c - pointer.h - bitmap.c - bitmap.h - persistent.c - nine_grid.c - nine_grid.h - offscreen.c - offscreen.h - palette.c - palette.h - glyph.c - glyph.h - cache.c - cache.h) - + brush.c + brush.h + pointer.c + pointer.h + bitmap.c + bitmap.h + persistent.c + nine_grid.c + nine_grid.h + offscreen.c + offscreen.h + palette.c + palette.h + glyph.c + glyph.h + cache.c + cache.h +) diff --git a/libfreerdp/codec/CMakeLists.txt b/libfreerdp/codec/CMakeLists.txt index 0f1ad4bff..507b2ec5b 100644 --- a/libfreerdp/codec/CMakeLists.txt +++ b/libfreerdp/codec/CMakeLists.txt @@ -1,58 +1,49 @@ # codec set(CODEC_SRCS - bulk.c - bulk.h - dsp.c - color.c - color.h - audio.c - planar.c - bitmap.c - interleaved.c - progressive.c - rfx_bitstream.h - rfx_constants.h - rfx_decode.c - rfx_decode.h - rfx_differential.h - rfx_dwt.c - rfx_dwt.h - rfx_encode.c - rfx_encode.h - rfx_quantization.c - rfx_quantization.h - rfx_rlgr.c - rfx_rlgr.h - rfx_types.h - rfx.c - region.c - nsc.c - nsc_encode.c - nsc_encode.h - nsc_types.h - ncrush.c - xcrush.c - mppc.c - zgfx.c - clear.c - jpeg.c - h264.c - yuv.c) - -set(CODEC_SSE2_SRCS - sse/rfx_sse2.c - sse/rfx_sse2.h - sse/nsc_sse2.c - sse/nsc_sse2.h + bulk.c + bulk.h + dsp.c + color.c + color.h + audio.c + planar.c + bitmap.c + interleaved.c + progressive.c + rfx_bitstream.h + rfx_constants.h + rfx_decode.c + rfx_decode.h + rfx_differential.h + rfx_dwt.c + rfx_dwt.h + rfx_encode.c + rfx_encode.h + rfx_quantization.c + rfx_quantization.h + rfx_rlgr.c + rfx_rlgr.h + rfx_types.h + rfx.c + region.c + nsc.c + nsc_encode.c + nsc_encode.h + nsc_types.h + ncrush.c + xcrush.c + mppc.c + zgfx.c + clear.c + jpeg.c + h264.c + yuv.c ) -set(CODEC_NEON_SRCS - neon/rfx_neon.c - neon/rfx_neon.h - neon/nsc_neon.c - neon/nsc_neon.h -) +set(CODEC_SSE2_SRCS sse/rfx_sse2.c sse/rfx_sse2.h sse/nsc_sse2.c sse/nsc_sse2.h) + +set(CODEC_NEON_SRCS neon/rfx_neon.c neon/rfx_neon.h neon/nsc_neon.c neon/nsc_neon.h) # Append initializers set(CODEC_LIBS "") @@ -60,106 +51,97 @@ list(APPEND CODEC_SRCS ${CODEC_SSE2_SRCS}) list(APPEND CODEC_SRCS ${CODEC_NEON_SRCS}) include(CompilerDetect) -include (DetectIntrinsicSupport) +include(DetectIntrinsicSupport) if(WITH_SSE2) - if (HAVE_SSE_OR_AVX) - if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG) - if (CODEC_SSE2_SRCS) - set_source_files_properties(${CODEC_SSE2_SRCS} PROPERTIES COMPILE_FLAGS "-msse2" ) - endif() - endif() - - if(MSVC) - if (CODEC_SSE2_SRCS) - set_source_files_properties(${CODEC_SSE2_SRCS} PROPERTIES COMPILE_FLAGS "/arch:SSE2" ) - endif() - endif() + if(HAVE_SSE_OR_AVX) + if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG) + if(CODEC_SSE2_SRCS) + set_source_files_properties(${CODEC_SSE2_SRCS} PROPERTIES COMPILE_FLAGS "-msse2") + endif() endif() + + if(MSVC) + if(CODEC_SSE2_SRCS) + set_source_files_properties(${CODEC_SSE2_SRCS} PROPERTIES COMPILE_FLAGS "/arch:SSE2") + endif() + endif() + endif() endif() if(WITH_NEON) - # aarch64 requires NEON by default, no flag required - if (HAVE_NEON AND NOT HAVE_NEON64) - if (CODEC_SSE2_SRCS) - set_source_files_properties(${CODEC_NEON_SRCS} PROPERTIES COMPILE_FLAGS "-mfpu=neon" ) - endif() + # aarch64 requires NEON by default, no flag required + if(HAVE_NEON AND NOT HAVE_NEON64) + if(CODEC_SSE2_SRCS) + set_source_files_properties(${CODEC_NEON_SRCS} PROPERTIES COMPILE_FLAGS "-mfpu=neon") endif() + endif() endif() -if (WITH_DSP_FFMPEG) - set(CODEC_SRCS - ${CODEC_SRCS} - dsp_ffmpeg.c - dsp_ffmpeg.h) - include_directories(SYSTEM ${FFMPEG_INCLUDE_DIRS}) - list(APPEND CODEC_LIBS ${FFMPEG_LIBRARIES}) -endif (WITH_DSP_FFMPEG) +if(WITH_DSP_FFMPEG) + set(CODEC_SRCS ${CODEC_SRCS} dsp_ffmpeg.c dsp_ffmpeg.h) + include_directories(SYSTEM ${FFMPEG_INCLUDE_DIRS}) + list(APPEND CODEC_LIBS ${FFMPEG_LIBRARIES}) +endif(WITH_DSP_FFMPEG) -if (WITH_SOXR) - list(APPEND CODEC_LIBS ${SOXR_LIBRARIES}) - include_directories(SYSTEM ${SOXR_INCLUDE_DIR}) +if(WITH_SOXR) + list(APPEND CODEC_LIBS ${SOXR_LIBRARIES}) + include_directories(SYSTEM ${SOXR_INCLUDE_DIR}) endif(WITH_SOXR) if(GSM_FOUND) - list(APPEND CODEC_LIBS ${GSM_LIBRARIES}) - include_directories(SYSTEM ${GSM_INCLUDE_DIRS}) + list(APPEND CODEC_LIBS ${GSM_LIBRARIES}) + include_directories(SYSTEM ${GSM_INCLUDE_DIRS}) endif() if(LAME_FOUND) - list(APPEND CODEC_LIBS ${LAME_LIBRARIES}) - include_directories(SYSTEM ${LAME_INCLUDE_DIRS}) + list(APPEND CODEC_LIBS ${LAME_LIBRARIES}) + include_directories(SYSTEM ${LAME_INCLUDE_DIRS}) endif() -if (WITH_FDK_AAC) - list(APPEND CODEC_SRCS - dsp_fdk_impl.c - dsp_fdk_impl.h - dsp_fdk_aac.c - dsp_fdk_aac.h) +if(WITH_FDK_AAC) + list(APPEND CODEC_SRCS dsp_fdk_impl.c dsp_fdk_impl.h dsp_fdk_aac.c dsp_fdk_aac.h) endif() if(FAAD2_FOUND) - list(APPEND CODEC_LIBS ${FAAD2_LIBRARIES}) - include_directories(SYSTEM ${FAAD2_INCLUDE_DIRS}) + list(APPEND CODEC_LIBS ${FAAD2_LIBRARIES}) + include_directories(SYSTEM ${FAAD2_INCLUDE_DIRS}) endif() if(FAAC_FOUND) - list(APPEND CODEC_LIBS ${FAAC_LIBRARIES}) - include_directories(SYSTEM ${FAAC_INCLUDE_DIRS}) + list(APPEND CODEC_LIBS ${FAAC_LIBRARIES}) + include_directories(SYSTEM ${FAAC_INCLUDE_DIRS}) endif() if(WITH_OPENH264) - set(CODEC_SRCS ${CODEC_SRCS} h264_openh264.c) - include_directories(SYSTEM ${OPENH264_INCLUDE_DIR}) - if (NOT WITH_OPENH264_LOADING) - list(APPEND CODEC_LIBS ${OPENH264_LIBRARIES}) - endif (NOT WITH_OPENH264_LOADING) + set(CODEC_SRCS ${CODEC_SRCS} h264_openh264.c) + include_directories(SYSTEM ${OPENH264_INCLUDE_DIR}) + if(NOT WITH_OPENH264_LOADING) + list(APPEND CODEC_LIBS ${OPENH264_LIBRARIES}) + endif(NOT WITH_OPENH264_LOADING) endif() if(WITH_VIDEO_FFMPEG) - set(CODEC_SRCS ${CODEC_SRCS} h264_ffmpeg.c) - include_directories(SYSTEM ${FFMPEG_INCLUDE_DIRS}) - list(APPEND CODEC_LIBS ${FFMPEG_LIBRARIES}) + set(CODEC_SRCS ${CODEC_SRCS} h264_ffmpeg.c) + include_directories(SYSTEM ${FFMPEG_INCLUDE_DIRS}) + list(APPEND CODEC_LIBS ${FFMPEG_LIBRARIES}) endif() if(WIN32 AND WITH_MEDIA_FOUNDATION) - set(CODEC_SRCS ${CODEC_SRCS} h264_mf.c) + set(CODEC_SRCS ${CODEC_SRCS} h264_mf.c) endif() if(ANDROID AND WITH_MEDIACODEC) - list(APPEND CODEC_SRCS h264_mediacodec.c) + list(APPEND CODEC_SRCS h264_mediacodec.c) - find_library(MEDIACODEC mediandk REQUIRED) - list(APPEND CODEC_LIBS ${MEDIACODEC}) + find_library(MEDIACODEC mediandk REQUIRED) + list(APPEND CODEC_LIBS ${MEDIACODEC}) endif() -add_library(freerdp-codecs OBJECT - ${CODEC_SRCS} -) +add_library(freerdp-codecs OBJECT ${CODEC_SRCS}) freerdp_library_add(${CODEC_LIBS}) freerdp_object_library_add(freerdp-codecs) if(BUILD_TESTING_INTERNAL OR BUILD_TESTING) - add_subdirectory(test) + add_subdirectory(test) endif() diff --git a/libfreerdp/codec/test/CMakeLists.txt b/libfreerdp/codec/test/CMakeLists.txt index 971360980..5ee216d56 100644 --- a/libfreerdp/codec/test/CMakeLists.txt +++ b/libfreerdp/codec/test/CMakeLists.txt @@ -1,4 +1,3 @@ - set(MODULE_NAME "TestFreeRDPCodec") set(MODULE_PREFIX "TEST_FREERDP_CODEC") @@ -17,17 +16,11 @@ set(TESTS TestFreeRDPCodecRemoteFX.c ) -if (BUILD_TESTING_INTERNAL) - list(APPEND TESTS - TestFreeRDPCodecMppc.c - TestFreeRDPCodecNCrush.c - TestFreeRDPCodecXCrush.c - ) +if(BUILD_TESTING_INTERNAL) + list(APPEND TESTS TestFreeRDPCodecMppc.c TestFreeRDPCodecNCrush.c TestFreeRDPCodecXCrush.c) endif() -create_test_sourcelist(SRCS - ${DRIVER} - ${TESTS}) +create_test_sourcelist(SRCS ${DRIVER} ${TESTS}) add_definitions(-DCMAKE_CURRENT_SOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}") add_definitions(-DCMAKE_CURRENT_BINARY_DIR="${CMAKE_CURRENT_BINARY_DIR}") @@ -38,15 +31,13 @@ target_link_libraries(${MODULE_NAME} freerdp winpr) set_target_properties(${MODULE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TESTING_OUTPUT_DIRECTORY}") foreach(test ${TESTS}) - get_filename_component(TestName ${test} NAME_WE) - add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) + get_filename_component(TestName ${test} NAME_WE) + add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) endforeach() set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "FreeRDP/Test") -set(FUZZERS - TestFuzzCodecs.c -) +set(FUZZERS TestFuzzCodecs.c) -include (AddFuzzerTest) +include(AddFuzzerTest) add_fuzzer_test("${FUZZERS}" "freerdp winpr") diff --git a/libfreerdp/common/CMakeLists.txt b/libfreerdp/common/CMakeLists.txt index b8b4fe9b3..112524097 100644 --- a/libfreerdp/common/CMakeLists.txt +++ b/libfreerdp/common/CMakeLists.txt @@ -18,16 +18,10 @@ set(MODULE_NAME "freerdp-common") set(MODULE_PREFIX "FREERDP_COMMON") -set(${MODULE_PREFIX}_SRCS - addin.c - settings.c - settings_getters.c - settings_str.c - settings_str.h - assistance.c) +set(${MODULE_PREFIX}_SRCS addin.c settings.c settings_getters.c settings_str.c settings_str.h assistance.c) freerdp_module_add(${${MODULE_PREFIX}_SRCS}) if(BUILD_TESTING_INTERNAL OR BUILD_TESTING) - add_subdirectory(test) + add_subdirectory(test) endif() diff --git a/libfreerdp/common/test/CMakeLists.txt b/libfreerdp/common/test/CMakeLists.txt index 9ea890826..445f89ae3 100644 --- a/libfreerdp/common/test/CMakeLists.txt +++ b/libfreerdp/common/test/CMakeLists.txt @@ -1,4 +1,3 @@ - set(MODULE_NAME "TestCommon") set(MODULE_PREFIX "TEST_COMMON") @@ -6,32 +5,26 @@ disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR}) set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c) -set(${MODULE_PREFIX}_TESTS - TestAddinArgv.c - TestCommonAssistance.c) +set(${MODULE_PREFIX}_TESTS TestAddinArgv.c TestCommonAssistance.c) -set(FUZZERS - TestFuzzCommonAssistanceParseFileBuffer.c - TestFuzzCommonAssistanceBinToHexString.c - TestFuzzCommonAssistanceHexStringToBin.c) +set(FUZZERS TestFuzzCommonAssistanceParseFileBuffer.c TestFuzzCommonAssistanceBinToHexString.c + TestFuzzCommonAssistanceHexStringToBin.c +) -create_test_sourcelist(${MODULE_PREFIX}_SRCS - ${${MODULE_PREFIX}_DRIVER} - ${${MODULE_PREFIX}_TESTS}) +create_test_sourcelist(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_DRIVER} ${${MODULE_PREFIX}_TESTS}) add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) target_link_libraries(${MODULE_NAME} freerdp winpr) -include (AddFuzzerTest) +include(AddFuzzerTest) add_fuzzer_test("${FUZZERS}" "freerdp winpr") set_target_properties(${MODULE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TESTING_OUTPUT_DIRECTORY}") foreach(test ${${MODULE_PREFIX}_TESTS}) - get_filename_component(TestName ${test} NAME_WE) - add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) + get_filename_component(TestName ${test} NAME_WE) + add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) endforeach() set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "FreeRDP/Common/Test") - diff --git a/libfreerdp/core/CMakeLists.txt b/libfreerdp/core/CMakeLists.txt index 5b384360f..b60351ef4 100644 --- a/libfreerdp/core/CMakeLists.txt +++ b/libfreerdp/core/CMakeLists.txt @@ -18,7 +18,7 @@ set(MODULE_NAME "freerdp-core") set(MODULE_PREFIX "FREERDP_CORE") -CHECK_INCLUDE_FILES("ctype.h;linux/vm_sockets.h" HAVE_AF_VSOCK_H) +check_include_files("ctype.h;linux/vm_sockets.h" HAVE_AF_VSOCK_H) freerdp_definition_add(-DEXT_PATH="${FREERDP_EXTENSION_PATH}") @@ -27,125 +27,126 @@ freerdp_include_directory_add(${OPENSSL_INCLUDE_DIR}) set(${MODULE_PREFIX}_GATEWAY_DIR "gateway") set(${MODULE_PREFIX}_GATEWAY_SRCS - ${${MODULE_PREFIX}_GATEWAY_DIR}/tsg.c - ${${MODULE_PREFIX}_GATEWAY_DIR}/tsg.h - ${${MODULE_PREFIX}_GATEWAY_DIR}/rdg.c - ${${MODULE_PREFIX}_GATEWAY_DIR}/rdg.h - ${${MODULE_PREFIX}_GATEWAY_DIR}/rpc.c - ${${MODULE_PREFIX}_GATEWAY_DIR}/rpc.h - ${${MODULE_PREFIX}_GATEWAY_DIR}/rpc_bind.c - ${${MODULE_PREFIX}_GATEWAY_DIR}/rpc_bind.h - ${${MODULE_PREFIX}_GATEWAY_DIR}/rpc_client.c - ${${MODULE_PREFIX}_GATEWAY_DIR}/rpc_client.h - ${${MODULE_PREFIX}_GATEWAY_DIR}/rpc_fault.c - ${${MODULE_PREFIX}_GATEWAY_DIR}/rpc_fault.h - ${${MODULE_PREFIX}_GATEWAY_DIR}/rts.c - ${${MODULE_PREFIX}_GATEWAY_DIR}/rts.h - ${${MODULE_PREFIX}_GATEWAY_DIR}/rts_signature.c - ${${MODULE_PREFIX}_GATEWAY_DIR}/rts_signature.h - ${${MODULE_PREFIX}_GATEWAY_DIR}/http.c - ${${MODULE_PREFIX}_GATEWAY_DIR}/http.h - ${${MODULE_PREFIX}_GATEWAY_DIR}/websocket.c - ${${MODULE_PREFIX}_GATEWAY_DIR}/websocket.h - ${${MODULE_PREFIX}_GATEWAY_DIR}/wst.c - ${${MODULE_PREFIX}_GATEWAY_DIR}/wst.h - ${${MODULE_PREFIX}_GATEWAY_DIR}/arm.c - ${${MODULE_PREFIX}_GATEWAY_DIR}/arm.h - ${${MODULE_PREFIX}_GATEWAY_DIR}/ncacn_http.c - ${${MODULE_PREFIX}_GATEWAY_DIR}/ncacn_http.h) + ${${MODULE_PREFIX}_GATEWAY_DIR}/tsg.c + ${${MODULE_PREFIX}_GATEWAY_DIR}/tsg.h + ${${MODULE_PREFIX}_GATEWAY_DIR}/rdg.c + ${${MODULE_PREFIX}_GATEWAY_DIR}/rdg.h + ${${MODULE_PREFIX}_GATEWAY_DIR}/rpc.c + ${${MODULE_PREFIX}_GATEWAY_DIR}/rpc.h + ${${MODULE_PREFIX}_GATEWAY_DIR}/rpc_bind.c + ${${MODULE_PREFIX}_GATEWAY_DIR}/rpc_bind.h + ${${MODULE_PREFIX}_GATEWAY_DIR}/rpc_client.c + ${${MODULE_PREFIX}_GATEWAY_DIR}/rpc_client.h + ${${MODULE_PREFIX}_GATEWAY_DIR}/rpc_fault.c + ${${MODULE_PREFIX}_GATEWAY_DIR}/rpc_fault.h + ${${MODULE_PREFIX}_GATEWAY_DIR}/rts.c + ${${MODULE_PREFIX}_GATEWAY_DIR}/rts.h + ${${MODULE_PREFIX}_GATEWAY_DIR}/rts_signature.c + ${${MODULE_PREFIX}_GATEWAY_DIR}/rts_signature.h + ${${MODULE_PREFIX}_GATEWAY_DIR}/http.c + ${${MODULE_PREFIX}_GATEWAY_DIR}/http.h + ${${MODULE_PREFIX}_GATEWAY_DIR}/websocket.c + ${${MODULE_PREFIX}_GATEWAY_DIR}/websocket.h + ${${MODULE_PREFIX}_GATEWAY_DIR}/wst.c + ${${MODULE_PREFIX}_GATEWAY_DIR}/wst.h + ${${MODULE_PREFIX}_GATEWAY_DIR}/arm.c + ${${MODULE_PREFIX}_GATEWAY_DIR}/arm.h + ${${MODULE_PREFIX}_GATEWAY_DIR}/ncacn_http.c + ${${MODULE_PREFIX}_GATEWAY_DIR}/ncacn_http.h +) set(${MODULE_PREFIX}_SRCS state.h state.c - utils.c - utils.h - streamdump.c - activation.c - activation.h - gcc.c - gcc.h - mcs.c - mcs.h - nla.c - nla.h - smartcardlogon.c - nego.c - nego.h - info.c - info.h - input.c - input.h - license.c - license.h - errinfo.c - errbase.c - errconnect.c - errinfo.h - security.c - security.h - settings.c - settings.h - orders.c - orders.h - freerdp.c - graphics.c - client.c - client.h - server.c - server.h - codecs.c - metrics.c - capabilities.c - capabilities.h - connection.c - connection.h - redirection.c - redirection.h - autodetect.c - autodetect.h - heartbeat.c - heartbeat.h - multitransport.c - multitransport.h - timezone.c - timezone.h - childsession.c - rdp.c - rdp.h - tcp.c - tcp.h - proxy.c - proxy.h - tpdu.c - tpdu.h - tpkt.c - tpkt.h - fastpath.c - fastpath.h - surface.c - surface.h - transport.c - transport.h - update.c - update.h - message.c - message.h - channels.c - channels.h - window.c - window.h - listener.c - listener.h - peer.c - peer.h - display.c - display.h - credssp_auth.c - credssp_auth.h - rdstls.c - rdstls.h - aad.c - aad.h + utils.c + utils.h + streamdump.c + activation.c + activation.h + gcc.c + gcc.h + mcs.c + mcs.h + nla.c + nla.h + smartcardlogon.c + nego.c + nego.h + info.c + info.h + input.c + input.h + license.c + license.h + errinfo.c + errbase.c + errconnect.c + errinfo.h + security.c + security.h + settings.c + settings.h + orders.c + orders.h + freerdp.c + graphics.c + client.c + client.h + server.c + server.h + codecs.c + metrics.c + capabilities.c + capabilities.h + connection.c + connection.h + redirection.c + redirection.h + autodetect.c + autodetect.h + heartbeat.c + heartbeat.h + multitransport.c + multitransport.h + timezone.c + timezone.h + childsession.c + rdp.c + rdp.h + tcp.c + tcp.h + proxy.c + proxy.h + tpdu.c + tpdu.h + tpkt.c + tpkt.h + fastpath.c + fastpath.h + surface.c + surface.h + transport.c + transport.h + update.c + update.h + message.c + message.h + channels.c + channels.h + window.c + window.h + listener.c + listener.h + peer.c + peer.h + display.c + display.h + credssp_auth.c + credssp_auth.h + rdstls.c + rdstls.h + aad.c + aad.h ) set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} ${${MODULE_PREFIX}_GATEWAY_SRCS}) @@ -153,12 +154,12 @@ set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} ${${MODULE_PREFIX}_GATEWAY_SR freerdp_module_add(${${MODULE_PREFIX}_SRCS}) if(WIN32) - set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} ws2_32) - freerdp_library_add(ws2_32) + set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} ws2_32) + freerdp_library_add(ws2_32) endif() freerdp_library_add(${OPENSSL_LIBRARIES}) if(BUILD_TESTING_INTERNAL OR BUILD_TESTING) - add_subdirectory(test) + add_subdirectory(test) endif() diff --git a/libfreerdp/core/test/CMakeLists.txt b/libfreerdp/core/test/CMakeLists.txt index 619c3cc36..1bb59c89e 100644 --- a/libfreerdp/core/test/CMakeLists.txt +++ b/libfreerdp/core/test/CMakeLists.txt @@ -1,4 +1,3 @@ - set(MODULE_NAME "TestCore") set(MODULE_PREFIX "TEST_CORE") @@ -6,36 +5,23 @@ disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR}) set(DRIVER ${MODULE_NAME}.c) -set(TESTS - TestVersion.c - TestSettings.c) +set(TESTS TestVersion.c TestSettings.c) -if (BUILD_TESTING_INTERNAL) - list(APPEND TESTS - TestStreamDump.c - ) +if(BUILD_TESTING_INTERNAL) + list(APPEND TESTS TestStreamDump.c) endif() -set(FUZZERS - TestFuzzCoreClient.c - TestFuzzCoreServer.c - TestFuzzCryptoCertificateDataSetPEM.c -) +set(FUZZERS TestFuzzCoreClient.c TestFuzzCoreServer.c TestFuzzCryptoCertificateDataSetPEM.c) # Test not compatible with package tests, disable if(WITH_SAMPLE AND WITH_SERVER AND NOT WIN32 AND BUILD_TESTING_INTERNAL) - add_definitions(-DCMAKE_EXECUTABLE_SUFFIX="${CMAKE_EXECUTABLE_SUFFIX}") - set(TESTS - ${TESTS} - TestConnect.c - ) + add_definitions(-DCMAKE_EXECUTABLE_SUFFIX="${CMAKE_EXECUTABLE_SUFFIX}") + set(TESTS ${TESTS} TestConnect.c) else() - message("Skipping connection tests, requires BUILD_TESTING_INTERNAL, WITH_SAMPLE and WITH_SERVER set!") + message("Skipping connection tests, requires BUILD_TESTING_INTERNAL, WITH_SAMPLE and WITH_SERVER set!") endif() -create_test_sourcelist(SRCS - ${DRIVER} - ${TESTS}) +create_test_sourcelist(SRCS ${DRIVER} ${TESTS}) add_executable(${MODULE_NAME} ${SRCS}) @@ -44,14 +30,14 @@ add_definitions(-DTESTING_SRC_DIRECTORY="${PROJECT_SOURCE_DIR}") target_link_libraries(${MODULE_NAME} freerdp winpr freerdp-client) -include (AddFuzzerTest) +include(AddFuzzerTest) add_fuzzer_test("${FUZZERS}" "freerdp-client freerdp winpr") set_target_properties(${MODULE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TESTING_OUTPUT_DIRECTORY}") foreach(test ${TESTS}) - get_filename_component(TestName ${test} NAME_WE) - add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) + get_filename_component(TestName ${test} NAME_WE) + add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) endforeach() set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "FreeRDP/Core/Test") diff --git a/libfreerdp/crypto/CMakeLists.txt b/libfreerdp/crypto/CMakeLists.txt index d878a4d23..1dde7bb55 100644 --- a/libfreerdp/crypto/CMakeLists.txt +++ b/libfreerdp/crypto/CMakeLists.txt @@ -19,39 +19,40 @@ set(MODULE_NAME "freerdp-crypto") set(MODULE_PREFIX "FREERDP_CRYPTO") freerdp_module_add( - er.c - der.c - ber.c - per.c - base64.c - x509_utils.c - x509_utils.h - cert_common.h - cert_common.c - privatekey.c - privatekey.h - certificate.c - certificate.h - certificate_data.c - certificate_store.c - crypto.c - tls.c - tls.h - opensslcompat.c) + er.c + der.c + ber.c + per.c + base64.c + x509_utils.c + x509_utils.h + cert_common.h + cert_common.c + privatekey.c + privatekey.h + certificate.c + certificate.h + certificate_data.c + certificate_store.c + crypto.c + tls.c + tls.h + opensslcompat.c +) freerdp_include_directory_add(${OPENSSL_INCLUDE_DIR}) freerdp_library_add(${OPENSSL_LIBRARIES}) if(MBEDTLS_FOUND) - freerdp_include_directory_add(${MBEDTLS_INCLUDE_DIR}) - freerdp_library_add(${MBEDTLS_LIBRARIES}) + freerdp_include_directory_add(${MBEDTLS_INCLUDE_DIR}) + freerdp_library_add(${MBEDTLS_LIBRARIES}) endif() if(WIN32) - freerdp_library_add(ws2_32) + freerdp_library_add(ws2_32) endif() if(BUILD_TESTING_INTERNAL OR BUILD_TESTING) - add_subdirectory(test) + add_subdirectory(test) endif() diff --git a/libfreerdp/crypto/test/CMakeLists.txt b/libfreerdp/crypto/test/CMakeLists.txt index bb26fea3e..0b63231b8 100644 --- a/libfreerdp/crypto/test/CMakeLists.txt +++ b/libfreerdp/crypto/test/CMakeLists.txt @@ -1,4 +1,3 @@ - set(MODULE_NAME "TestFreeRDPCrypto") set(MODULE_PREFIX "TEST_FREERDP_CRYPTO") @@ -6,20 +5,13 @@ disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR}) set(DRIVER ${MODULE_NAME}.c) -set(TESTS - TestKnownHosts.c - TestBase64.c - ) +set(TESTS TestKnownHosts.c TestBase64.c) -if (BUILD_TESTING_INTERNAL) - list(APPEND TESTS - Test_x509_utils.c - ) +if(BUILD_TESTING_INTERNAL) + list(APPEND TESTS Test_x509_utils.c) endif() -create_test_sourcelist(SRCS - ${DRIVER} - ${TESTS}) +create_test_sourcelist(SRCS ${DRIVER} ${TESTS}) include_directories(SYSTEM ${OPENSSL_INCLUDE_DIR}) @@ -33,9 +25,8 @@ target_link_libraries(${MODULE_NAME} freerdp winpr ${OPENSSL_LIBRARIES}) set_target_properties(${MODULE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TESTING_OUTPUT_DIRECTORY}") foreach(test ${TESTS}) - get_filename_component(TestName ${test} NAME_WE) - add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) + get_filename_component(TestName ${test} NAME_WE) + add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) endforeach() set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "FreeRDP/Test") - diff --git a/libfreerdp/emu/CMakeLists.txt b/libfreerdp/emu/CMakeLists.txt index 290cd13a2..65bde3f47 100644 --- a/libfreerdp/emu/CMakeLists.txt +++ b/libfreerdp/emu/CMakeLists.txt @@ -1,11 +1,13 @@ -if (WITH_SMARTCARD_EMULATE) - list(APPEND EMULATE_SRCS - scard/smartcard_emulate.c - scard/FreeRDP.ico.h - scard/FreeRDP.ico.c - scard/smartcard_virtual_gids.h - scard/smartcard_virtual_gids.c - ) - freerdp_module_add(${EMULATE_SRCS}) - freerdp_library_add(ZLIB::ZLIB) +if(WITH_SMARTCARD_EMULATE) + list( + APPEND + EMULATE_SRCS + scard/smartcard_emulate.c + scard/FreeRDP.ico.h + scard/FreeRDP.ico.c + scard/smartcard_virtual_gids.h + scard/smartcard_virtual_gids.c + ) + freerdp_module_add(${EMULATE_SRCS}) + freerdp_library_add(ZLIB::ZLIB) endif() diff --git a/libfreerdp/gdi/CMakeLists.txt b/libfreerdp/gdi/CMakeLists.txt index 993bee841..2dd7514ab 100644 --- a/libfreerdp/gdi/CMakeLists.txt +++ b/libfreerdp/gdi/CMakeLists.txt @@ -21,20 +21,14 @@ set(MODULE_PREFIX "FREERDP_GDI") include_directories(${CMAKE_CURRENT_SOURCE_DIR}) option(WITH_GFX_FRAME_DUMP "Dump GFX commands to directory" OFF) -if (WITH_GFX_FRAME_DUMP) - freerdp_definition_add(-DWITH_GFX_FRAME_DUMP) +if(WITH_GFX_FRAME_DUMP) + freerdp_definition_add(-DWITH_GFX_FRAME_DUMP) endif() -file(GLOB ${MODULE_PREFIX}_SRCS - LIST_DIRECTORIES false - RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} - CONFIGURE_DEPENDS - "*.[ch]" -) +file(GLOB ${MODULE_PREFIX}_SRCS LIST_DIRECTORIES false RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} CONFIGURE_DEPENDS "*.[ch]") freerdp_module_add(${${MODULE_PREFIX}_SRCS}) if(BUILD_TESTING_INTERNAL) - add_subdirectory(test) + add_subdirectory(test) endif() - diff --git a/libfreerdp/gdi/test/CMakeLists.txt b/libfreerdp/gdi/test/CMakeLists.txt index 47dadeffe..8ae813f0e 100644 --- a/libfreerdp/gdi/test/CMakeLists.txt +++ b/libfreerdp/gdi/test/CMakeLists.txt @@ -1,4 +1,3 @@ - set(MODULE_NAME "TestGdi") set(MODULE_PREFIX "TEST_GDI") @@ -7,26 +6,23 @@ disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR}) set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c) set(${MODULE_PREFIX}_TESTS - TestGdiRop3.c - # TestGdiLine.c # TODO: This test is broken - TestGdiRegion.c - TestGdiRect.c - TestGdiBitBlt.c - TestGdiCreate.c - TestGdiEllipse.c - TestGdiClip.c) + TestGdiRop3.c + # TestGdiLine.c # TODO: This test is broken + TestGdiRegion.c + TestGdiRect.c + TestGdiBitBlt.c + TestGdiCreate.c + TestGdiEllipse.c + TestGdiClip.c +) -create_test_sourcelist(${MODULE_PREFIX}_SRCS - ${${MODULE_PREFIX}_DRIVER} - ${${MODULE_PREFIX}_TESTS}) +create_test_sourcelist(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_DRIVER} ${${MODULE_PREFIX}_TESTS}) include_directories(..) -add_library(helpers STATIC - helpers.c) +add_library(helpers STATIC helpers.c) target_link_libraries(helpers freerdp) - add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) target_link_libraries(${MODULE_NAME} winpr freerdp helpers) @@ -34,9 +30,8 @@ target_link_libraries(${MODULE_NAME} winpr freerdp helpers) set_target_properties(${MODULE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TESTING_OUTPUT_DIRECTORY}") foreach(test ${${MODULE_PREFIX}_TESTS}) - get_filename_component(TestName ${test} NAME_WE) - add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) + get_filename_component(TestName ${test} NAME_WE) + add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) endforeach() set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "FreeRDP/Test") - diff --git a/libfreerdp/locale/CMakeLists.txt b/libfreerdp/locale/CMakeLists.txt index 916b619aa..9c9b9eabd 100644 --- a/libfreerdp/locale/CMakeLists.txt +++ b/libfreerdp/locale/CMakeLists.txt @@ -18,91 +18,69 @@ set(MODULE_NAME "freerdp-locale") set(MODULE_PREFIX "FREERDP_LOCALE") -set(SRCS - keyboard_layout.c - keyboard.c - locale.c - liblocale.h) +set(SRCS keyboard_layout.c keyboard.c locale.c liblocale.h) -set(X11_SRCS - keyboard_x11.c - keyboard_x11.h - xkb_layout_ids.c - xkb_layout_ids.h) +set(X11_SRCS keyboard_x11.c keyboard_x11.h xkb_layout_ids.c xkb_layout_ids.h) -set(XKBFILE_SRCS - keyboard_xkbfile.c - keyboard_xkbfile.h) +set(XKBFILE_SRCS keyboard_xkbfile.c keyboard_xkbfile.h) -set(SUN_SRCS - keyboard_sun.c - keyboard_sun.h) +set(SUN_SRCS keyboard_sun.c keyboard_sun.h) -set(APPLE_SRCS - keyboard_apple.c - keyboard_apple.h) +set(APPLE_SRCS keyboard_apple.c keyboard_apple.h) include(CMakeDependentOption) cmake_dependent_option(WITH_KEYBOARD_LAYOUT_FROM_FILE "Use keyboard definitions from JSON file" OFF WITH_WINPR_JSON OFF) -if (WITH_KEYBOARD_LAYOUT_FROM_FILE) - freerdp_definition_add(-DFREERDP_RESOURCE_ROOT="${FREERDP_RESOURCE_ROOT}") - freerdp_definition_add(-DWITH_KEYBOARD_LAYOUT_FROM_FILE) +if(WITH_KEYBOARD_LAYOUT_FROM_FILE) + freerdp_definition_add(-DFREERDP_RESOURCE_ROOT="${FREERDP_RESOURCE_ROOT}") + freerdp_definition_add(-DWITH_KEYBOARD_LAYOUT_FROM_FILE) - install(FILES KeyboardLayoutMap.json DESTINATION ${FREERDP_RESOURCE_ROOT}) + install(FILES KeyboardLayoutMap.json DESTINATION ${FREERDP_RESOURCE_ROOT}) endif() - if(CMAKE_SYSTEM_NAME MATCHES Solaris) - set(WITH_SUN true) + set(WITH_SUN true) endif() if(APPLE AND (NOT IOS)) - list(APPEND SRCS - ${APPLE_SRCS}) - find_library(CARBON Carbon) - freerdp_library_add(${CARBON}) + list(APPEND SRCS ${APPLE_SRCS}) + find_library(CARBON Carbon) + freerdp_library_add(${CARBON}) endif() -if (APPLE) - FIND_LIBRARY(CORE_FOUNDATION CoreFoundation REQUIRED) - freerdp_library_add(${CORE_FOUNDATION}) +if(APPLE) + find_library(CORE_FOUNDATION CoreFoundation REQUIRED) + freerdp_library_add(${CORE_FOUNDATION}) endif() if(WITH_X11) - find_package(X11 REQUIRED) + find_package(X11 REQUIRED) - freerdp_definition_add(-DWITH_X11) - freerdp_include_directory_add(${X11_INCLUDE_DIR}) - list( APPEND SRCS - ${X11_SRCS}) - freerdp_library_add(${X11_LIBRARIES}) + freerdp_definition_add(-DWITH_X11) + freerdp_include_directory_add(${X11_INCLUDE_DIR}) + list(APPEND SRCS ${X11_SRCS}) + freerdp_library_add(${X11_LIBRARIES}) - if(WITH_SUN) - freerdp_definition_add(-DWITH_SUN) - list(APPEND SRCS - ${SUN_SRCS}) - endif() + if(WITH_SUN) + freerdp_definition_add(-DWITH_SUN) + list(APPEND SRCS ${SUN_SRCS}) + endif() - if( X11_Xkbfile_FOUND AND (NOT APPLE)) - freerdp_definition_add(-DWITH_XKBFILE) - freerdp_include_directory_add(${X11_Xkbfile_INCLUDE_PATH}) - list(APPEND SRCS - ${XKBFILE_SRCS} - ) - freerdp_library_add(${X11_Xkbfile_LIB}) - else() - list(APPEND SRCS - ${X11_KEYMAP_SRCS} - ) - endif() + if(X11_Xkbfile_FOUND AND (NOT APPLE)) + freerdp_definition_add(-DWITH_XKBFILE) + freerdp_include_directory_add(${X11_Xkbfile_INCLUDE_PATH}) + list(APPEND SRCS ${XKBFILE_SRCS}) + freerdp_library_add(${X11_Xkbfile_LIB}) + else() + list(APPEND SRCS ${X11_KEYMAP_SRCS}) + endif() endif() if(WITH_WAYLAND) - freerdp_definition_add(-DWITH_WAYLAND) + freerdp_definition_add(-DWITH_WAYLAND) endif() freerdp_module_add(${SRCS}) if(BUILD_TESTING_INTERNAL OR BUILD_TESTING) - add_subdirectory(test) + add_subdirectory(test) endif() diff --git a/libfreerdp/locale/test/CMakeLists.txt b/libfreerdp/locale/test/CMakeLists.txt index e1c0ead90..2b5f1f01e 100644 --- a/libfreerdp/locale/test/CMakeLists.txt +++ b/libfreerdp/locale/test/CMakeLists.txt @@ -1,33 +1,29 @@ # Test not compatible with package tests, disable -if (BUILD_TESTING_INTERNAL) - set(MODULE_NAME "TestLocale") - set(MODULE_PREFIX "TEST_LOCALE") +if(BUILD_TESTING_INTERNAL) + set(MODULE_NAME "TestLocale") + set(MODULE_PREFIX "TEST_LOCALE") - disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR}) + disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR}) - set(DRIVER ${MODULE_NAME}.c) + set(DRIVER ${MODULE_NAME}.c) - set(TEST_SRCS - TestLocaleKeyboard.c - ) + set(TEST_SRCS TestLocaleKeyboard.c) - create_test_sourcelist(SRCS - ${DRIVER} - ${TEST_SRCS}) + create_test_sourcelist(SRCS ${DRIVER} ${TEST_SRCS}) - add_executable(${MODULE_NAME} ${SRCS}) + add_executable(${MODULE_NAME} ${SRCS}) - add_definitions(-DTESTING_OUTPUT_DIRECTORY="${PROJECT_BINARY_DIR}") - add_definitions(-DTESTING_SRC_DIRECTORY="${PROJECT_SOURCE_DIR}") + add_definitions(-DTESTING_OUTPUT_DIRECTORY="${PROJECT_BINARY_DIR}") + add_definitions(-DTESTING_SRC_DIRECTORY="${PROJECT_SOURCE_DIR}") - target_link_libraries(${MODULE_NAME} freerdp winpr freerdp-client) + target_link_libraries(${MODULE_NAME} freerdp winpr freerdp-client) - set_target_properties(${MODULE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TESTING_OUTPUT_DIRECTORY}") + set_target_properties(${MODULE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TESTING_OUTPUT_DIRECTORY}") - foreach(test ${TEST_SRCS}) - get_filename_component(TestName ${test} NAME_WE) - add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) - endforeach() + foreach(test ${TEST_SRCS}) + get_filename_component(TestName ${test} NAME_WE) + add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) + endforeach() - set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "FreeRDP/Locale/Test") + set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "FreeRDP/Locale/Test") endif() diff --git a/libfreerdp/primitives/CMakeLists.txt b/libfreerdp/primitives/CMakeLists.txt index 6fb165012..022c3588e 100644 --- a/libfreerdp/primitives/CMakeLists.txt +++ b/libfreerdp/primitives/CMakeLists.txt @@ -1,150 +1,125 @@ # primitives set(PRIMITIVES_SRCS - prim_add.c - prim_add.h - prim_andor.c - prim_andor.h - prim_alphaComp.c - prim_alphaComp.h - prim_colors.c - prim_colors.h - prim_copy.c - prim_copy.h - prim_set.c - prim_set.h - prim_shift.c - prim_shift.h - prim_sign.c - prim_sign.h - prim_YUV.c - prim_YUV.h - prim_YCoCg.c - prim_YCoCg.h - primitives.c - prim_internal.h) - -set(PRIMITIVES_SSE2_SRCS - sse/prim_colors_sse2.c - sse/prim_set_sse2.c - ) - -set(PRIMITIVES_SSE3_SRCS - sse/prim_add_sse3.c - sse/prim_alphaComp_sse3.c - sse/prim_andor_sse3.c - sse/prim_shift_sse3.c - ) - -set(PRIMITIVES_SSSE3_SRCS - sse/prim_YUV_ssse3.c - sse/prim_sign_ssse3.c - sse/prim_YCoCg_ssse3.c - ) - -set(PRIMITIVES_SSE4_1_SRCS - sse/prim_copy_sse4_1.c - ) - -set(PRIMITIVES_SSE4_2_SRCS - ) - -set(PRIMITIVES_AVX2_SRCS - sse/prim_copy_avx2.c - ) - -set(PRIMITIVES_NEON_SRCS - neon/prim_colors_neon.c - neon/prim_YCoCg_neon.c - neon/prim_YUV_neon.c - ) - -set(PRIMITIVES_OPENCL_SRCS - opencl/prim_YUV_opencl.c + prim_add.c + prim_add.h + prim_andor.c + prim_andor.h + prim_alphaComp.c + prim_alphaComp.h + prim_colors.c + prim_colors.h + prim_copy.c + prim_copy.h + prim_set.c + prim_set.h + prim_shift.c + prim_shift.h + prim_sign.c + prim_sign.h + prim_YUV.c + prim_YUV.h + prim_YCoCg.c + prim_YCoCg.h + primitives.c + prim_internal.h ) -if (WITH_OPENCL) - set(FILENAME "opencl/primitives.cl") - set_source_files_properties(${FILENAME} PROPERTIES HEADER_FILE_ONLY ON) - list(APPEND PRIMITIVES_OPENCL_SRCS ${FILENAME}) +set(PRIMITIVES_SSE2_SRCS sse/prim_colors_sse2.c sse/prim_set_sse2.c) - include(ConvertFileToHexArray) - file_to_hex_array(${FILENAME} FILEDATA) +set(PRIMITIVES_SSE3_SRCS sse/prim_add_sse3.c sse/prim_alphaComp_sse3.c sse/prim_andor_sse3.c sse/prim_shift_sse3.c) - set(HDR_FILE "${CMAKE_CURRENT_BINARY_DIR}/opencl/primitives-opencl-program.h") - cleaning_configure_file("${CMAKE_CURRENT_SOURCE_DIR}/opencl/primitives.h.in" ${HDR_FILE} @ONLY) - list(APPEND PRIMITIVES_OPENCL_SRCS ${HDR_FILE}) +set(PRIMITIVES_SSSE3_SRCS sse/prim_YUV_ssse3.c sse/prim_sign_ssse3.c sse/prim_YCoCg_ssse3.c) - include_directories(${CMAKE_CURRENT_BINARY_DIR}/opencl) - freerdp_include_directory_add(${OpenCL_INCLUDE_DIRS}) - freerdp_library_add(OpenCL::OpenCL) +set(PRIMITIVES_SSE4_1_SRCS sse/prim_copy_sse4_1.c) + +set(PRIMITIVES_SSE4_2_SRCS) + +set(PRIMITIVES_AVX2_SRCS sse/prim_copy_avx2.c) + +set(PRIMITIVES_NEON_SRCS neon/prim_colors_neon.c neon/prim_YCoCg_neon.c neon/prim_YUV_neon.c) + +set(PRIMITIVES_OPENCL_SRCS opencl/prim_YUV_opencl.c) + +if(WITH_OPENCL) + set(FILENAME "opencl/primitives.cl") + set_source_files_properties(${FILENAME} PROPERTIES HEADER_FILE_ONLY ON) + list(APPEND PRIMITIVES_OPENCL_SRCS ${FILENAME}) + + include(ConvertFileToHexArray) + file_to_hex_array(${FILENAME} FILEDATA) + + set(HDR_FILE "${CMAKE_CURRENT_BINARY_DIR}/opencl/primitives-opencl-program.h") + cleaning_configure_file("${CMAKE_CURRENT_SOURCE_DIR}/opencl/primitives.h.in" ${HDR_FILE} @ONLY) + list(APPEND PRIMITIVES_OPENCL_SRCS ${HDR_FILE}) + + include_directories(${CMAKE_CURRENT_BINARY_DIR}/opencl) + freerdp_include_directory_add(${OpenCL_INCLUDE_DIRS}) + freerdp_library_add(OpenCL::OpenCL) endif() set(PRIMITIVES_OPT_SRCS - ${PRIMITIVES_NEON_SRCS} - ${PRIMITIVES_SSE2_SRCS} - ${PRIMITIVES_SSE3_SRCS} - ${PRIMITIVES_SSSE3_SRCS} - ${PRIMITIVES_SSE4_1_SRCS} - ${PRIMITIVES_SSE4_2_SRCS} - ${PRIMITIVES_OPENCL_SRCS}) + ${PRIMITIVES_NEON_SRCS} + ${PRIMITIVES_SSE2_SRCS} + ${PRIMITIVES_SSE3_SRCS} + ${PRIMITIVES_SSSE3_SRCS} + ${PRIMITIVES_SSE4_1_SRCS} + ${PRIMITIVES_SSE4_2_SRCS} + ${PRIMITIVES_OPENCL_SRCS} +) -if (WITH_AVX2) - list(APPEND PRIMITIVES_OPT_SRCS - ${PRIMITIVES_AVX2_SRCS} - ) +if(WITH_AVX2) + list(APPEND PRIMITIVES_OPT_SRCS ${PRIMITIVES_AVX2_SRCS}) endif() set(PRIMITIVES_SRCS ${PRIMITIVES_SRCS} ${PRIMITIVES_OPT_SRCS}) include_directories(${CMAKE_CURRENT_SOURCE_DIR}) -add_library(freerdp-primitives OBJECT - ${PRIMITIVES_SRCS} -) +add_library(freerdp-primitives OBJECT ${PRIMITIVES_SRCS}) include(CompilerDetect) -include (DetectIntrinsicSupport) +include(DetectIntrinsicSupport) if(WITH_SSE2) - if (HAVE_SSE_OR_AVX) - if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG) - if(PRIMITIVES_SSE2_SRCS) - set_source_files_properties(${PRIMITIVES_SSE2_SRCS} PROPERTIES COMPILE_FLAGS "-msse2" ) - endif() - if (PRIMITIVES_SSE3_SRCS) - set_source_files_properties(${PRIMITIVES_SSE3_SRCS} PROPERTIES COMPILE_FLAGS "-msse3" ) - endif() - if (PRIMITIVES_SSSE3_SRCS) - set_source_files_properties(${PRIMITIVES_SSSE3_SRCS} PROPERTIES COMPILE_FLAGS "-mssse3" ) - endif() - if (PRIMITIVES_SSE4_1_SRCS) - set_source_files_properties(${PRIMITIVES_SSE4_1_SRCS} PROPERTIES COMPILE_FLAGS "-msse4.1" ) - endif() - if (PRIMITIVES_SSE4_2_SRCS) - set_source_files_properties(${PRIMITIVES_SSE4_2_SRCS} PROPERTIES COMPILE_FLAGS "-msse4.2" ) - endif() - if (PRIMITIVES_AVX2_SRCS AND WITH_AVX2) - set_source_files_properties(${PRIMITIVES_AVX2_SRCS} PROPERTIES COMPILE_FLAGS "-mavx2" ) - endif() - endif() + if(HAVE_SSE_OR_AVX) + if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG) + if(PRIMITIVES_SSE2_SRCS) + set_source_files_properties(${PRIMITIVES_SSE2_SRCS} PROPERTIES COMPILE_FLAGS "-msse2") + endif() + if(PRIMITIVES_SSE3_SRCS) + set_source_files_properties(${PRIMITIVES_SSE3_SRCS} PROPERTIES COMPILE_FLAGS "-msse3") + endif() + if(PRIMITIVES_SSSE3_SRCS) + set_source_files_properties(${PRIMITIVES_SSSE3_SRCS} PROPERTIES COMPILE_FLAGS "-mssse3") + endif() + if(PRIMITIVES_SSE4_1_SRCS) + set_source_files_properties(${PRIMITIVES_SSE4_1_SRCS} PROPERTIES COMPILE_FLAGS "-msse4.1") + endif() + if(PRIMITIVES_SSE4_2_SRCS) + set_source_files_properties(${PRIMITIVES_SSE4_2_SRCS} PROPERTIES COMPILE_FLAGS "-msse4.2") + endif() + if(PRIMITIVES_AVX2_SRCS AND WITH_AVX2) + set_source_files_properties(${PRIMITIVES_AVX2_SRCS} PROPERTIES COMPILE_FLAGS "-mavx2") + endif() + endif() - if(MSVC) - set_source_files_properties(${PRIMITIVES_OPT_SRCS} PROPERTIES COMPILE_FLAGS "/arch:SSE2") - endif() + if(MSVC) + set_source_files_properties(${PRIMITIVES_OPT_SRCS} PROPERTIES COMPILE_FLAGS "/arch:SSE2") endif() + endif() elseif(WITH_NEON) - # aarch64 requires NEON by default, no flag required - if (HAVE_NEON AND NOT HAVE_NEON64) - if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG) - if (NOT MSVC_ARM64 AND NOT ARCH_ARM64) - set_source_files_properties(${PRIMITIVES_OPT_SRCS} PROPERTIES COMPILE_FLAGS "-mfpu=neon") - endif() - endif() - # TODO: Add MSVC equivalent + # aarch64 requires NEON by default, no flag required + if(HAVE_NEON AND NOT HAVE_NEON64) + if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG) + if(NOT MSVC_ARM64 AND NOT ARCH_ARM64) + set_source_files_properties(${PRIMITIVES_OPT_SRCS} PROPERTIES COMPILE_FLAGS "-mfpu=neon") + endif() endif() + # TODO: Add MSVC equivalent + endif() endif() freerdp_object_library_add(freerdp-primitives) if(BUILD_TESTING_INTERNAL AND NOT WIN32 AND NOT APPLE) - add_subdirectory(test) + add_subdirectory(test) endif() diff --git a/libfreerdp/primitives/test/CMakeLists.txt b/libfreerdp/primitives/test/CMakeLists.txt index 737325c88..7716f2993 100644 --- a/libfreerdp/primitives/test/CMakeLists.txt +++ b/libfreerdp/primitives/test/CMakeLists.txt @@ -1,4 +1,3 @@ - set(MODULE_NAME "TestPrimitives") set(MODULE_PREFIX "TEST_FREERDP_PRIMITIVES") @@ -7,26 +6,22 @@ disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR}) set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c) set(${MODULE_PREFIX}_TESTS - TestPrimitivesAdd.c - TestPrimitivesAlphaComp.c - TestPrimitivesAndOr.c - TestPrimitivesColors.c - TestPrimitivesCopy.c - TestPrimitivesSet.c - TestPrimitivesShift.c - TestPrimitivesSign.c - TestPrimitivesYUV.c - TestPrimitivesYCbCr.c - TestPrimitivesYCoCg.c) + TestPrimitivesAdd.c + TestPrimitivesAlphaComp.c + TestPrimitivesAndOr.c + TestPrimitivesColors.c + TestPrimitivesCopy.c + TestPrimitivesSet.c + TestPrimitivesShift.c + TestPrimitivesSign.c + TestPrimitivesYUV.c + TestPrimitivesYCbCr.c + TestPrimitivesYCoCg.c +) -create_test_sourcelist(${MODULE_PREFIX}_SRCS - ${${MODULE_PREFIX}_DRIVER} - ${${MODULE_PREFIX}_TESTS}) +create_test_sourcelist(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_DRIVER} ${${MODULE_PREFIX}_TESTS}) -set(${MODULE_PREFIX}_EXTRA_SRCS - prim_test.c - prim_test.h - measure.h) +set(${MODULE_PREFIX}_EXTRA_SRCS prim_test.c prim_test.h measure.h) add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS} ${${MODULE_PREFIX}_EXTRA_SRCS}) @@ -37,9 +32,8 @@ target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS}) set_target_properties(${MODULE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TESTING_OUTPUT_DIRECTORY}") foreach(test ${${MODULE_PREFIX}_TESTS}) - get_filename_component(TestName ${test} NAME_WE) - add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) + get_filename_component(TestName ${test} NAME_WE) + add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) endforeach() set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "FreeRDP/Test") - diff --git a/libfreerdp/utils/CMakeLists.txt b/libfreerdp/utils/CMakeLists.txt index 6fa15ec43..5040f9b0b 100644 --- a/libfreerdp/utils/CMakeLists.txt +++ b/libfreerdp/utils/CMakeLists.txt @@ -19,23 +19,23 @@ set(MODULE_NAME "freerdp-utils") set(MODULE_PREFIX "FREERDP_UTILS") set(${MODULE_PREFIX}_SRCS - encoded_types.c - helpers.c - passphrase.c - cliprdr_utils.c - rdpdr_utils.c - pcap.c - profiler.c - ringbuffer.c - signal.c + encoded_types.c + helpers.c + passphrase.c + cliprdr_utils.c + rdpdr_utils.c + pcap.c + profiler.c + ringbuffer.c + signal.c string.c gfx.c drdynvc.c - smartcard_operations.c - smartcard_pack.c - smartcard_call.c - stopwatch.c - http.c + smartcard_operations.c + smartcard_pack.c + smartcard_call.c + stopwatch.c + http.c ) freerdp_module_add(${${MODULE_PREFIX}_SRCS}) @@ -43,17 +43,17 @@ freerdp_module_add(${${MODULE_PREFIX}_SRCS}) freerdp_library_add(${CMAKE_THREAD_LIBS_INIT}) if(WIN32) - freerdp_library_add(ws2_32) - freerdp_library_add(credui) - freerdp_library_add(cfgmgr32) + freerdp_library_add(ws2_32) + freerdp_library_add(credui) + freerdp_library_add(cfgmgr32) endif() -CHECK_LIBRARY_EXISTS(m pow "" HAVE_LIB_M) +check_library_exists(m pow "" HAVE_LIB_M) -if (HAVE_LIB_M) - freerdp_library_add(m) +if(HAVE_LIB_M) + freerdp_library_add(m) endif() if(BUILD_TESTING_INTERNAL OR BUILD_TESTING) - add_subdirectory(test) + add_subdirectory(test) endif() diff --git a/libfreerdp/utils/test/CMakeLists.txt b/libfreerdp/utils/test/CMakeLists.txt index 48c40a9ef..b90c5f478 100644 --- a/libfreerdp/utils/test/CMakeLists.txt +++ b/libfreerdp/utils/test/CMakeLists.txt @@ -1,4 +1,3 @@ - set(MODULE_NAME "TestFreeRDPUtils") set(MODULE_PREFIX "TEST_FREERDP_UTILS") @@ -6,29 +5,22 @@ disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR}) set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c) -set(${MODULE_PREFIX}_TESTS - TestRingBuffer.c - TestPodArrays.c - TestEncodedTypes.c -) +set(${MODULE_PREFIX}_TESTS TestRingBuffer.c TestPodArrays.c TestEncodedTypes.c) -create_test_sourcelist(${MODULE_PREFIX}_SRCS - ${${MODULE_PREFIX}_DRIVER} - ${${MODULE_PREFIX}_TESTS}) +create_test_sourcelist(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_DRIVER} ${${MODULE_PREFIX}_TESTS}) add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) target_link_libraries(${MODULE_NAME} PRIVATE freerdp winpr) -if (NOT WIN32) - target_link_libraries(${MODULE_NAME} PRIVATE m) +if(NOT WIN32) + target_link_libraries(${MODULE_NAME} PRIVATE m) endif() set_target_properties(${MODULE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TESTING_OUTPUT_DIRECTORY}") foreach(test ${${MODULE_PREFIX}_TESTS}) - get_filename_component(TestName ${test} NAME_WE) - add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) + get_filename_component(TestName ${test} NAME_WE) + add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) endforeach() set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "FreeRDP/Test") - diff --git a/packaging/windows/preload.cmake b/packaging/windows/preload.cmake index 02a8ac450..f91281cd2 100644 --- a/packaging/windows/preload.cmake +++ b/packaging/windows/preload.cmake @@ -1,22 +1,22 @@ message("PRELOADING windows cache") -set (CMAKE_VERBOSE_MAKEFILE ON CACHE BOOL "nightly default") -set (CMAKE_WINDOWS_VERSION "WIN7" CACHE STRING "windows build version") -set (BUILD_SHARED_LIBS OFF CACHE BOOL "build static linked executable") -set (CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded" CACHE STRING "MSVC runtime to use") -set (OPENSSL_USE_STATIC_LIBS ON CACHE BOOL "link OpenSSL static") -set (CHANNEL_URBDRC OFF CACHE BOOL "we do not build libusb support") -set (WITH_CLIENT_SDL ON CACHE BOOL "build with SDL client") -set (WITH_SERVER ON CACHE BOOL "Build with server support") -set (WITH_SHADOW OFF CACHE BOOL "Do not build shadow server") -set (WITH_PROXY ON CACHE BOOL "Build proxy server") -set (WITH_PLATFORM_SERVER OFF CACHE BOOL "Do not build platform server") -set (WITH_INTERNAL_MD4 ON CACHE BOOL "nightly default") -set (WITH_INTERNAL_MD5 ON CACHE BOOL "nightly default") -set (WITH_INTERNAL_RC4 ON CACHE BOOL "nightly default") -set (WITH_FFMPEG OFF CACHE BOOL "nightly default") -set (WITH_SWSCALE OFF CACHE BOOL "nightly default") -set (WITH_WEBVIEW ON CACHE BOOL "nightly default") -set (ZLIB_USE_STATIC_LIBS ON CACHE BOOL "ci default") -set (WITH_SDL_IMAGE_DIALOGS ON CACHE BOOL "nightly default") -set (SDL_USE_COMPILED_RESOURCES ON CACHE BOOL "nightly default") -set (WITH_SDL_LINK_SHARED OFF CACHE BOOL "nightly default") +set(CMAKE_VERBOSE_MAKEFILE ON CACHE BOOL "nightly default") +set(CMAKE_WINDOWS_VERSION "WIN7" CACHE STRING "windows build version") +set(BUILD_SHARED_LIBS OFF CACHE BOOL "build static linked executable") +set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded" CACHE STRING "MSVC runtime to use") +set(OPENSSL_USE_STATIC_LIBS ON CACHE BOOL "link OpenSSL static") +set(CHANNEL_URBDRC OFF CACHE BOOL "we do not build libusb support") +set(WITH_CLIENT_SDL ON CACHE BOOL "build with SDL client") +set(WITH_SERVER ON CACHE BOOL "Build with server support") +set(WITH_SHADOW OFF CACHE BOOL "Do not build shadow server") +set(WITH_PROXY ON CACHE BOOL "Build proxy server") +set(WITH_PLATFORM_SERVER OFF CACHE BOOL "Do not build platform server") +set(WITH_INTERNAL_MD4 ON CACHE BOOL "nightly default") +set(WITH_INTERNAL_MD5 ON CACHE BOOL "nightly default") +set(WITH_INTERNAL_RC4 ON CACHE BOOL "nightly default") +set(WITH_FFMPEG OFF CACHE BOOL "nightly default") +set(WITH_SWSCALE OFF CACHE BOOL "nightly default") +set(WITH_WEBVIEW ON CACHE BOOL "nightly default") +set(ZLIB_USE_STATIC_LIBS ON CACHE BOOL "ci default") +set(WITH_SDL_IMAGE_DIALOGS ON CACHE BOOL "nightly default") +set(SDL_USE_COMPILED_RESOURCES ON CACHE BOOL "nightly default") +set(WITH_SDL_LINK_SHARED OFF CACHE BOOL "nightly default") diff --git a/rdtk/CMakeLists.txt b/rdtk/CMakeLists.txt index 633eb5e78..b8d418de3 100644 --- a/rdtk/CMakeLists.txt +++ b/rdtk/CMakeLists.txt @@ -23,26 +23,26 @@ set(RDTK_VERSION "${RDTK_VERSION_MAJOR}.${RDTK_VERSION_MINOR}.${RDTK_VERSION_REV set(RDTK_VERSION_FULL "${RDTK_VERSION}") set(RDTK_API_VERSION "${RDTK_VERSION_MAJOR}") -if (NOT FREERDP_UNIFIED_BUILD) - cmake_minimum_required(VERSION 3.13) - project(RdTk VERSION ${RDTK_VERSION} LANGUAGES C) +if(NOT FREERDP_UNIFIED_BUILD) + cmake_minimum_required(VERSION 3.13) + project(RdTk VERSION ${RDTK_VERSION} LANGUAGES C) - set(CMAKE_C_STANDARD 11) - set(CMAKE_C_STANDARD_REQUIRED ON) - set(CMAKE_C_EXTENSIONS ON) + set(CMAKE_C_STANDARD 11) + set(CMAKE_C_STANDARD_REQUIRED ON) + set(CMAKE_C_EXTENSIONS ON) - set(WINPR_VERSION_MAJOR 3) - option(EXPORT_ALL_SYMBOLS "Export all symbols form library" OFF) - option(BUILD_TESTING_INTERNAL "Build library unit tests" ON) + set(WINPR_VERSION_MAJOR 3) + option(EXPORT_ALL_SYMBOLS "Export all symbols form library" OFF) + option(BUILD_TESTING_INTERNAL "Build library unit tests" ON) - if(CMAKE_COMPILER_IS_GNUCC) - if(NOT EXPORT_ALL_SYMBOLS) - message(STATUS "GCC default symbol visibility: hidden") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden") - endif() - endif() + if(CMAKE_COMPILER_IS_GNUCC) + if(NOT EXPORT_ALL_SYMBOLS) + message(STATUS "GCC default symbol visibility: hidden") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden") + endif() + endif() else() - set(WINPR_VERSION_MAJOR ${FREERDP_VERSION_MAJOR}) + set(WINPR_VERSION_MAJOR ${FREERDP_VERSION_MAJOR}) endif() # Include our extra modules @@ -60,34 +60,34 @@ include(CheckCmakeCompat) include(FindFeature) include(CheckCCompilerFlag) include(CMakePackageConfigHelpers) -include (SetFreeRDPCMakeInstallDir) +include(SetFreeRDPCMakeInstallDir) option(RDTK_FORCE_STATIC_BUILD "Force RDTK to be built as static library (recommended)" OFF) -if (RDTK_FORCE_STATIC_BUILD) - set(BUILD_SHARED_LIBS OFF) +if(RDTK_FORCE_STATIC_BUILD) + set(BUILD_SHARED_LIBS OFF) endif() add_definitions(-DRDTK_EXPORTS) -if (NOT IOS) - check_include_files(stdbool.h RDTK_HAVE_STDBOOL_H) - if (NOT RDTK_HAVE_STDBOOL_H) - include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/../compat/stdbool) - endif() +if(NOT IOS) + check_include_files(stdbool.h RDTK_HAVE_STDBOOL_H) + if(NOT RDTK_HAVE_STDBOOL_H) + include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/../compat/stdbool) + endif() endif() include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) include_directories(${CMAKE_CURRENT_BINARY_DIR}/include) -if (FREERDP_UNIFIED_BUILD) - include_directories(${PROJECT_SOURCE_DIR}/winpr/include) - include_directories(${PROJECT_BINARY_DIR}/winpr/include) +if(FREERDP_UNIFIED_BUILD) + include_directories(${PROJECT_SOURCE_DIR}/winpr/include) + include_directories(${PROJECT_BINARY_DIR}/winpr/include) else() - find_package(WinPR 3 REQUIRED) - include_directories(${WinPR_INCLUDE_DIR}) + find_package(WinPR 3 REQUIRED) + include_directories(${WinPR_INCLUDE_DIR}) endif() -SetFreeRDPCMakeInstallDir(RDTK_CMAKE_INSTALL_DIR "rdtk${RDTK_VERSION_MAJOR}") +setfreerdpcmakeinstalldir(RDTK_CMAKE_INSTALL_DIR "rdtk${RDTK_VERSION_MAJOR}") set(RDTK_INCLUDE_DIR include/rdtk${RDTK_API_VERSION}) @@ -95,13 +95,12 @@ add_subdirectory(librdtk) add_subdirectory(templates) add_subdirectory(include) -if (NOT RDTK_FORCE_STATIC_BUILD) - install(EXPORT rdtk DESTINATION ${RDTK_CMAKE_INSTALL_DIR}) +if(NOT RDTK_FORCE_STATIC_BUILD) + install(EXPORT rdtk DESTINATION ${RDTK_CMAKE_INSTALL_DIR}) endif() if(WITH_SAMPLE) - if(WITH_X11) - add_subdirectory(sample) - endif() + if(WITH_X11) + add_subdirectory(sample) + endif() endif() - diff --git a/rdtk/include/CMakeLists.txt b/rdtk/include/CMakeLists.txt index 1ecad4e82..afaa7cb62 100644 --- a/rdtk/include/CMakeLists.txt +++ b/rdtk/include/CMakeLists.txt @@ -1,10 +1,5 @@ +if(NOT RDTK_FORCE_STATIC_BUILD) + install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${RDTK_INCLUDE_DIR} FILES_MATCHING PATTERN "*.h") -if (NOT RDTK_FORCE_STATIC_BUILD) - install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ - DESTINATION ${RDTK_INCLUDE_DIR} - FILES_MATCHING PATTERN "*.h") - - install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/ - DESTINATION ${RDTK_INCLUDE_DIR} - FILES_MATCHING PATTERN "*.h") + install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/ DESTINATION ${RDTK_INCLUDE_DIR} FILES_MATCHING PATTERN "*.h") endif() diff --git a/rdtk/librdtk/CMakeLists.txt b/rdtk/librdtk/CMakeLists.txt index 5076aef81..96ada15b2 100644 --- a/rdtk/librdtk/CMakeLists.txt +++ b/rdtk/librdtk/CMakeLists.txt @@ -17,26 +17,26 @@ set(MODULE_NAME "rdtk") set(MODULE_PREFIX "RDTK") - set(${MODULE_PREFIX}_SRCS - rdtk_resources.c - rdtk_resources.h - rdtk_surface.c - rdtk_surface.h - rdtk_font.c - rdtk_font.h - rdtk_button.c - rdtk_button.h - rdtk_label.c - rdtk_label.h - rdtk_nine_patch.c - rdtk_nine_patch.h - rdtk_text_field.c - rdtk_text_field.h - rdtk_engine.c - rdtk_engine.h) + rdtk_resources.c + rdtk_resources.h + rdtk_surface.c + rdtk_surface.h + rdtk_font.c + rdtk_font.h + rdtk_button.c + rdtk_button.h + rdtk_label.c + rdtk_label.h + rdtk_nine_patch.c + rdtk_nine_patch.h + rdtk_text_field.c + rdtk_text_field.h + rdtk_engine.c + rdtk_engine.h +) -AddTargetWithResourceFile(${MODULE_NAME} FALSE "${RDTK_VERSION}" ${MODULE_PREFIX}_SRCS) +addtargetwithresourcefile(${MODULE_NAME} FALSE "${RDTK_VERSION}" ${MODULE_PREFIX}_SRCS) list(APPEND ${MODULE_PREFIX}_LIBS winpr) @@ -46,12 +46,11 @@ target_link_libraries(${MODULE_NAME} PRIVATE ${${MODULE_PREFIX}_LIBS}) set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "RdTk") if(BUILD_TESTING_INTERNAL OR BUILD_TESTING) - add_subdirectory(test) + add_subdirectory(test) endif() -if (NOT RDTK_FORCE_STATIC_BUILD) - install(TARGETS ${MODULE_NAME} COMPONENT libraries EXPORT rdtk - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) +if(NOT RDTK_FORCE_STATIC_BUILD) + install(TARGETS ${MODULE_NAME} COMPONENT libraries EXPORT rdtk ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + ) endif() diff --git a/rdtk/librdtk/test/CMakeLists.txt b/rdtk/librdtk/test/CMakeLists.txt index 87faa76c2..3a754a020 100644 --- a/rdtk/librdtk/test/CMakeLists.txt +++ b/rdtk/librdtk/test/CMakeLists.txt @@ -1,4 +1,3 @@ - set(MODULE_NAME "TestRdTk") set(MODULE_PREFIX "TEST_RDTK") @@ -6,12 +5,9 @@ disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR}) set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c) -set(${MODULE_PREFIX}_TESTS - TestRdTkNinePatch.c) +set(${MODULE_PREFIX}_TESTS TestRdTkNinePatch.c) -create_test_sourcelist(${MODULE_PREFIX}_SRCS - ${${MODULE_PREFIX}_DRIVER} - ${${MODULE_PREFIX}_TESTS}) +create_test_sourcelist(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_DRIVER} ${${MODULE_PREFIX}_TESTS}) add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) @@ -20,8 +16,8 @@ target_link_libraries(${MODULE_NAME} winpr rdtk) set_target_properties(${MODULE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TESTING_OUTPUT_DIRECTORY}") foreach(test ${${MODULE_PREFIX}_TESTS}) - get_filename_component(TestName ${test} NAME_WE) - add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) + get_filename_component(TestName ${test} NAME_WE) + add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) endforeach() set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "RdTk/Test") diff --git a/rdtk/sample/CMakeLists.txt b/rdtk/sample/CMakeLists.txt index acaaef728..de8b1d6c3 100644 --- a/rdtk/sample/CMakeLists.txt +++ b/rdtk/sample/CMakeLists.txt @@ -22,10 +22,9 @@ find_package(X11 REQUIRED) include_directories(SYSTEM ${X11_INCLUDE_DIR}) -set(SRCS - rdtk_x11.c) +set(SRCS rdtk_x11.c) -AddTargetWithResourceFile(${MODULE_NAME} TRUE "${RDTK_VERSION}" SRCS) +addtargetwithresourcefile(${MODULE_NAME} TRUE "${RDTK_VERSION}" SRCS) set(LIBS rdtk) @@ -34,4 +33,3 @@ list(APPEND LIBS ${X11_LIBRARIES}) target_link_libraries(${MODULE_NAME} PRIVATE ${LIBS} winpr) set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "RdTk") - diff --git a/rdtk/templates/CMakeLists.txt b/rdtk/templates/CMakeLists.txt index ff4eb04fc..0fa9ab6c7 100644 --- a/rdtk/templates/CMakeLists.txt +++ b/rdtk/templates/CMakeLists.txt @@ -1,48 +1,48 @@ +if(NOT RDTK_FORCE_STATIC_BUILD) + include(SetFreeRDPCMakeInstallDir) -if (NOT RDTK_FORCE_STATIC_BUILD) - include (SetFreeRDPCMakeInstallDir) + # cmake package + export(PACKAGE rdtk) - # cmake package - export(PACKAGE rdtk) + configure_package_config_file( + ${CMAKE_CURRENT_SOURCE_DIR}/rdtkConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/rdtkConfig.cmake + INSTALL_DESTINATION ${RDTK_CMAKE_INSTALL_DIR} PATH_VARS RDTK_INCLUDE_DIR + ) - configure_package_config_file( - ${CMAKE_CURRENT_SOURCE_DIR}/rdtkConfig.cmake.in - ${CMAKE_CURRENT_BINARY_DIR}/rdtkConfig.cmake - INSTALL_DESTINATION ${RDTK_CMAKE_INSTALL_DIR} - PATH_VARS RDTK_INCLUDE_DIR) - - write_basic_package_version_file( - ${CMAKE_CURRENT_BINARY_DIR}/rdtkConfigVersion.cmake - VERSION ${RDTK_VERSION} - COMPATIBILITY SameMajorVersion) + write_basic_package_version_file( + ${CMAKE_CURRENT_BINARY_DIR}/rdtkConfigVersion.cmake VERSION ${RDTK_VERSION} COMPATIBILITY SameMajorVersion + ) endif() set(RDTK_BUILD_CONFIG_LIST "") -GET_CMAKE_PROPERTY(res VARIABLES) -FOREACH(var ${res}) - IF (var MATCHES "^WITH_*|^BUILD_TESTING*|^RDTK_HAVE_*") - LIST(APPEND RDTK_BUILD_CONFIG_LIST "${var}=${${var}}") - ENDIF() -ENDFOREACH() +get_cmake_property(res VARIABLES) +foreach(var ${res}) + if(var MATCHES "^WITH_*|^BUILD_TESTING*|^RDTK_HAVE_*") + list(APPEND RDTK_BUILD_CONFIG_LIST "${var}=${${var}}") + endif() +endforeach() include(pkg-config-install-prefix) string(REPLACE ";" " " RDTK_BUILD_CONFIG "${RDTK_BUILD_CONFIG_LIST}") cleaning_configure_file(${CMAKE_CURRENT_SOURCE_DIR}/version.h.in ${CMAKE_CURRENT_BINARY_DIR}/../include/rdtk/version.h) -cleaning_configure_file(${CMAKE_CURRENT_SOURCE_DIR}/buildflags.h.in ${CMAKE_CURRENT_BINARY_DIR}/../include/rdtk/buildflags.h) -cleaning_configure_file(${CMAKE_CURRENT_SOURCE_DIR}/build-config.h.in ${CMAKE_CURRENT_BINARY_DIR}/../include/rdtk/build-config.h) +cleaning_configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/buildflags.h.in ${CMAKE_CURRENT_BINARY_DIR}/../include/rdtk/buildflags.h +) +cleaning_configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/build-config.h.in ${CMAKE_CURRENT_BINARY_DIR}/../include/rdtk/build-config.h +) cleaning_configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/../include/rdtk/config.h) -if (NOT RDTK_FORCE_STATIC_BUILD) - cleaning_configure_file(${CMAKE_CURRENT_SOURCE_DIR}/rdtk.pc.in ${CMAKE_CURRENT_BINARY_DIR}/rdtk${RDTK_VERSION_MAJOR}.pc @ONLY) +if(NOT RDTK_FORCE_STATIC_BUILD) + cleaning_configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/rdtk.pc.in ${CMAKE_CURRENT_BINARY_DIR}/rdtk${RDTK_VERSION_MAJOR}.pc @ONLY + ) - set(RDTK_INSTALL_INCLUDE_DIR ${RDTK_INCLUDE_DIR}/rdtk) - install(FILES - ${CMAKE_CURRENT_BINARY_DIR}/rdtk${RDTK_VERSION_MAJOR}.pc - DESTINATION ${PKG_CONFIG_PC_INSTALL_DIR}) + set(RDTK_INSTALL_INCLUDE_DIR ${RDTK_INCLUDE_DIR}/rdtk) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/rdtk${RDTK_VERSION_MAJOR}.pc DESTINATION ${PKG_CONFIG_PC_INSTALL_DIR}) - install(FILES - ${CMAKE_CURRENT_BINARY_DIR}/rdtkConfig.cmake - ${CMAKE_CURRENT_BINARY_DIR}/rdtkConfigVersion.cmake - DESTINATION ${RDTK_CMAKE_INSTALL_DIR}) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/rdtkConfig.cmake ${CMAKE_CURRENT_BINARY_DIR}/rdtkConfigVersion.cmake + DESTINATION ${RDTK_CMAKE_INSTALL_DIR} + ) endif() diff --git a/scripts/mingw64.cmake b/scripts/mingw64.cmake index 9cc1dbeea..8cbaf3db3 100644 --- a/scripts/mingw64.cmake +++ b/scripts/mingw64.cmake @@ -1,81 +1,35 @@ -set(CMAKE_SYSTEM_NAME - Windows - CACHE STRING "toolchain default") +set(CMAKE_SYSTEM_NAME Windows CACHE STRING "toolchain default") -set(CMAKE_SYSTEM_PROCESSOR - amd64 - CACHE STRING "toolchain default") +set(CMAKE_SYSTEM_PROCESSOR amd64 CACHE STRING "toolchain default") # https://github.com/meganz/mingw-std-threads # # we simply compile with the POSIX C++ primitives, but faster is using the wrapper -set(CMAKE_C_COMPILER - /usr/bin/x86_64-w64-mingw32-gcc-posix - CACHE STRING "toolchain default") -set(CMAKE_CXX_COMPILER - /usr/bin/x86_64-w64-mingw32-g++-posix - CACHE STRING "toolchain default") -set(CMAKE_RC_COMPILER_INIT - /usr/bin/x86_64-w64-mingw32-windres - CACHE STRING "toolchain default") -set(CMAKE_RC_COMPILER - /usr/bin/x86_64-w64-mingw32-windres - CACHE STRING "toolchain default") -set(CMAKE_AR - /usr/bin/x86_64-w64-mingw32-gcc-ar-posix - CACHE STRING "toolchain default") -set(CMAKE_C_COMPILER_AR - /usr/bin/x86_64-w64-mingw32-gcc-ar-posix - CACHE STRING "toolchain default") -set(CMAKE_CXX_COMPILER_AR - /usr/bin/x86_64-w64-mingw32-gcc-ar-posix - CACHE STRING "toolchain default") -set(CMAKE_RANLIB - /usr/bin/x86_64-w64-mingw32-gcc-ranlib-posix - CACHE STRING "toolchain default") -set(CMAKE_C_COMPILER_RANLIB - /usr/bin/x86_64-w64-mingw32-gcc-ranlib-posix - CACHE STRING "toolchain default") -set(CMAKE_CXX_COMPILER_RANLIB - /usr/bin/x86_64-w64-mingw32-gcc-ranlib-posix - CACHE STRING "toolchain default") -set(CMAKE_LINKER - /usr/bin/x86_64-w64-mingw32-ld-posix - CACHE STRING "toolchain default") -set(CMAKE_NM - /usr/bin/x86_64-w64-mingw32-nm-posix - CACHE STRING "toolchain default") -set(CMAKE_READELF - /usr/bin/x86_64-w64-mingw32-readelf - CACHE STRING "toolchain default") -set(CMAKE_OBJCOPY - /usr/bin/x86_64-w64-mingw32-objcopy - CACHE STRING "toolchain default") -set(CMAKE_OBJDUMP - /usr/bin/x86_64-w64-mingw32-objdump - CACHE STRING "toolchain default") +set(CMAKE_C_COMPILER /usr/bin/x86_64-w64-mingw32-gcc-posix CACHE STRING "toolchain default") +set(CMAKE_CXX_COMPILER /usr/bin/x86_64-w64-mingw32-g++-posix CACHE STRING "toolchain default") +set(CMAKE_RC_COMPILER_INIT /usr/bin/x86_64-w64-mingw32-windres CACHE STRING "toolchain default") +set(CMAKE_RC_COMPILER /usr/bin/x86_64-w64-mingw32-windres CACHE STRING "toolchain default") +set(CMAKE_AR /usr/bin/x86_64-w64-mingw32-gcc-ar-posix CACHE STRING "toolchain default") +set(CMAKE_C_COMPILER_AR /usr/bin/x86_64-w64-mingw32-gcc-ar-posix CACHE STRING "toolchain default") +set(CMAKE_CXX_COMPILER_AR /usr/bin/x86_64-w64-mingw32-gcc-ar-posix CACHE STRING "toolchain default") +set(CMAKE_RANLIB /usr/bin/x86_64-w64-mingw32-gcc-ranlib-posix CACHE STRING "toolchain default") +set(CMAKE_C_COMPILER_RANLIB /usr/bin/x86_64-w64-mingw32-gcc-ranlib-posix CACHE STRING "toolchain default") +set(CMAKE_CXX_COMPILER_RANLIB /usr/bin/x86_64-w64-mingw32-gcc-ranlib-posix CACHE STRING "toolchain default") +set(CMAKE_LINKER /usr/bin/x86_64-w64-mingw32-ld-posix CACHE STRING "toolchain default") +set(CMAKE_NM /usr/bin/x86_64-w64-mingw32-nm-posix CACHE STRING "toolchain default") +set(CMAKE_READELF /usr/bin/x86_64-w64-mingw32-readelf CACHE STRING "toolchain default") +set(CMAKE_OBJCOPY /usr/bin/x86_64-w64-mingw32-objcopy CACHE STRING "toolchain default") +set(CMAKE_OBJDUMP /usr/bin/x86_64-w64-mingw32-objdump CACHE STRING "toolchain default") -set(CMAKE_SYSROOT - /usr/x86_64-w64-mingw32 - CACHE STRING "toolchain default") +set(CMAKE_SYSROOT /usr/x86_64-w64-mingw32 CACHE STRING "toolchain default") #set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER CACHE STRING "toolchain default") #set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY CACHE STRING "toolchain default") #set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY CACHE STRING "toolchain default") #set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY CACHE STRING "toolchain default") -set(CMAKE_WINDOWS_VERSION - "WIN10" - CACHE STRING "toolchain default") -set(CMAKE_BUILD_TYPE - "RelWithDebInfo" - CACHE STRING "toolchain default") -set(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY - ON - CACHE BOOL "toolchain default") -set(CMAKE_VERBOSE_MAKEFILE - ON - CACHE BOOL "toolchain default") -set(THREADS_PREFER_PTHREAD_FLAG - ON - CACHE BOOL "toolchain default") +set(CMAKE_WINDOWS_VERSION "WIN10" CACHE STRING "toolchain default") +set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "toolchain default") +set(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY ON CACHE BOOL "toolchain default") +set(CMAKE_VERBOSE_MAKEFILE ON CACHE BOOL "toolchain default") +set(THREADS_PREFER_PTHREAD_FLAG ON CACHE BOOL "toolchain default") diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt index 1140be949..f40d95d17 100644 --- a/server/CMakeLists.txt +++ b/server/CMakeLists.txt @@ -21,33 +21,33 @@ option(WITH_PROXY "Compile with proxy server" ON) option(WITH_PLATFORM_SERVER "Compile with platform server" ON) add_subdirectory(common) -if (WITH_SHADOW) - add_subdirectory(shadow) +if(WITH_SHADOW) + add_subdirectory(shadow) endif() -if (WITH_PROXY) - add_subdirectory(proxy) +if(WITH_PROXY) + add_subdirectory(proxy) endif() if(WITH_SAMPLE) - add_subdirectory(Sample) + add_subdirectory(Sample) endif() -if (WITH_PLATFORM_SERVER) - if(NOT WIN32) - if(APPLE AND (NOT IOS)) - add_subdirectory(Mac) - endif() - else() - add_subdirectory(Windows) - endif() +if(WITH_PLATFORM_SERVER) + if(NOT WIN32) + if(APPLE AND (NOT IOS)) + add_subdirectory(Mac) + endif() + else() + add_subdirectory(Windows) + endif() - if(NOT DEFINED WITH_FREERDS) - set(WITH_FREERDS 1) - endif() + if(NOT DEFINED WITH_FREERDS) + set(WITH_FREERDS 1) + endif() - if(WITH_FREERDS AND (IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/FreeRDS")) - add_subdirectory("FreeRDS") - endif() + if(WITH_FREERDS AND (IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/FreeRDS")) + add_subdirectory("FreeRDS") + endif() endif() # Pick up other servers @@ -56,38 +56,48 @@ set(FILENAME "ModuleOptions.cmake") file(GLOB FILEPATHS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*/${FILENAME}") foreach(FILEPATH ${FILEPATHS}) - if(${FILEPATH} MATCHES "^([^/]*)/+${FILENAME}") - string(REGEX REPLACE "^([^/]*)/+${FILENAME}" "\\1" FREERDP_SERVER ${FILEPATH}) - set(FREERDP_SERVER_ENABLED 0) - include(${FILEPATH}) - if(FREERDP_SERVER_ENABLED) - if(NOT (${FREERDP_SERVER_VENDOR} MATCHES "FreeRDP")) - list(APPEND FREERDP_EXTRA_SERVERS ${FREERDP_SERVER}) - endif() - endif() - endif() + if(${FILEPATH} MATCHES "^([^/]*)/+${FILENAME}") + string(REGEX REPLACE "^([^/]*)/+${FILENAME}" "\\1" FREERDP_SERVER ${FILEPATH}) + set(FREERDP_SERVER_ENABLED 0) + include(${FILEPATH}) + if(FREERDP_SERVER_ENABLED) + if(NOT (${FREERDP_SERVER_VENDOR} MATCHES "FreeRDP")) + list(APPEND FREERDP_EXTRA_SERVERS ${FREERDP_SERVER}) + endif() + endif() + endif() endforeach() foreach(FREERDP_SERVER ${FREERDP_EXTRA_SERVERS}) - add_subdirectory(${FREERDP_SERVER}) + add_subdirectory(${FREERDP_SERVER}) endforeach() include(pkg-config-install-prefix) -cleaning_configure_file(${CMAKE_CURRENT_SOURCE_DIR}/freerdp-server.pc.in ${CMAKE_CURRENT_BINARY_DIR}/freerdp-server${FREERDP_VERSION_MAJOR}.pc @ONLY) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/freerdp-server${FREERDP_VERSION_MAJOR}.pc DESTINATION ${PKG_CONFIG_PC_INSTALL_DIR}) +cleaning_configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/freerdp-server.pc.in + ${CMAKE_CURRENT_BINARY_DIR}/freerdp-server${FREERDP_VERSION_MAJOR}.pc @ONLY +) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/freerdp-server${FREERDP_VERSION_MAJOR}.pc + DESTINATION ${PKG_CONFIG_PC_INSTALL_DIR} +) export(PACKAGE freerdp-server) -SetFreeRDPCMakeInstallDir(FREERDP_SERVER_CMAKE_INSTALL_DIR "FreeRDP-Server${FREERDP_VERSION_MAJOR}") +setfreerdpcmakeinstalldir(FREERDP_SERVER_CMAKE_INSTALL_DIR "FreeRDP-Server${FREERDP_VERSION_MAJOR}") -configure_package_config_file(FreeRDP-ServerConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/FreeRDP-ServerConfig.cmake - INSTALL_DESTINATION ${FREERDP_SERVER_CMAKE_INSTALL_DIR} - PATH_VARS FREERDP_INCLUDE_DIR) +configure_package_config_file( + FreeRDP-ServerConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/FreeRDP-ServerConfig.cmake + INSTALL_DESTINATION ${FREERDP_SERVER_CMAKE_INSTALL_DIR} PATH_VARS FREERDP_INCLUDE_DIR +) -write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/FreeRDP-ServerConfigVersion.cmake - VERSION ${FREERDP_VERSION} COMPATIBILITY SameMajorVersion) +write_basic_package_version_file( + ${CMAKE_CURRENT_BINARY_DIR}/FreeRDP-ServerConfigVersion.cmake VERSION ${FREERDP_VERSION} + COMPATIBILITY SameMajorVersion +) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/FreeRDP-ServerConfig.cmake ${CMAKE_CURRENT_BINARY_DIR}/FreeRDP-ServerConfigVersion.cmake - DESTINATION ${FREERDP_SERVER_CMAKE_INSTALL_DIR}) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/FreeRDP-ServerConfig.cmake + ${CMAKE_CURRENT_BINARY_DIR}/FreeRDP-ServerConfigVersion.cmake + DESTINATION ${FREERDP_SERVER_CMAKE_INSTALL_DIR} +) install(EXPORT FreeRDP-ServerTargets DESTINATION ${FREERDP_SERVER_CMAKE_INSTALL_DIR}) diff --git a/server/Mac/CMakeLists.txt b/server/Mac/CMakeLists.txt index 9dddb387f..dd5792d36 100644 --- a/server/Mac/CMakeLists.txt +++ b/server/Mac/CMakeLists.txt @@ -18,57 +18,56 @@ set(MODULE_NAME "mfreerdp-server") set(MODULE_PREFIX "FREERDP_SERVER_MAC") -FIND_LIBRARY(AUDIO_TOOL AudioToolbox) -FIND_LIBRARY(CORE_AUDIO CoreAudio) -FIND_LIBRARY(CORE_VIDEO CoreVideo) -FIND_LIBRARY(APP_SERVICES ApplicationServices) -FIND_LIBRARY(IOKIT IOKit) -FIND_LIBRARY(IOSURFACE IOSurface) -FIND_LIBRARY(CARBON Carbon) +find_library(AUDIO_TOOL AudioToolbox) +find_library(CORE_AUDIO CoreAudio) +find_library(CORE_VIDEO CoreVideo) +find_library(APP_SERVICES ApplicationServices) +find_library(IOKIT IOKit) +find_library(IOSURFACE IOSurface) +find_library(CARBON Carbon) set(${MODULE_PREFIX}_SRCS - mfreerdp.c - mfreerdp.h - mf_interface.c - mf_interface.h - mf_event.c - mf_event.h - mf_peer.c - mf_peer.h - mf_info.c - mf_info.h - mf_input.c - mf_input.h - mf_mountain_lion.c - mf_mountain_lion.h) + mfreerdp.c + mfreerdp.h + mf_interface.c + mf_interface.h + mf_event.c + mf_event.h + mf_peer.c + mf_peer.h + mf_info.c + mf_info.h + mf_input.c + mf_input.h + mf_mountain_lion.c + mf_mountain_lion.h +) if(CHANNEL_AUDIN_SERVER) - set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} - mf_audin.c - mf_audin.h) + set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} mf_audin.c mf_audin.h) endif() if(CHANNEL_RDPSND_SERVER) - set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} - mf_rdpsnd.c - mf_rdpsnd.h) + set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} mf_rdpsnd.c mf_rdpsnd.h) -endif() - -add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) -if (WITH_BINARY_VERSIONING) - set_target_properties(${MODULE_NAME} PROPERTIES OUTPUT_NAME "${MODULE_NAME}${FREERDP_API_VERSION}") endif() -set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} - freerdp-server - ${AUDIO_TOOL} - ${CORE_AUDIO} - ${CORE_VIDEO} - ${APP_SERVICES} - ${IOKIT} - ${IOSURFACE} - ${CARBON}) +add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) +if(WITH_BINARY_VERSIONING) + set_target_properties(${MODULE_NAME} PROPERTIES OUTPUT_NAME "${MODULE_NAME}${FREERDP_API_VERSION}") +endif() + +set(${MODULE_PREFIX}_LIBS + ${${MODULE_PREFIX}_LIBS} + freerdp-server + ${AUDIO_TOOL} + ${CORE_AUDIO} + ${CORE_VIDEO} + ${APP_SERVICES} + ${IOKIT} + ${IOSURFACE} + ${CARBON} +) set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} winpr freerdp) diff --git a/server/Mac/ModuleOptions.cmake b/server/Mac/ModuleOptions.cmake index bfd36cbbf..1699b443a 100644 --- a/server/Mac/ModuleOptions.cmake +++ b/server/Mac/ModuleOptions.cmake @@ -1,4 +1,3 @@ - set(FREERDP_SERVER_NAME "mfreerdp-server") set(FREERDP_SERVER_PLATFORM "X11") set(FREERDP_SERVER_VENDOR "FreeRDP") diff --git a/server/Sample/CMakeLists.txt b/server/Sample/CMakeLists.txt index 34f25b228..e46bb62ee 100644 --- a/server/Sample/CMakeLists.txt +++ b/server/Sample/CMakeLists.txt @@ -19,48 +19,41 @@ set(MODULE_NAME "sfreerdp-server") set(MODULE_PREFIX "FREERDP_SERVER_SAMPLE") set(SRCS - sfreerdp.c - sfreerdp.h - sf_audin.c - sf_audin.h - sf_rdpsnd.c - sf_rdpsnd.h - sf_encomsp.c - sf_encomsp.h) + sfreerdp.c + sfreerdp.h + sf_audin.c + sf_audin.h + sf_rdpsnd.c + sf_rdpsnd.h + sf_encomsp.c + sf_encomsp.h +) -if (CHANNEL_AINPUT_SERVER) - list(APPEND SRCS sf_ainput.c sf_ainput.h) +if(CHANNEL_AINPUT_SERVER) + list(APPEND SRCS sf_ainput.c sf_ainput.h) endif() option(SAMPLE_USE_VENDOR_PRODUCT_CONFIG_DIR "Use / path for resources" OFF) set(SAMPLE_RESOURCE_ROOT ${CMAKE_INSTALL_FULL_DATAROOTDIR}) -if (SAMPLE_USE_VENDOR_PRODUCT_CONFIG_DIR) - string(APPEND SAMPLE_RESOURCE_ROOT "/${VENDOR}") +if(SAMPLE_USE_VENDOR_PRODUCT_CONFIG_DIR) + string(APPEND SAMPLE_RESOURCE_ROOT "/${VENDOR}") endif() string(APPEND SAMPLE_RESOURCE_ROOT "/${PRODUCT}") -if (WITH_RESOURCE_VERSIONING) - string(APPEND SAMPLE_RESOURCE_ROOT "${FREERDP_VERSION_MAJOR}") +if(WITH_RESOURCE_VERSIONING) + string(APPEND SAMPLE_RESOURCE_ROOT "${FREERDP_VERSION_MAJOR}") endif() string(APPEND SAMPLE_RESOURCE_ROOT "/images") -set(SAMPLE_ICONS - test_icon.bmp - test_icon.png - test_icon.jpg - test_icon.webp -) +set(SAMPLE_ICONS test_icon.bmp test_icon.png test_icon.jpg test_icon.webp) install(FILES ${SAMPLE_ICONS} DESTINATION ${SAMPLE_RESOURCE_ROOT}) # We need this in runtime path for TestConnect file(COPY test_icon.bmp DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) -AddTargetWithResourceFile(${MODULE_NAME} TRUE "${FREERDP_VERSION}" SRCS) +addtargetwithresourcefile(${MODULE_NAME} TRUE "${FREERDP_VERSION}" SRCS) -target_compile_definitions(${MODULE_NAME} - PRIVATE - -DSAMPLE_RESOURCE_ROOT="${SAMPLE_RESOURCE_ROOT}" -) +target_compile_definitions(${MODULE_NAME} PRIVATE -DSAMPLE_RESOURCE_ROOT="${SAMPLE_RESOURCE_ROOT}") list(APPEND LIBS freerdp-server) list(APPEND LIBS winpr freerdp) diff --git a/server/Sample/ModuleOptions.cmake b/server/Sample/ModuleOptions.cmake index 5621f6d78..a61be6c7e 100644 --- a/server/Sample/ModuleOptions.cmake +++ b/server/Sample/ModuleOptions.cmake @@ -1,4 +1,3 @@ - set(FREERDP_SERVER_NAME "sfreerdp-server") set(FREERDP_SERVER_PLATFORM "Sample") set(FREERDP_SERVER_VENDOR "FreeRDP") diff --git a/server/Windows/CMakeLists.txt b/server/Windows/CMakeLists.txt index 20f151811..e052beb0f 100644 --- a/server/Windows/CMakeLists.txt +++ b/server/Windows/CMakeLists.txt @@ -1,95 +1,82 @@ -# FreeRDP: A Remote Desktop Protocol Implementation -# FreeRDP Windows Server cmake build script -# -# Copyright 2012 Marc-Andre Moreau -# -# 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. - -set(MODULE_NAME "wfreerdp-server") -set(MODULE_PREFIX "FREERDP_SERVER_WINDOWS") - -include (WarnUnmaintained) -warn_unmaintained(${MODULE_NAME}) - -include_directories(.) - -set(${MODULE_PREFIX}_SRCS - wf_update.c - wf_update.h - wf_dxgi.c - wf_dxgi.h - wf_input.c - wf_input.h - wf_interface.c - wf_interface.h - wf_mirage.c - wf_mirage.h - wf_peer.c - wf_peer.h - wf_settings.c - wf_settings.h - wf_info.c - wf_info.h) - -if(CHANNEL_RDPSND AND NOT WITH_RDPSND_DSOUND) - set(${MODULE_PREFIX}_SRCS - ${${MODULE_PREFIX}_SRCS} - wf_rdpsnd.c - wf_rdpsnd.h - wf_wasapi.c - wf_wasapi.h - ) -endif() - -if(CHANNEL_RDPSND AND WITH_RDPSND_DSOUND) - set(${MODULE_PREFIX}_SRCS - ${${MODULE_PREFIX}_SRCS} - wf_rdpsnd.c - wf_rdpsnd.h - wf_directsound.c - wf_directsound.h - ) -endif() - -if(WITH_SERVER_INTERFACE) - AddTargetWithResourceFile(${MODULE_NAME} FALSE "${FREERDP_VERSION}" ${MODULE_PREFIX}_SRCS) - target_include_directories(${MODULE_NAME} INTERFACE $) -else() - list(APPEND ${MODULE_PREFIX}_SRCS cli/wfreerdp.c cli/wfreerdp.h) - AddTargetWithResourceFile(${MODULE_NAME} TRUE "${FREERDP_VERSION}" ${MODULE_PREFIX}_SRCS) -endif() - - -if(NOT CMAKE_WINDOWS_VERSION STREQUAL "WINXP") - set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} d3d11 dxgi) -endif() - -set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} dsound) -set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} freerdp-server freerdp) - -target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS}) - -if(WITH_SERVER_INTERFACE) - install(TARGETS ${MODULE_NAME} COMPONENT libraries - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) -else() - install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT server) -endif() - -if(WITH_SERVER_INTERFACE) - add_subdirectory(cli) -endif() - -set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Server/Windows") +# FreeRDP: A Remote Desktop Protocol Implementation +# FreeRDP Windows Server cmake build script +# +# Copyright 2012 Marc-Andre Moreau +# +# 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. + +set(MODULE_NAME "wfreerdp-server") +set(MODULE_PREFIX "FREERDP_SERVER_WINDOWS") + +include(WarnUnmaintained) +warn_unmaintained(${MODULE_NAME}) + +include_directories(.) + +set(${MODULE_PREFIX}_SRCS + wf_update.c + wf_update.h + wf_dxgi.c + wf_dxgi.h + wf_input.c + wf_input.h + wf_interface.c + wf_interface.h + wf_mirage.c + wf_mirage.h + wf_peer.c + wf_peer.h + wf_settings.c + wf_settings.h + wf_info.c + wf_info.h +) + +if(CHANNEL_RDPSND AND NOT WITH_RDPSND_DSOUND) + set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} wf_rdpsnd.c wf_rdpsnd.h wf_wasapi.c wf_wasapi.h) +endif() + +if(CHANNEL_RDPSND AND WITH_RDPSND_DSOUND) + set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} wf_rdpsnd.c wf_rdpsnd.h wf_directsound.c wf_directsound.h) +endif() + +if(WITH_SERVER_INTERFACE) + addtargetwithresourcefile(${MODULE_NAME} FALSE "${FREERDP_VERSION}" ${MODULE_PREFIX}_SRCS) + target_include_directories(${MODULE_NAME} INTERFACE $) +else() + list(APPEND ${MODULE_PREFIX}_SRCS cli/wfreerdp.c cli/wfreerdp.h) + addtargetwithresourcefile(${MODULE_NAME} TRUE "${FREERDP_VERSION}" ${MODULE_PREFIX}_SRCS) +endif() + +if(NOT CMAKE_WINDOWS_VERSION STREQUAL "WINXP") + set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} d3d11 dxgi) +endif() + +set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} dsound) +set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} freerdp-server freerdp) + +target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS}) + +if(WITH_SERVER_INTERFACE) + install(TARGETS ${MODULE_NAME} COMPONENT libraries ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + ) +else() + install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT server) +endif() + +if(WITH_SERVER_INTERFACE) + add_subdirectory(cli) +endif() + +set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Server/Windows") diff --git a/server/Windows/ModuleOptions.cmake b/server/Windows/ModuleOptions.cmake index 69d759661..b693f2e76 100644 --- a/server/Windows/ModuleOptions.cmake +++ b/server/Windows/ModuleOptions.cmake @@ -1,4 +1,3 @@ - set(FREERDP_SERVER_NAME "wfreerdp-server") set(FREERDP_SERVER_PLATFORM "Windows") set(FREERDP_SERVER_VENDOR "FreeRDP") diff --git a/server/Windows/cli/CMakeLists.txt b/server/Windows/cli/CMakeLists.txt index c362f66ab..52998c45e 100644 --- a/server/Windows/cli/CMakeLists.txt +++ b/server/Windows/cli/CMakeLists.txt @@ -21,11 +21,9 @@ set(MODULE_PREFIX "FREERDP_SERVER_WINDOWS_CLI") include_directories(..) -set(${MODULE_PREFIX}_SRCS - wfreerdp.c - wfreerdp.h) +set(${MODULE_PREFIX}_SRCS wfreerdp.c wfreerdp.h) -AddTargetWithResourceFile(${MODULE_NAME} TRUE "${FREERDP_VERSION}" ${MODULE_PREFIX}_SRCS) +addtargetwithresourcefile(${MODULE_NAME} TRUE "${FREERDP_VERSION}" ${MODULE_PREFIX}_SRCS) set(${MODULE_PREFIX}_LIBS wfreerdp-server) diff --git a/server/common/CMakeLists.txt b/server/common/CMakeLists.txt index 6795ba9be..b5690f81f 100644 --- a/server/common/CMakeLists.txt +++ b/server/common/CMakeLists.txt @@ -25,26 +25,25 @@ if(POLICY CMP0022) cmake_policy(SET CMP0022 NEW) endif() -set(${MODULE_PREFIX}_SRCS - server.c) +set(${MODULE_PREFIX}_SRCS server.c) foreach(FREERDP_CHANNELS_SERVER_SRC ${FREERDP_CHANNELS_SERVER_SRCS}) - set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} "${FREERDP_CHANNELS_SERVER_SRC}") + set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} "${FREERDP_CHANNELS_SERVER_SRC}") endforeach() if(MSVC) - set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS}) + set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS}) endif() -AddTargetWithResourceFile(${MODULE_NAME} FALSE "${FREERDP_VERSION}" ${MODULE_PREFIX}_SRCS) +addtargetwithresourcefile(${MODULE_NAME} FALSE "${FREERDP_VERSION}" ${MODULE_PREFIX}_SRCS) target_include_directories(${MODULE_NAME} INTERFACE $) target_link_libraries(${MODULE_NAME} PRIVATE ${FREERDP_CHANNELS_SERVER_LIBS}) target_link_libraries(${MODULE_NAME} PUBLIC winpr freerdp) install(TARGETS ${MODULE_NAME} COMPONENT libraries EXPORT FreeRDP-ServerTargets - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +) set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Server/Common") diff --git a/server/proxy/CMakeLists.txt b/server/proxy/CMakeLists.txt index 7a95da370..9c55db471 100644 --- a/server/proxy/CMakeLists.txt +++ b/server/proxy/CMakeLists.txt @@ -24,81 +24,83 @@ set(MODULE_NAME "freerdp-server-proxy") set(MODULE_PREFIX "FREERDP_SERVER_PROXY") set(${MODULE_PREFIX}_SRCS - pf_context.c - pf_channel.c - pf_channel.h - pf_client.c - pf_client.h - pf_input.c - pf_input.h - pf_update.c - pf_update.h - pf_server.c - pf_server.h - pf_config.c - pf_modules.c - pf_utils.h - pf_utils.c - $ - ) + pf_context.c + pf_channel.c + pf_channel.h + pf_client.c + pf_client.h + pf_input.c + pf_input.h + pf_update.c + pf_update.h + pf_server.c + pf_server.h + pf_config.c + pf_modules.c + pf_utils.h + pf_utils.c + $ +) set(PROXY_APP_SRCS freerdp_proxy.c) option(WITH_PROXY_EMULATE_SMARTCARD "Compile proxy smartcard emulation" OFF) add_subdirectory("channels") -AddTargetWithResourceFile(${MODULE_NAME} FALSE "${FREERDP_VERSION}" ${MODULE_PREFIX}_SRCS) +addtargetwithresourcefile(${MODULE_NAME} FALSE "${FREERDP_VERSION}" ${MODULE_PREFIX}_SRCS) -set(PRIVATE_LIBS - freerdp-client - freerdp-server -) +set(PRIVATE_LIBS freerdp-client freerdp-server) -set(PUBLIC_LIBS - winpr - freerdp -) +set(PUBLIC_LIBS winpr freerdp) target_include_directories(${MODULE_NAME} INTERFACE $) target_link_libraries(${MODULE_NAME} PRIVATE ${PRIVATE_LIBS} PUBLIC ${PUBLIC_LIBS}) -install(TARGETS ${MODULE_NAME} COMPONENT server EXPORT FreeRDP-ProxyTargets - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) +install(TARGETS ${MODULE_NAME} COMPONENT server EXPORT FreeRDP-ProxyTargets ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +) set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Server/Proxy") # pkg-config include(pkg-config-install-prefix) -cleaning_configure_file(${CMAKE_CURRENT_SOURCE_DIR}/freerdp-proxy.pc.in ${CMAKE_CURRENT_BINARY_DIR}/${MODULE_NAME}${FREERDP_VERSION_MAJOR}.pc @ONLY) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${MODULE_NAME}${FREERDP_VERSION_MAJOR}.pc DESTINATION ${PKG_CONFIG_PC_INSTALL_DIR}) +cleaning_configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/freerdp-proxy.pc.in ${CMAKE_CURRENT_BINARY_DIR}/${MODULE_NAME}${FREERDP_VERSION_MAJOR}.pc + @ONLY +) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${MODULE_NAME}${FREERDP_VERSION_MAJOR}.pc + DESTINATION ${PKG_CONFIG_PC_INSTALL_DIR} +) export(PACKAGE freerdp-proxy) -SetFreeRDPCMakeInstallDir(FREERDP_PROXY_CMAKE_INSTALL_DIR "FreeRDP-Proxy${FREERDP_VERSION_MAJOR}") +setfreerdpcmakeinstalldir(FREERDP_PROXY_CMAKE_INSTALL_DIR "FreeRDP-Proxy${FREERDP_VERSION_MAJOR}") -configure_package_config_file(FreeRDP-ProxyConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/FreeRDP-ProxyConfig.cmake - INSTALL_DESTINATION ${FREERDP_PROXY_CMAKE_INSTALL_DIR} - PATH_VARS FREERDP_INCLUDE_DIR) +configure_package_config_file( + FreeRDP-ProxyConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/FreeRDP-ProxyConfig.cmake + INSTALL_DESTINATION ${FREERDP_PROXY_CMAKE_INSTALL_DIR} PATH_VARS FREERDP_INCLUDE_DIR +) -write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/FreeRDP-ProxyConfigVersion.cmake - VERSION ${FREERDP_VERSION} COMPATIBILITY SameMajorVersion) +write_basic_package_version_file( + ${CMAKE_CURRENT_BINARY_DIR}/FreeRDP-ProxyConfigVersion.cmake VERSION ${FREERDP_VERSION} + COMPATIBILITY SameMajorVersion +) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/FreeRDP-ProxyConfig.cmake ${CMAKE_CURRENT_BINARY_DIR}/FreeRDP-ProxyConfigVersion.cmake - DESTINATION ${FREERDP_PROXY_CMAKE_INSTALL_DIR}) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/FreeRDP-ProxyConfig.cmake + ${CMAKE_CURRENT_BINARY_DIR}/FreeRDP-ProxyConfigVersion.cmake + DESTINATION ${FREERDP_PROXY_CMAKE_INSTALL_DIR} +) install(EXPORT FreeRDP-ProxyTargets DESTINATION ${FREERDP_PROXY_CMAKE_INSTALL_DIR}) set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Server/proxy") option(WITH_PROXY_APP "Compile proxy application" ON) -if (WITH_PROXY_APP) +if(WITH_PROXY_APP) add_subdirectory("cli") endif() option(WITH_PROXY_MODULES "Compile proxy modules" ON) -if (WITH_PROXY_MODULES) +if(WITH_PROXY_MODULES) add_subdirectory("modules") endif() - diff --git a/server/proxy/channels/CMakeLists.txt b/server/proxy/channels/CMakeLists.txt index 1915d83d2..927be79f9 100644 --- a/server/proxy/channels/CMakeLists.txt +++ b/server/proxy/channels/CMakeLists.txt @@ -1,17 +1,8 @@ - set(MODULE_NAME pf_channels) -set(SOURCES - pf_channel_rdpdr.c - pf_channel_rdpdr.h - pf_channel_drdynvc.c - pf_channel_drdynvc.h -) +set(SOURCES pf_channel_rdpdr.c pf_channel_rdpdr.h pf_channel_drdynvc.c pf_channel_drdynvc.h) -if (WITH_PROXY_EMULATE_SMARTCARD) - list(APPEND SOURCES - pf_channel_smartcard.c - pf_channel_smartcard.h - ) +if(WITH_PROXY_EMULATE_SMARTCARD) + list(APPEND SOURCES pf_channel_smartcard.c pf_channel_smartcard.h) endif() add_library(${MODULE_NAME} OBJECT ${SOURCES}) diff --git a/server/proxy/cli/CMakeLists.txt b/server/proxy/cli/CMakeLists.txt index a532f90a9..95ce3e905 100644 --- a/server/proxy/cli/CMakeLists.txt +++ b/server/proxy/cli/CMakeLists.txt @@ -19,7 +19,7 @@ set(PROXY_APP_SRCS freerdp_proxy.c) set(APP_NAME "freerdp-proxy") -AddTargetWithResourceFile(${APP_NAME} TRUE "${FREERDP_VERSION}" PROXY_APP_SRCS) +addtargetwithresourcefile(${APP_NAME} TRUE "${FREERDP_VERSION}" PROXY_APP_SRCS) target_link_libraries(${APP_NAME} ${MODULE_NAME}) install(TARGETS ${APP_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT server) diff --git a/server/proxy/modules/CMakeLists.txt b/server/proxy/modules/CMakeLists.txt index 500a3e7ec..2e29776e2 100644 --- a/server/proxy/modules/CMakeLists.txt +++ b/server/proxy/modules/CMakeLists.txt @@ -25,9 +25,9 @@ include_directories("${PROJECT_SOURCE_DIR}/server/proxy/modules") file(GLOB all_valid_subdirs RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*/CMakeLists.txt") foreach(dir ${all_valid_subdirs}) - if(${dir} MATCHES "^([^/]*)/+CMakeLists.txt") - string(REGEX REPLACE "^([^/]*)/+CMakeLists.txt" "\\1" dir_trimmed ${dir}) - message(STATUS "Adding proxy module ${dir_trimmed}") - add_subdirectory(${dir_trimmed}) - endif() + if(${dir} MATCHES "^([^/]*)/+CMakeLists.txt") + string(REGEX REPLACE "^([^/]*)/+CMakeLists.txt" "\\1" dir_trimmed ${dir}) + message(STATUS "Adding proxy module ${dir_trimmed}") + add_subdirectory(${dir_trimmed}) + endif() endforeach(dir) diff --git a/server/proxy/modules/bitmap-filter/CMakeLists.txt b/server/proxy/modules/bitmap-filter/CMakeLists.txt index 60d6ce85e..f27daf87a 100644 --- a/server/proxy/modules/bitmap-filter/CMakeLists.txt +++ b/server/proxy/modules/bitmap-filter/CMakeLists.txt @@ -22,23 +22,17 @@ cmake_minimum_required(VERSION 3.13) if(POLICY CMP0091) - cmake_policy(SET CMP0091 NEW) + cmake_policy(SET CMP0091 NEW) endif() -if (NOT FREERDP_DEFAULT_PROJECT_VERSION) - set(FREERDP_DEFAULT_PROJECT_VERSION "1.0.0.0") +if(NOT FREERDP_DEFAULT_PROJECT_VERSION) + set(FREERDP_DEFAULT_PROJECT_VERSION "1.0.0.0") endif() -project(proxy-bitmap-filter-plugin - VERSION ${FREERDP_DEFAULT_PROJECT_VERSION} - LANGUAGES CXX -) +project(proxy-bitmap-filter-plugin VERSION ${FREERDP_DEFAULT_PROJECT_VERSION} LANGUAGES CXX) message("project ${PROJECT_NAME} is using version ${PROJECT_VERSION}") -project(proxy-bitmap-filter-plugin - VERSION ${FREERDP_DEFAULT_PROJECT_VERSION} - LANGUAGES CXX -) +project(proxy-bitmap-filter-plugin VERSION ${FREERDP_DEFAULT_PROJECT_VERSION} LANGUAGES CXX) message("project ${PROJECT_NAME} is using version ${PROJECT_VERSION}") @@ -49,10 +43,8 @@ include(CXXCompilerFlags) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) -set(SRCS - bitmap-filter.cpp -) -AddTargetWithResourceFile(${PROJECT_NAME} FALSE "${PROJECT_VERSION}" SRCS FALSE) +set(SRCS bitmap-filter.cpp) +addtargetwithresourcefile(${PROJECT_NAME} FALSE "${PROJECT_VERSION}" SRCS FALSE) target_link_libraries(${PROJECT_NAME} winpr freerdp) diff --git a/server/proxy/modules/demo/CMakeLists.txt b/server/proxy/modules/demo/CMakeLists.txt index ab3ec829d..5502afa4f 100644 --- a/server/proxy/modules/demo/CMakeLists.txt +++ b/server/proxy/modules/demo/CMakeLists.txt @@ -22,16 +22,13 @@ cmake_minimum_required(VERSION 3.13) if(POLICY CMP0091) - cmake_policy(SET CMP0091 NEW) + cmake_policy(SET CMP0091 NEW) endif() -if (NOT FREERDP_DEFAULT_PROJECT_VERSION) - set(FREERDP_DEFAULT_PROJECT_VERSION "1.0.0.0") +if(NOT FREERDP_DEFAULT_PROJECT_VERSION) + set(FREERDP_DEFAULT_PROJECT_VERSION "1.0.0.0") endif() -project(proxy-demo-plugin - VERSION ${FREERDP_DEFAULT_PROJECT_VERSION} - LANGUAGES CXX -) +project(proxy-demo-plugin VERSION ${FREERDP_DEFAULT_PROJECT_VERSION} LANGUAGES CXX) message("project ${PROJECT_NAME} is using version ${PROJECT_VERSION}") @@ -42,10 +39,8 @@ include(CXXCompilerFlags) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) -set(SRCS - demo.cpp -) -AddTargetWithResourceFile(${PROJECT_NAME} FALSE "${PROJECT_VERSION}" SRCS FALSE) +set(SRCS demo.cpp) +addtargetwithresourcefile(${PROJECT_NAME} FALSE "${PROJECT_VERSION}" SRCS FALSE) target_link_libraries(${PROJECT_NAME} winpr) diff --git a/server/proxy/modules/dyn-channel-dump/CMakeLists.txt b/server/proxy/modules/dyn-channel-dump/CMakeLists.txt index 4e328bcbf..3eb6f6ed4 100644 --- a/server/proxy/modules/dyn-channel-dump/CMakeLists.txt +++ b/server/proxy/modules/dyn-channel-dump/CMakeLists.txt @@ -21,16 +21,13 @@ cmake_minimum_required(VERSION 3.13) if(POLICY CMP0091) - cmake_policy(SET CMP0091 NEW) + cmake_policy(SET CMP0091 NEW) endif() -if (NOT FREERDP_DEFAULT_PROJECT_VERSION) - set(FREERDP_DEFAULT_PROJECT_VERSION "1.0.0.0") +if(NOT FREERDP_DEFAULT_PROJECT_VERSION) + set(FREERDP_DEFAULT_PROJECT_VERSION "1.0.0.0") endif() -project(proxy-dyn-channel-dump-plugin - VERSION ${FREERDP_DEFAULT_PROJECT_VERSION} - LANGUAGES CXX -) +project(proxy-dyn-channel-dump-plugin VERSION ${FREERDP_DEFAULT_PROJECT_VERSION} LANGUAGES CXX) message("project ${PROJECT_NAME} is using version ${PROJECT_VERSION}") @@ -41,17 +38,9 @@ include(CXXCompilerFlags) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) -set(SRCS - dyn-channel-dump.cpp -) -AddTargetWithResourceFile(${PROJECT_NAME} FALSE "${PROJECT_VERSION}" SRCS FALSE) +set(SRCS dyn-channel-dump.cpp) +addtargetwithresourcefile(${PROJECT_NAME} FALSE "${PROJECT_VERSION}" SRCS FALSE) -target_link_libraries(${PROJECT_NAME} PRIVATE - winpr - freerdp - freerdp-client - freerdp-server - freerdp-server-proxy -) +target_link_libraries(${PROJECT_NAME} PRIVATE winpr freerdp freerdp-client freerdp-server freerdp-server-proxy) install(TARGETS ${PROJECT_NAME} DESTINATION ${FREERDP_PROXY_PLUGINDIR}) diff --git a/server/shadow/CMakeLists.txt b/server/shadow/CMakeLists.txt index bdde4e3a5..ea10b649b 100644 --- a/server/shadow/CMakeLists.txt +++ b/server/shadow/CMakeLists.txt @@ -20,67 +20,69 @@ set(MODULE_NAME "freerdp-shadow") set(SRCS - shadow_client.c - shadow_client.h - shadow_lobby.c - shadow_lobby.h - shadow_input.c - shadow_input.h - shadow_screen.c - shadow_screen.h - shadow_surface.c - shadow_surface.h - shadow_encoder.c - shadow_encoder.h - shadow_capture.c - shadow_capture.h - shadow_channels.c - shadow_channels.h - shadow_encomsp.c - shadow_encomsp.h - shadow_remdesk.c - shadow_remdesk.h - shadow_rdpsnd.c - shadow_rdpsnd.h - shadow_audin.c - shadow_audin.h - shadow_rdpgfx.c - shadow_rdpgfx.h - shadow_subsystem.c - shadow_subsystem.h - shadow_mcevent.c - shadow_mcevent.h - shadow_server.c - shadow.h) + shadow_client.c + shadow_client.h + shadow_lobby.c + shadow_lobby.h + shadow_input.c + shadow_input.h + shadow_screen.c + shadow_screen.h + shadow_surface.c + shadow_surface.h + shadow_encoder.c + shadow_encoder.h + shadow_capture.c + shadow_capture.h + shadow_channels.c + shadow_channels.h + shadow_encomsp.c + shadow_encomsp.h + shadow_remdesk.c + shadow_remdesk.h + shadow_rdpsnd.c + shadow_rdpsnd.h + shadow_audin.c + shadow_audin.h + shadow_rdpgfx.c + shadow_rdpgfx.h + shadow_subsystem.c + shadow_subsystem.h + shadow_mcevent.c + shadow_mcevent.h + shadow_server.c + shadow.h +) -if (NOT FREERDP_UNIFIED_BUILD) - find_package(rdtk 0 REQUIRED) - include_directories(SYSTEM ${RDTK_INCLUDE_DIR}) +if(NOT FREERDP_UNIFIED_BUILD) + find_package(rdtk 0 REQUIRED) + include_directories(SYSTEM ${RDTK_INCLUDE_DIR}) else() - if (NOT WITH_RDTK) - message(FATAL_ERROR "-DWITH_RDTK=ON is required for unified FreeRDP build with shadow server") - endif() - include_directories(${PROJECT_SOURCE_DIR}/rdtk/include) - include_directories(${PROJECT_BINARY_DIR}/rdtk/include) + if(NOT WITH_RDTK) + message(FATAL_ERROR "-DWITH_RDTK=ON is required for unified FreeRDP build with shadow server") + endif() + include_directories(${PROJECT_SOURCE_DIR}/rdtk/include) + include_directories(${PROJECT_BINARY_DIR}/rdtk/include) endif() -AddTargetWithResourceFile(${MODULE_NAME} "FALSE" "${FREERDP_VERSION}" SRCS) +addtargetwithresourcefile(${MODULE_NAME} "FALSE" "${FREERDP_VERSION}" SRCS) -list(APPEND LIBS - freerdp - freerdp-server - winpr - winpr-tools - rdtk +list( + APPEND + LIBS + freerdp + freerdp-server + winpr + winpr-tools + rdtk ) target_include_directories(${MODULE_NAME} INTERFACE $) target_link_libraries(${MODULE_NAME} PRIVATE ${LIBS}) -install(TARGETS ${MODULE_NAME} COMPONENT server EXPORT FreeRDP-ShadowTargets - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) +install(TARGETS ${MODULE_NAME} COMPONENT server EXPORT FreeRDP-ShadowTargets ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +) set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Server/shadow") @@ -88,40 +90,30 @@ set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Server/shadow") set(MODULE_NAME "freerdp-shadow-subsystem") -set(SRCS - shadow_subsystem_builtin.c) +set(SRCS shadow_subsystem_builtin.c) if(WIN32) - add_subdirectory(Win) + add_subdirectory(Win) elseif(NOT APPLE) - add_subdirectory(X11) + add_subdirectory(X11) elseif(APPLE AND NOT IOS) - add_subdirectory(Mac) + add_subdirectory(Mac) endif() -AddTargetWithResourceFile(${MODULE_NAME} FALSE "${FREERDP_VERSION}" SRCS) +addtargetwithresourcefile(${MODULE_NAME} FALSE "${FREERDP_VERSION}" SRCS) -list(APPEND LIBS - freerdp-shadow-subsystem-impl - freerdp-shadow - freerdp - winpr -) +list(APPEND LIBS freerdp-shadow-subsystem-impl freerdp-shadow freerdp winpr) target_include_directories(${MODULE_NAME} INTERFACE $) target_link_libraries(${MODULE_NAME} PRIVATE ${LIBS}) -if (NOT BUILD_SHARED_LIBS) - install(TARGETS freerdp-shadow-subsystem-impl - DESTINATION ${CMAKE_INSTALL_LIBDIR} - EXPORT FreeRDP-ShadowTargets - ) +if(NOT BUILD_SHARED_LIBS) + install(TARGETS freerdp-shadow-subsystem-impl DESTINATION ${CMAKE_INSTALL_LIBDIR} EXPORT FreeRDP-ShadowTargets) endif() -install(TARGETS ${MODULE_NAME} COMPONENT server EXPORT FreeRDP-ShadowTargets - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) +install(TARGETS ${MODULE_NAME} COMPONENT server EXPORT FreeRDP-ShadowTargets ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +) set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Server/shadow") @@ -129,10 +121,9 @@ set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Server/shadow") set(MODULE_NAME "freerdp-shadow-cli") -set(SRCS - shadow.c) +set(SRCS shadow.c) -AddTargetWithResourceFile(${MODULE_NAME} TRUE "${FREERDP_VERSION}" SRCS) +addtargetwithresourcefile(${MODULE_NAME} TRUE "${FREERDP_VERSION}" SRCS) list(APPEND LIBS freerdp-shadow-subsystem freerdp-shadow freerdp winpr) @@ -143,25 +134,34 @@ install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT ser set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Server/shadow") include(pkg-config-install-prefix) -cleaning_configure_file(${CMAKE_CURRENT_SOURCE_DIR}/freerdp-shadow.pc.in ${CMAKE_CURRENT_BINARY_DIR}/freerdp-shadow${FREERDP_VERSION_MAJOR}.pc @ONLY) +cleaning_configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/freerdp-shadow.pc.in + ${CMAKE_CURRENT_BINARY_DIR}/freerdp-shadow${FREERDP_VERSION_MAJOR}.pc @ONLY +) generate_and_install_freerdp_man_from_template(${MODULE_NAME} "1" "${FREERDP_API_VERSION}") -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/freerdp-shadow${FREERDP_VERSION_MAJOR}.pc DESTINATION ${PKG_CONFIG_PC_INSTALL_DIR}) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/freerdp-shadow${FREERDP_VERSION_MAJOR}.pc + DESTINATION ${PKG_CONFIG_PC_INSTALL_DIR} +) export(PACKAGE freerdp-shadow) -SetFreeRDPCMakeInstallDir(FREERDP_SERVER_CMAKE_INSTALL_DIR "FreeRDP-Shadow${FREERDP_VERSION_MAJOR}") +setfreerdpcmakeinstalldir(FREERDP_SERVER_CMAKE_INSTALL_DIR "FreeRDP-Shadow${FREERDP_VERSION_MAJOR}") -configure_package_config_file(FreeRDP-ShadowConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/FreeRDP-ShadowConfig.cmake - INSTALL_DESTINATION ${FREERDP_SERVER_CMAKE_INSTALL_DIR} - PATH_VARS FREERDP_INCLUDE_DIR) +configure_package_config_file( + FreeRDP-ShadowConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/FreeRDP-ShadowConfig.cmake + INSTALL_DESTINATION ${FREERDP_SERVER_CMAKE_INSTALL_DIR} PATH_VARS FREERDP_INCLUDE_DIR +) -write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/FreeRDP-ShadowConfigVersion.cmake - VERSION ${FREERDP_VERSION} COMPATIBILITY SameMajorVersion) +write_basic_package_version_file( + ${CMAKE_CURRENT_BINARY_DIR}/FreeRDP-ShadowConfigVersion.cmake VERSION ${FREERDP_VERSION} + COMPATIBILITY SameMajorVersion +) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/FreeRDP-ShadowConfig.cmake - ${CMAKE_CURRENT_BINARY_DIR}/FreeRDP-ShadowConfigVersion.cmake - DESTINATION ${FREERDP_SERVER_CMAKE_INSTALL_DIR}) + ${CMAKE_CURRENT_BINARY_DIR}/FreeRDP-ShadowConfigVersion.cmake + DESTINATION ${FREERDP_SERVER_CMAKE_INSTALL_DIR} +) install(EXPORT FreeRDP-ShadowTargets DESTINATION ${FREERDP_SERVER_CMAKE_INSTALL_DIR}) diff --git a/server/shadow/Mac/CMakeLists.txt b/server/shadow/Mac/CMakeLists.txt index 6d7519bf2..7137a8822 100644 --- a/server/shadow/Mac/CMakeLists.txt +++ b/server/shadow/Mac/CMakeLists.txt @@ -1,5 +1,4 @@ - -include (WarnUnmaintained) +include(WarnUnmaintained) warn_unmaintained("mac shadow server subsystem") find_library(IOKIT IOKit REQUIRED) @@ -7,25 +6,16 @@ find_library(IOSURFACE IOSurface REQUIRED) find_library(CARBON Carbon REQUIRED) find_package(PAM) -set(LIBS - ${IOKIT} - ${IOSURFACE} - ${CARBON} -) +set(LIBS ${IOKIT} ${IOSURFACE} ${CARBON}) if(PAM_FOUND) - add_definitions(-DWITH_PAM) - include_directories(SYSTEM ${PAM_INCLUDE_DIR}) - list(APPEND LIBS ${PAM_LIBRARY}) + add_definitions(-DWITH_PAM) + include_directories(SYSTEM ${PAM_INCLUDE_DIR}) + list(APPEND LIBS ${PAM_LIBRARY}) else() - message("building without PAM authentication support") + message("building without PAM authentication support") endif() add_definitions(-DWITH_SHADOW_MAC) -add_library(freerdp-shadow-subsystem-impl STATIC - mac_shadow.h - mac_shadow.c -) -target_link_libraries(freerdp-shadow-subsystem-impl PRIVATE - ${LIBS} -) +add_library(freerdp-shadow-subsystem-impl STATIC mac_shadow.h mac_shadow.c) +target_link_libraries(freerdp-shadow-subsystem-impl PRIVATE ${LIBS}) diff --git a/server/shadow/Win/CMakeLists.txt b/server/shadow/Win/CMakeLists.txt index f8a920ec9..ac543faca 100644 --- a/server/shadow/Win/CMakeLists.txt +++ b/server/shadow/Win/CMakeLists.txt @@ -1,20 +1,16 @@ - -include (WarnUnmaintained) +include(WarnUnmaintained) warn_unmaintained("windows shadow server subsystem") add_definitions(-DWITH_SHADOW_WIN) -add_library(freerdp-shadow-subsystem-impl STATIC - win_dxgi.c - win_dxgi.h - win_rdp.c - win_rdp.h - win_shadow.c - win_shadow.h - win_wds.c - win_wds.h -) -target_link_libraries(freerdp-shadow-subsystem-impl PRIVATE - freerdp-client - freerdp - winpr +add_library( + freerdp-shadow-subsystem-impl STATIC + win_dxgi.c + win_dxgi.h + win_rdp.c + win_rdp.h + win_shadow.c + win_shadow.h + win_wds.c + win_wds.h ) +target_link_libraries(freerdp-shadow-subsystem-impl PRIVATE freerdp-client freerdp winpr) diff --git a/server/shadow/X11/CMakeLists.txt b/server/shadow/X11/CMakeLists.txt index 72282c0eb..f0f88e448 100644 --- a/server/shadow/X11/CMakeLists.txt +++ b/server/shadow/X11/CMakeLists.txt @@ -1,43 +1,43 @@ find_package(X11 REQUIRED) if(X11_FOUND) - add_definitions(-DWITH_X11) - include_directories(SYSTEM ${X11_INCLUDE_DIR}) - list(APPEND LIBS ${X11_LIBRARIES}) + add_definitions(-DWITH_X11) + include_directories(SYSTEM ${X11_INCLUDE_DIR}) + list(APPEND LIBS ${X11_LIBRARIES}) endif() if(X11_XShm_FOUND) - add_definitions(-DWITH_XSHM) - include_directories(SYSTEM ${X11_XShm_INCLUDE_PATH}) - list(APPEND LIBS ${X11_XShm_LIB}) + add_definitions(-DWITH_XSHM) + include_directories(SYSTEM ${X11_XShm_INCLUDE_PATH}) + list(APPEND LIBS ${X11_XShm_LIB}) endif() if(X11_Xext_FOUND) - add_definitions(-DWITH_XEXT) - list(APPEND LIBS ${X11_Xext_LIB}) + add_definitions(-DWITH_XEXT) + list(APPEND LIBS ${X11_Xext_LIB}) endif() if(X11_Xinerama_FOUND) - add_definitions(-DWITH_XINERAMA) - include_directories(SYSTEM ${X11_Xinerama_INCLUDE_PATH}) - list(APPEND LIBS ${X11_Xinerama_LIB}) + add_definitions(-DWITH_XINERAMA) + include_directories(SYSTEM ${X11_Xinerama_INCLUDE_PATH}) + list(APPEND LIBS ${X11_Xinerama_LIB}) endif() if(X11_Xdamage_FOUND) - add_definitions(-DWITH_XDAMAGE) - include_directories(SYSTEM ${X11_Xdamage_INCLUDE_PATH}) - list(APPEND LIBS ${X11_Xdamage_LIB}) + add_definitions(-DWITH_XDAMAGE) + include_directories(SYSTEM ${X11_Xdamage_INCLUDE_PATH}) + list(APPEND LIBS ${X11_Xdamage_LIB}) endif() if(X11_Xfixes_FOUND) - add_definitions(-DWITH_XFIXES) - include_directories(SYSTEM ${X11_Xfixes_INCLUDE_PATH}) - list(APPEND LIBS ${X11_Xfixes_LIB}) + add_definitions(-DWITH_XFIXES) + include_directories(SYSTEM ${X11_Xfixes_INCLUDE_PATH}) + list(APPEND LIBS ${X11_Xfixes_LIB}) endif() if(X11_XTest_FOUND) - add_definitions(-DWITH_XTEST) - include_directories(SYSTEM ${X11_XTest_INCLUDE_PATH}) - list(APPEND LIBS ${X11_XTest_LIB}) + add_definitions(-DWITH_XTEST) + include_directories(SYSTEM ${X11_XTest_INCLUDE_PATH}) + list(APPEND LIBS ${X11_XTest_LIB}) endif() # XCursor and XRandr are currently not used so don't link them @@ -55,18 +55,13 @@ endif() find_package(PAM) if(PAM_FOUND) - add_definitions(-DWITH_PAM) - include_directories(SYSTEM ${PAM_INCLUDE_DIR}) - list(APPEND LIBS ${PAM_LIBRARY}) + add_definitions(-DWITH_PAM) + include_directories(SYSTEM ${PAM_INCLUDE_DIR}) + list(APPEND LIBS ${PAM_LIBRARY}) else() - message("building without PAM authentication support") + message("building without PAM authentication support") endif() add_definitions(-DWITH_SHADOW_X11) -add_library(freerdp-shadow-subsystem-impl STATIC - x11_shadow.h - x11_shadow.c -) -target_link_libraries(freerdp-shadow-subsystem-impl PRIVATE - ${LIBS} -) +add_library(freerdp-shadow-subsystem-impl STATIC x11_shadow.h x11_shadow.c) +target_link_libraries(freerdp-shadow-subsystem-impl PRIVATE ${LIBS}) diff --git a/third-party/CMakeLists.txt b/third-party/CMakeLists.txt index 610f35e9d..a7a36e2da 100644 --- a/third-party/CMakeLists.txt +++ b/third-party/CMakeLists.txt @@ -22,11 +22,11 @@ file(GLOB all_valid_subdirs RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*/CMakeLists.txt") foreach(dir ${all_valid_subdirs}) - if(${dir} MATCHES "^([^/]*)/+CMakeLists.txt") - string(REGEX REPLACE "^([^/]*)/+CMakeLists.txt" "\\1" dir_trimmed ${dir}) - message(STATUS "Adding third-party component ${dir_trimmed}") - add_subdirectory(${dir_trimmed}) - endif() + if(${dir} MATCHES "^([^/]*)/+CMakeLists.txt") + string(REGEX REPLACE "^([^/]*)/+CMakeLists.txt" "\\1" dir_trimmed ${dir}) + message(STATUS "Adding third-party component ${dir_trimmed}") + add_subdirectory(${dir_trimmed}) + endif() endforeach(dir) set(THIRD_PARTY_INCLUDES ${THIRD_PARTY_INCLUDES} PARENT_SCOPE) diff --git a/uwac/CMakeLists.txt b/uwac/CMakeLists.txt index 6b250f8cd..291f9856d 100644 --- a/uwac/CMakeLists.txt +++ b/uwac/CMakeLists.txt @@ -23,23 +23,23 @@ set(UWAC_VERSION "${UWAC_VERSION_MAJOR}.${UWAC_VERSION_MINOR}.${UWAC_VERSION_REV set(UWAC_VERSION_FULL "${UWAC_VERSION}") set(UWAC_API_VERSION "${UWAC_VERSION_MAJOR}") -if (NOT FREERDP_UNIFIED_BUILD) - cmake_minimum_required(VERSION 3.13) - project(uwac VERSION ${UWAC_VERSION} LANGUAGES C) +if(NOT FREERDP_UNIFIED_BUILD) + cmake_minimum_required(VERSION 3.13) + project(uwac VERSION ${UWAC_VERSION} LANGUAGES C) - set(CMAKE_C_STANDARD 11) - set(CMAKE_C_STANDARD_REQUIRED ON) - set(CMAKE_C_EXTENSIONS ON) + set(CMAKE_C_STANDARD 11) + set(CMAKE_C_STANDARD_REQUIRED ON) + set(CMAKE_C_EXTENSIONS ON) - option(EXPORT_ALL_SYMBOLS "Export all symbols form library" OFF) - option(BUILD_TESTING_INTERNAL "Build library unit tests" ON) + option(EXPORT_ALL_SYMBOLS "Export all symbols form library" OFF) + option(BUILD_TESTING_INTERNAL "Build library unit tests" ON) - if(CMAKE_COMPILER_IS_GNUCC) - if(NOT EXPORT_ALL_SYMBOLS) - message(STATUS "GCC default symbol visibility: hidden") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden") - endif() - endif() + if(CMAKE_COMPILER_IS_GNUCC) + if(NOT EXPORT_ALL_SYMBOLS) + message(STATUS "GCC default symbol visibility: hidden") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden") + endif() + endif() endif() option(UWAC_FORCE_STATIC_BUILD "Force UWAC to be built as static library (recommended)" OFF) @@ -55,36 +55,36 @@ check_function_exists(strerror_r UWAC_HAVE_STRERROR_R) # Check for cmake compatibility (enable/disable features) include(FindFeature) -if (UWAC_FORCE_STATIC_BUILD) - set(BUILD_SHARED_LIBS OFF) +if(UWAC_FORCE_STATIC_BUILD) + set(BUILD_SHARED_LIBS OFF) else() - include(SetFreeRDPCMakeInstallDir) - include(CMakePackageConfigHelpers) + include(SetFreeRDPCMakeInstallDir) + include(CMakePackageConfigHelpers) endif() -if (NOT IOS) - include(CheckIncludeFiles) - check_include_files(stdbool.h UWAC_HAVE_STDBOOL_H) - if (NOT UWAC_HAVE_STDBOOL_H) - include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/../compat/stdbool) - endif() +if(NOT IOS) + include(CheckIncludeFiles) + check_include_files(stdbool.h UWAC_HAVE_STDBOOL_H) + if(NOT UWAC_HAVE_STDBOOL_H) + include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/../compat/stdbool) + endif() endif() # Find required libraries -if (UWAC_HAVE_PIXMAN_REGION) - find_package(PkgConfig REQUIRED) - pkg_check_modules(pixman REQUIRED pixman-1) - include_directories(SYSTEM ${pixman_INCLUDE_DIRS}) -elseif (FREERDP_UNIFIED_BUILD) - include_directories(${PROJECT_SOURCE_DIR}/winpr/include) - include_directories(${PROJECT_BINARY_DIR}/winpr/include) - include_directories(${PROJECT_SOURCE_DIR}/include) - include_directories(${PROJECT_BINARY_DIR}/include) +if(UWAC_HAVE_PIXMAN_REGION) + find_package(PkgConfig REQUIRED) + pkg_check_modules(pixman REQUIRED pixman-1) + include_directories(SYSTEM ${pixman_INCLUDE_DIRS}) +elseif(FREERDP_UNIFIED_BUILD) + include_directories(${PROJECT_SOURCE_DIR}/winpr/include) + include_directories(${PROJECT_BINARY_DIR}/winpr/include) + include_directories(${PROJECT_SOURCE_DIR}/include) + include_directories(${PROJECT_BINARY_DIR}/include) else() - find_package(WinPR 3 REQUIRED) - find_package(FreeRDP 3 REQUIRED) - include_directories(SYSTEM ${WinPR_INCLUDE_DIR}) - include_directories(SYSTEM ${FreeRDP_INCLUDE_DIR}) + find_package(WinPR 3 REQUIRED) + find_package(FreeRDP 3 REQUIRED) + include_directories(SYSTEM ${WinPR_INCLUDE_DIR}) + include_directories(SYSTEM ${FreeRDP_INCLUDE_DIR}) endif() set(WAYLAND_FEATURE_PURPOSE "Wayland") @@ -100,4 +100,3 @@ include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}/include) add_subdirectory(libuwac) add_subdirectory(templates) add_subdirectory(include) - diff --git a/uwac/include/CMakeLists.txt b/uwac/include/CMakeLists.txt index 69882008c..c4775838e 100644 --- a/uwac/include/CMakeLists.txt +++ b/uwac/include/CMakeLists.txt @@ -15,12 +15,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -if (NOT UWAC_FORCE_STATIC_BUILD) - install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ - DESTINATION ${UWAC_INCLUDE_DIR} - FILES_MATCHING PATTERN "*.h") +if(NOT UWAC_FORCE_STATIC_BUILD) + install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${UWAC_INCLUDE_DIR} FILES_MATCHING PATTERN "*.h") - install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/ - DESTINATION ${UWAC_INCLUDE_DIR} - FILES_MATCHING PATTERN "*.h") + install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/ DESTINATION ${UWAC_INCLUDE_DIR} FILES_MATCHING PATTERN "*.h") endif() diff --git a/uwac/libuwac/CMakeLists.txt b/uwac/libuwac/CMakeLists.txt index d3cef147b..d294d9ece 100644 --- a/uwac/libuwac/CMakeLists.txt +++ b/uwac/libuwac/CMakeLists.txt @@ -19,22 +19,24 @@ set(MODULE_PREFIX "UWAC") set(GENERATED_SOURCES "") macro(generate_protocol_file PROTO) - add_custom_command( - OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/protocols/${PROTO}-protocol.c" - COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/protocols - COMMAND ${WAYLAND_SCANNER} code < ${CMAKE_CURRENT_SOURCE_DIR}/../protocols/${PROTO}.xml > ${CMAKE_CURRENT_BINARY_DIR}/protocols/${PROTO}-protocol.c - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/../protocols/${PROTO}.xml - ) + add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/protocols/${PROTO}-protocol.c" COMMAND ${CMAKE_COMMAND} -E make_directory + ${CMAKE_CURRENT_BINARY_DIR}/protocols + COMMAND ${WAYLAND_SCANNER} code < ${CMAKE_CURRENT_SOURCE_DIR}/../protocols/${PROTO}.xml > + ${CMAKE_CURRENT_BINARY_DIR}/protocols/${PROTO}-protocol.c + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/../protocols/${PROTO}.xml + ) - add_custom_command( - OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/protocols/${PROTO}-client-protocol.h" - COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/protocols - COMMAND ${WAYLAND_SCANNER} client-header < ${CMAKE_CURRENT_SOURCE_DIR}/../protocols/${PROTO}.xml > ${CMAKE_CURRENT_BINARY_DIR}/protocols/${PROTO}-client-protocol.h - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/../protocols/${PROTO}.xml - ) + add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/protocols/${PROTO}-client-protocol.h" + COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/protocols + COMMAND ${WAYLAND_SCANNER} client-header < ${CMAKE_CURRENT_SOURCE_DIR}/../protocols/${PROTO}.xml > + ${CMAKE_CURRENT_BINARY_DIR}/protocols/${PROTO}-client-protocol.h + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/../protocols/${PROTO}.xml + ) - list(APPEND GENERATED_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/protocols/${PROTO}-client-protocol.h) - list(APPEND GENERATED_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/protocols/${PROTO}-protocol.c) + list(APPEND GENERATED_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/protocols/${PROTO}-client-protocol.h) + list(APPEND GENERATED_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/protocols/${PROTO}-protocol.c) endmacro() disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR}) @@ -48,7 +50,7 @@ generate_protocol_file(fullscreen-shell-unstable-v1) generate_protocol_file(keyboard-shortcuts-inhibit-unstable-v1) if(FREEBSD) - include_directories(SYSTEM ${EPOLLSHIM_INCLUDE_DIR}) + include_directories(SYSTEM ${EPOLLSHIM_INCLUDE_DIR}) endif() include_directories(SYSTEM ${WAYLAND_INCLUDE_DIR}) include_directories(SYSTEM ${XKBCOMMON_INCLUDE_DIR}) @@ -69,37 +71,38 @@ set(${MODULE_PREFIX}_SRCS uwac-priv.h uwac-tools.c uwac-utils.c - uwac-window.c) - + uwac-window.c +) add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) set_target_properties(${MODULE_NAME} PROPERTIES LINKER_LANGUAGE C) set_target_properties(${MODULE_NAME} PROPERTIES OUTPUT_NAME ${MODULE_NAME}${UWAC_API_VERSION}) -if (WITH_LIBRARY_VERSIONING) - set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${UWAC_VERSION} SOVERSION ${UWAC_API_VERSION}) +if(WITH_LIBRARY_VERSIONING) + set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${UWAC_VERSION} SOVERSION ${UWAC_API_VERSION}) endif() -target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS} PRIVATE ${WAYLAND_LIBS} ${XKBCOMMON_LIBS} ${EPOLLSHIM_LIBS}) -if (UWAC_HAVE_PIXMAN_REGION) - target_link_libraries(${MODULE_NAME} PRIVATE ${pixman_LINK_LIBRARIES}) +target_link_libraries( + ${MODULE_NAME} ${${MODULE_PREFIX}_LIBS} PRIVATE ${WAYLAND_LIBS} ${XKBCOMMON_LIBS} ${EPOLLSHIM_LIBS} +) +if(UWAC_HAVE_PIXMAN_REGION) + target_link_libraries(${MODULE_NAME} PRIVATE ${pixman_LINK_LIBRARIES}) else() - target_link_libraries(${MODULE_NAME} PRIVATE freerdp) + target_link_libraries(${MODULE_NAME} PRIVATE freerdp) endif() target_link_libraries(${MODULE_NAME} PRIVATE m) -if (NOT UWAC_FORCE_STATIC_BUILD) - target_include_directories(${MODULE_NAME} INTERFACE $) +if(NOT UWAC_FORCE_STATIC_BUILD) + target_include_directories(${MODULE_NAME} INTERFACE $) - install(TARGETS ${MODULE_NAME} COMPONENT libraries EXPORT uwac - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) + install(TARGETS ${MODULE_NAME} COMPONENT libraries EXPORT uwac ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + ) endif() set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "uwac") if(BUILD_TESTING_INTERNAL OR BUILD_TESTING) -# add_subdirectory(test) + # add_subdirectory(test) endif() diff --git a/uwac/templates/CMakeLists.txt b/uwac/templates/CMakeLists.txt index 02e0503c1..3225a7db3 100644 --- a/uwac/templates/CMakeLists.txt +++ b/uwac/templates/CMakeLists.txt @@ -1,40 +1,37 @@ set(UWAC_INCLUDE_DIR "include/uwac${UWAC_VERSION_MAJOR}") -if (NOT UWAC_FORCE_STATIC_BUILD) - # cmake package - export(PACKAGE uwac) +if(NOT UWAC_FORCE_STATIC_BUILD) + # cmake package + export(PACKAGE uwac) - SetFreeRDPCMakeInstallDir(UWAC_CMAKE_INSTALL_DIR "uwac${UWAC_VERSION_MAJOR}") + setfreerdpcmakeinstalldir(UWAC_CMAKE_INSTALL_DIR "uwac${UWAC_VERSION_MAJOR}") - configure_package_config_file( - ${CMAKE_CURRENT_SOURCE_DIR}/uwacConfig.cmake.in - ${CMAKE_CURRENT_BINARY_DIR}/uwacConfig.cmake - INSTALL_DESTINATION ${UWAC_CMAKE_INSTALL_DIR} - PATH_VARS UWAC_INCLUDE_DIR) + configure_package_config_file( + ${CMAKE_CURRENT_SOURCE_DIR}/uwacConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/uwacConfig.cmake + INSTALL_DESTINATION ${UWAC_CMAKE_INSTALL_DIR} PATH_VARS UWAC_INCLUDE_DIR + ) - write_basic_package_version_file( - ${CMAKE_CURRENT_BINARY_DIR}/uwacConfigVersion.cmake - VERSION ${UWAC_VERSION} - COMPATIBILITY SameMajorVersion) + write_basic_package_version_file( + ${CMAKE_CURRENT_BINARY_DIR}/uwacConfigVersion.cmake VERSION ${UWAC_VERSION} COMPATIBILITY SameMajorVersion + ) - install(FILES - ${CMAKE_CURRENT_BINARY_DIR}/uwacConfig.cmake - ${CMAKE_CURRENT_BINARY_DIR}/uwacConfigVersion.cmake - DESTINATION ${UWAC_CMAKE_INSTALL_DIR}) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/uwacConfig.cmake ${CMAKE_CURRENT_BINARY_DIR}/uwacConfigVersion.cmake + DESTINATION ${UWAC_CMAKE_INSTALL_DIR} + ) - install(EXPORT uwac DESTINATION ${UWAC_CMAKE_INSTALL_DIR}) + install(EXPORT uwac DESTINATION ${UWAC_CMAKE_INSTALL_DIR}) endif() set(UWAC_BUILD_CONFIG_LIST "") -GET_CMAKE_PROPERTY(res VARIABLES) -FOREACH(var ${res}) - IF (var MATCHES "^WITH_*|^BUILD_TESTING*|^UWAC_HAVE_*") - LIST(APPEND UWAC_BUILD_CONFIG_LIST "${var}=${${var}}") - ENDIF() -ENDFOREACH() +get_cmake_property(res VARIABLES) +foreach(var ${res}) + if(var MATCHES "^WITH_*|^BUILD_TESTING*|^UWAC_HAVE_*") + list(APPEND UWAC_BUILD_CONFIG_LIST "${var}=${${var}}") + endif() +endforeach() include(CFlagsToVar) -CFlagsToVar(C_FLAGS) +cflagstovar(C_FLAGS) string(REPLACE ";" " " UWAC_BUILD_CONFIG "${UWAC_BUILD_CONFIG_LIST}") cleaning_configure_file(version.h.in ${CMAKE_CURRENT_BINARY_DIR}/../include/uwac/version.h) @@ -42,10 +39,10 @@ cleaning_configure_file(buildflags.h.in ${CMAKE_CURRENT_BINARY_DIR}/../include/u cleaning_configure_file(build-config.h.in ${CMAKE_CURRENT_BINARY_DIR}/../include/uwac/build-config.h) cleaning_configure_file(config.h.in ${CMAKE_CURRENT_BINARY_DIR}/../include/uwac/config.h) -if (NOT UWAC_FORCE_STATIC_BUILD) - include(pkg-config-install-prefix) - cleaning_configure_file(uwac.pc.in ${CMAKE_CURRENT_BINARY_DIR}/uwac${UWAC_VERSION_MAJOR}.pc @ONLY) +if(NOT UWAC_FORCE_STATIC_BUILD) + include(pkg-config-install-prefix) + cleaning_configure_file(uwac.pc.in ${CMAKE_CURRENT_BINARY_DIR}/uwac${UWAC_VERSION_MAJOR}.pc @ONLY) - set(UWAC_INSTALL_INCLUDE_DIR ${UWAC_INCLUDE_DIR}/uwac) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/uwac${UWAC_VERSION_MAJOR}.pc DESTINATION ${PKG_CONFIG_PC_INSTALL_DIR}) + set(UWAC_INSTALL_INCLUDE_DIR ${UWAC_INCLUDE_DIR}/uwac) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/uwac${UWAC_VERSION_MAJOR}.pc DESTINATION ${PKG_CONFIG_PC_INSTALL_DIR}) endif() diff --git a/winpr/CMakeLists.txt b/winpr/CMakeLists.txt index 271d6094c..0bd54cde3 100644 --- a/winpr/CMakeLists.txt +++ b/winpr/CMakeLists.txt @@ -18,66 +18,69 @@ # Include our extra modules set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../cmake/) -if (NOT FREERDP_UNIFIED_BUILD) - cmake_minimum_required(VERSION 3.13) +if(NOT FREERDP_UNIFIED_BUILD) + cmake_minimum_required(VERSION 3.13) - if(POLICY CMP0091) - cmake_policy(SET CMP0091 NEW) - endif() - project(WinPR LANGUAGES C) + if(POLICY CMP0091) + cmake_policy(SET CMP0091 NEW) + endif() + project(WinPR LANGUAGES C) - set(CMAKE_C_STANDARD 11) - set(CMAKE_C_STANDARD_REQUIRED ON) - set(CMAKE_C_EXTENSIONS ON) + set(CMAKE_C_STANDARD 11) + set(CMAKE_C_STANDARD_REQUIRED ON) + set(CMAKE_C_EXTENSIONS ON) - include(CommonConfigOptions) - include(ConfigOptions) + include(CommonConfigOptions) + include(ConfigOptions) - # Enable coverity related pragma definitions - if (COVERITY_BUILD) - add_compile_definitions(COVERITY_BUILD) - endif() - - # Default to build shared libs - option(EXPORT_ALL_SYMBOLS "Export all symbols form library" OFF) - - if (EXPORT_ALL_SYMBOLS) - # set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) - add_definitions(-DEXPORT_ALL_SYMBOLS) - endif() - - if(CMAKE_COMPILER_IS_GNUCC) - if(NOT EXPORT_ALL_SYMBOLS) - message(STATUS "GCC default symbol visibility: hidden") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden") - endif() - endif() - 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") + # Enable coverity related pragma definitions + if(COVERITY_BUILD) + add_compile_definitions(COVERITY_BUILD) + endif() + + # Default to build shared libs + option(EXPORT_ALL_SYMBOLS "Export all symbols form library" OFF) + + if(EXPORT_ALL_SYMBOLS) + # set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) + add_definitions(-DEXPORT_ALL_SYMBOLS) + endif() + + if(CMAKE_COMPILER_IS_GNUCC) + if(NOT EXPORT_ALL_SYMBOLS) + message(STATUS "GCC default symbol visibility: hidden") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden") endif() + endif() + 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() endif() -if (WIN32 AND NOT UWP) - set(NATIVE_SSPI ON) +if(WIN32 AND NOT UWP) + set(NATIVE_SSPI ON) endif() if((NOT ANDROID AND NOT IOS AND NOT UWP) AND NOT WITH_MBEDTLS) - set(TOOLS_DEFAULT ON) + set(TOOLS_DEFAULT ON) else() - set(TOOLS_DEFAULT OFF) + set(TOOLS_DEFAULT OFF) endif() if(WITH_MBEDTLS) - set(WITH_INTERNAL_RC4_DEFAULT ON) - set(WITH_INTERNAL_MD4_DEFAULT ON) - set(WITH_INTERNAL_MD5_DEFAULT OFF) + set(WITH_INTERNAL_RC4_DEFAULT ON) + set(WITH_INTERNAL_MD4_DEFAULT ON) + set(WITH_INTERNAL_MD5_DEFAULT OFF) else() - set(WITH_INTERNAL_RC4_DEFAULT OFF) - set(WITH_INTERNAL_MD4_DEFAULT OFF) - set(WITH_INTERNAL_MD5_DEFAULT OFF) + set(WITH_INTERNAL_RC4_DEFAULT OFF) + set(WITH_INTERNAL_MD4_DEFAULT OFF) + set(WITH_INTERNAL_MD5_DEFAULT OFF) endif() option(WITH_WINPR_TOOLS "Build WinPR helper binaries" ${TOOLS_DEFAULT}) @@ -91,29 +94,31 @@ option(WITH_DEBUG_MUTEX "Print mutex debug messages" ${DEFAULT_DEBUG_OPTION}) option(WITH_INTERNAL_RC4 "Use compiled in rc4 functions instead of OpenSSL/MBedTLS" ${WITH_INTERNAL_RC4_DEFAULT}) option(WITH_INTERNAL_MD4 "Use compiled in md4 hash functions instead of OpenSSL/MBedTLS" ${WITH_INTERNAL_MD4_DEFAULT}) option(WITH_INTERNAL_MD5 "Use compiled in md5 hash functions instead of OpenSSL/MBedTLS" ${WITH_INTERNAL_MD5_DEFAULT}) -option(WITH_UNICODE_BUILTIN "Use built-in Unicode conversion (don't use system-provided libraries)" OFF) +option(WITH_UNICODE_BUILTIN "Use built-in Unicode conversion (don't use system-provided libraries)" OFF) option(WINPR_USE_LEGACY_RESOURCE_DIR "use a resource directory of /WinPR instead of /" ON) -option(WINPR_USE_VENDOR_PRODUCT_CONFIG_DIR "use a configuration /// subdirectory instead of /winpr" OFF) +option(WINPR_USE_VENDOR_PRODUCT_CONFIG_DIR + "use a configuration /// subdirectory instead of /winpr" OFF +) # This option MUST be off to avoid symbol conflicts when loading an external SSPI module library option(SSPI_DLL "Define and export SSPI API symbols for usage as a Windows SSPI DLL replacement" OFF) if(SSPI_DLL) - add_definitions("-DSSPI_DLL") + add_definitions("-DSSPI_DLL") endif() option(WITH_DEBUG_NTLM "Print NTLM debug messages" ${DEFAULT_DEBUG_OPTION}) if(WITH_DEBUG_NTLM) - message(WARNING "WITH_DEBUG_NTLM=ON, the build might leak sensitive information, do not use with release builds!") + message(WARNING "WITH_DEBUG_NTLM=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!") + message(WARNING "WITH_DEBUG_NLA=ON, the build might leak sensitive information, do not use with release builds!") endif() -if (WITH_WINPR_DEPRECATED) - add_definitions(-DWITH_WINPR_DEPRECATED) +if(WITH_WINPR_DEPRECATED) + add_definitions(-DWITH_WINPR_DEPRECATED) endif() # Include cmake modules @@ -132,23 +137,23 @@ include(InstallFreeRDPMan) include(SetFreeRDPCMakeInstallDir) include(CMakePackageConfigHelpers) -if (NOT WIN32) - add_definitions(-DWINPR_CRITICAL_SECTION_DISABLE_SPINCOUNT) +if(NOT WIN32) + add_definitions(-DWINPR_CRITICAL_SECTION_DISABLE_SPINCOUNT) endif() # Soname versioning set(VERSION_REGEX "^(.*)([0-9]+)\\.([0-9]+)\\.([0-9]+)-?(.*)") set(RAW_VERSION_STRING "3.9.1-dev0") if(EXISTS "${PROJECT_SOURCE_DIR}/.source_tag") - file(READ ${PROJECT_SOURCE_DIR}/.source_tag RAW_VERSION_STRING) + file(READ ${PROJECT_SOURCE_DIR}/.source_tag RAW_VERSION_STRING) elseif(USE_VERSION_FROM_GIT_TAG) - git_get_exact_tag(_GIT_TAG --tags --always) - if (NOT ${_GIT_TAG} STREQUAL "n/a") - string(REGEX MATCH ${VERSION_REGEX} FOUND_TAG "${_GIT_TAG}") - if (FOUND_TAG) - set(RAW_VERSION_STRING ${_GIT_TAG}) - endif() - endif() + git_get_exact_tag(_GIT_TAG --tags --always) + if(NOT ${_GIT_TAG} STREQUAL "n/a") + string(REGEX MATCH ${VERSION_REGEX} FOUND_TAG "${_GIT_TAG}") + if(FOUND_TAG) + set(RAW_VERSION_STRING ${_GIT_TAG}) + endif() + endif() endif() string(STRIP ${RAW_VERSION_STRING} RAW_VERSION_STRING) @@ -159,10 +164,10 @@ string(REGEX REPLACE "${VERSION_REGEX}" "\\5" WINPR_VERSION_SUFFIX "${RAW_VERSIO set(WINPR_VERSION "${WINPR_VERSION_MAJOR}.${WINPR_VERSION_MINOR}.${WINPR_VERSION_REVISION}") set(WINPR_API_VERSION "${WINPR_VERSION_MAJOR}") -if (WINPR_VERSION_SUFFIX) - set(WINPR_VERSION_FULL "${WINPR_VERSION}-${WINPR_VERSION_SUFFIX}") +if(WINPR_VERSION_SUFFIX) + set(WINPR_VERSION_FULL "${WINPR_VERSION}-${WINPR_VERSION_SUFFIX}") else() - set(WINPR_VERSION_FULL "${WINPR_VERSION}") + set(WINPR_VERSION_FULL "${WINPR_VERSION}") endif() set(WINPR_RESOURCE_ROOT ${CMAKE_INSTALL_FULL_DATAROOTDIR}) @@ -171,16 +176,16 @@ set(WINPR_RESOURCE_ROOT ${CMAKE_INSTALL_FULL_DATAROOTDIR}) # * [/]/[] # * [/]/WinPR[] # * /winpr -if (WINPR_USE_LEGACY_RESOURCE_DIR) - string(APPEND WINPR_RESOURCE_ROOT "/WinPR") +if(WINPR_USE_LEGACY_RESOURCE_DIR) + string(APPEND WINPR_RESOURCE_ROOT "/WinPR") else() - if (WINPR_USE_VENDOR_PRODUCT_CONFIG_DIR) - string(APPEND WINPR_RESOURCE_ROOT "/${VENDOR}/") - endif() - string(APPEND WINPR_RESOURCE_ROOT "/${PRODUCT}") - if (WITH_RESOURCE_VERSIONING) - string(APPEND WINPR_RESOURCE_ROOT "${WINPR_VERSION_MAJOR}") - endif() + if(WINPR_USE_VENDOR_PRODUCT_CONFIG_DIR) + string(APPEND WINPR_RESOURCE_ROOT "/${VENDOR}/") + endif() + string(APPEND WINPR_RESOURCE_ROOT "/${PRODUCT}") + if(WITH_RESOURCE_VERSIONING) + string(APPEND WINPR_RESOURCE_ROOT "${WINPR_VERSION_MAJOR}") + endif() endif() include(CheckTypeSize) @@ -188,160 +193,166 @@ check_type_size(ssize_t SSIZE_T) set(WINPR_HAVE_SSIZE_T ${HAVE_SSIZE_T}) if(NOT IOS) - CHECK_SYMBOL_EXISTS(strndup string.h WINPR_HAVE_STRNDUP) - check_include_files(unistd.h WINPR_HAVE_UNISTD_H) - check_include_files(execinfo.h WINPR_HAVE_EXECINFO_HEADER) - if (WINPR_HAVE_EXECINFO_HEADER) - check_symbol_exists(backtrace execinfo.h WINPR_HAVE_EXECINFO_BACKTRACE) - check_symbol_exists(backtrace_symbols execinfo.h WINPR_HAVE_EXECINFO_BACKTRACE_SYMBOLS) - check_symbol_exists(backtrace_symbols_fd execinfo.h WINPR_HAVE_EXECINFO_BACKTRACE_SYMBOLS_FD) + check_symbol_exists(strndup string.h WINPR_HAVE_STRNDUP) + check_include_files(unistd.h WINPR_HAVE_UNISTD_H) + check_include_files(execinfo.h WINPR_HAVE_EXECINFO_HEADER) + if(WINPR_HAVE_EXECINFO_HEADER) + check_symbol_exists(backtrace execinfo.h WINPR_HAVE_EXECINFO_BACKTRACE) + check_symbol_exists(backtrace_symbols execinfo.h WINPR_HAVE_EXECINFO_BACKTRACE_SYMBOLS) + check_symbol_exists(backtrace_symbols_fd execinfo.h WINPR_HAVE_EXECINFO_BACKTRACE_SYMBOLS_FD) - # Some implementations (e.g. Android NDK API < 33) provide execinfo.h but do not define - # the backtrace functions. Disable detection for these cases - if (WINPR_HAVE_EXECINFO_BACKTRACE AND WINPR_HAVE_EXECINFO_BACKTRACE_SYMBOLS AND WINPR_HAVE_EXECINFO_BACKTRACE_SYMBOLS_FD) - set(WINPR_HAVE_EXECINFO_H ON) - endif() - endif() - check_include_files(inttypes.h WINPR_HAVE_INTTYPES_H) - check_include_files(stdint.h WINPR_HAVE_STDINT_H) - check_include_files(inttypes.h WINPR_HAVE_INTTYPES_H) + # Some implementations (e.g. Android NDK API < 33) provide execinfo.h but do not define + # the backtrace functions. Disable detection for these cases + if(WINPR_HAVE_EXECINFO_BACKTRACE AND WINPR_HAVE_EXECINFO_BACKTRACE_SYMBOLS + AND WINPR_HAVE_EXECINFO_BACKTRACE_SYMBOLS_FD + ) + set(WINPR_HAVE_EXECINFO_H ON) + endif() + endif() + check_include_files(inttypes.h WINPR_HAVE_INTTYPES_H) + check_include_files(stdint.h WINPR_HAVE_STDINT_H) + check_include_files(inttypes.h WINPR_HAVE_INTTYPES_H) else(NOT IOS) - set(WINPR_HAVE_STDINT_H 1) - set(WINPR_HAVE_STRNDUP 1) - set(WINPR_HAVE_INTTYPES_H 1) + set(WINPR_HAVE_STDINT_H 1) + set(WINPR_HAVE_STRNDUP 1) + set(WINPR_HAVE_INTTYPES_H 1) endif(NOT IOS) -if (NOT IOS) - check_include_files(stdbool.h WINPR_HAVE_STDBOOL_H) - if (NOT WINPR_HAVE_STDBOOL_H) - include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../compat/stdbool) - endif() +if(NOT IOS) + check_include_files(stdbool.h WINPR_HAVE_STDBOOL_H) + if(NOT WINPR_HAVE_STDBOOL_H) + include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../compat/stdbool) + endif() else() - set(WINPR_HAVE_STDBOOL_H 1) + set(WINPR_HAVE_STDBOOL_H 1) endif() set(CMAKE_THREAD_PREFER_PTHREAD TRUE) if(NOT IOS) - find_package(Threads REQUIRED) + find_package(Threads REQUIRED) endif() # Include files if(NOT IOS) - check_include_files(fcntl.h WINPR_HAVE_FCNTL_H) - check_include_files(aio.h WINPR_HAVE_AIO_H) - check_include_files(sys/timerfd.h WINPR_HAVE_SYS_TIMERFD_H) - check_include_files(unistd.h WINPR_HAVE_UNISTD_H) - check_include_files(inttypes.h WINPR_HAVE_INTTYPES_H) - check_include_files(sys/filio.h WINPR_HAVE_SYS_FILIO_H) - check_include_files(sys/sockio.h WINPR_HAVE_SYS_SOCKIO_H) - check_include_files(syslog.h WINPR_HAVE_SYSLOG_H) - check_include_files(sys/select.h WINPR_HAVE_SYS_SELECT_H) - check_include_files(sys/eventfd.h WINPR_HAVE_SYS_EVENTFD_H) - check_include_files(unwind.h WINPR_HAVE_UNWIND_H) - if (WINPR_HAVE_SYS_EVENTFD_H) - check_symbol_exists(eventfd_read sys/eventfd.h WITH_EVENTFD_READ_WRITE) - endif() + check_include_files(fcntl.h WINPR_HAVE_FCNTL_H) + check_include_files(aio.h WINPR_HAVE_AIO_H) + check_include_files(sys/timerfd.h WINPR_HAVE_SYS_TIMERFD_H) + check_include_files(unistd.h WINPR_HAVE_UNISTD_H) + check_include_files(inttypes.h WINPR_HAVE_INTTYPES_H) + check_include_files(sys/filio.h WINPR_HAVE_SYS_FILIO_H) + check_include_files(sys/sockio.h WINPR_HAVE_SYS_SOCKIO_H) + check_include_files(syslog.h WINPR_HAVE_SYSLOG_H) + check_include_files(sys/select.h WINPR_HAVE_SYS_SELECT_H) + check_include_files(sys/eventfd.h WINPR_HAVE_SYS_EVENTFD_H) + check_include_files(unwind.h WINPR_HAVE_UNWIND_H) + if(WINPR_HAVE_SYS_EVENTFD_H) + check_symbol_exists(eventfd_read sys/eventfd.h WITH_EVENTFD_READ_WRITE) + endif() - include(CheckFunctionExists) - check_function_exists(strerror_r WINPR_HAVE_STRERROR_R) - check_function_exists(getlogin_r WINPR_HAVE_GETLOGIN_R) - check_function_exists(getpwuid_r WINPR_HAVE_GETPWUID_R) - check_struct_has_member("struct tm" tm_gmtoff time.h WINPR_HAVE_TM_GMTOFF) + include(CheckFunctionExists) + check_function_exists(strerror_r WINPR_HAVE_STRERROR_R) + check_function_exists(getlogin_r WINPR_HAVE_GETLOGIN_R) + check_function_exists(getpwuid_r WINPR_HAVE_GETPWUID_R) + check_struct_has_member("struct tm" tm_gmtoff time.h WINPR_HAVE_TM_GMTOFF) else() - set(WINPR_HAVE_FCNTL_H 1) - set(WINPR_HAVE_UNISTD_H 1) - set(WINPR_HAVE_INTTYPES_H 1) - set(WINPR_HAVE_SYS_FILIO_H 1) - set(WINPR_HAVE_TM_GMTOFF 1) + set(WINPR_HAVE_FCNTL_H 1) + set(WINPR_HAVE_UNISTD_H 1) + set(WINPR_HAVE_INTTYPES_H 1) + set(WINPR_HAVE_SYS_FILIO_H 1) + set(WINPR_HAVE_TM_GMTOFF 1) endif() if(UNIX OR CYGWIN) - if (FREEBSD) - list(APPEND CMAKE_REQUIRED_INCLUDES ${EPOLLSHIM_INCLUDE_DIR}) - endif() - if (FREEBSD) - list(REMOVE_ITEM CMAKE_REQUIRED_INCLUDES ${EPOLLSHIM_INCLUDE_DIR}) - endif() - option(WITH_POLL "Check for and include poll.h" ON) - if (WITH_POLL) - check_include_files(poll.h WINPR_HAVE_POLL_H) - endif() + if(FREEBSD) + list(APPEND CMAKE_REQUIRED_INCLUDES ${EPOLLSHIM_INCLUDE_DIR}) + endif() + if(FREEBSD) + list(REMOVE_ITEM CMAKE_REQUIRED_INCLUDES ${EPOLLSHIM_INCLUDE_DIR}) + endif() + option(WITH_POLL "Check for and include poll.h" ON) + if(WITH_POLL) + check_include_files(poll.h WINPR_HAVE_POLL_H) + endif() endif() if(NOT WIN32 AND NOT IOS) - if (NOT WINPR_HAVE_PTHREAD_MUTEX_TIMEDLOCK_LIB) - CHECK_LIBRARY_EXISTS(pthreads pthread_mutex_timedlock "" WINPR_HAVE_PTHREAD_MUTEX_TIMEDLOCK_LIBS) - endif (NOT WINPR_HAVE_PTHREAD_MUTEX_TIMEDLOCK_LIB) + if(NOT WINPR_HAVE_PTHREAD_MUTEX_TIMEDLOCK_LIB) + check_library_exists(pthreads pthread_mutex_timedlock "" WINPR_HAVE_PTHREAD_MUTEX_TIMEDLOCK_LIBS) + endif(NOT WINPR_HAVE_PTHREAD_MUTEX_TIMEDLOCK_LIB) - if (NOT WINPR_HAVE_PTHREAD_MUTEX_TIMEDLOCK_SYMBOL) - CHECK_LIBRARY_EXISTS(pthread pthread_mutex_timedlock "" WINPR_HAVE_PTHREAD_MUTEX_TIMEDLOCK_LIB) - endif (NOT WINPR_HAVE_PTHREAD_MUTEX_TIMEDLOCK_SYMBOL) + if(NOT WINPR_HAVE_PTHREAD_MUTEX_TIMEDLOCK_SYMBOL) + check_library_exists(pthread pthread_mutex_timedlock "" WINPR_HAVE_PTHREAD_MUTEX_TIMEDLOCK_LIB) + endif(NOT WINPR_HAVE_PTHREAD_MUTEX_TIMEDLOCK_SYMBOL) - list(APPEND CMAKE_REQUIRED_LIBRARIES pthread) - CHECK_SYMBOL_EXISTS(pthread_mutex_timedlock pthread.h WINPR_HAVE_PTHREAD_MUTEX_TIMEDLOCK_SYMBOL) + list(APPEND CMAKE_REQUIRED_LIBRARIES pthread) + check_symbol_exists(pthread_mutex_timedlock pthread.h WINPR_HAVE_PTHREAD_MUTEX_TIMEDLOCK_SYMBOL) - if (WINPR_HAVE_PTHREAD_MUTEX_TIMEDLOCK_SYMBOL OR WINPR_HAVE_PTHREAD_MUTEX_TIMEDLOCK_LIB OR WINPR_HAVE_PTHREAD_MUTEX_TIMEDLOCK_LIBS) - set(WINPR_HAVE_PTHREAD_MUTEX_TIMEDLOCK ON) - endif (WINPR_HAVE_PTHREAD_MUTEX_TIMEDLOCK_SYMBOL OR WINPR_HAVE_PTHREAD_MUTEX_TIMEDLOCK_LIB OR WINPR_HAVE_PTHREAD_MUTEX_TIMEDLOCK_LIBS) - list(REMOVE_ITEM CMAKE_REQUIRED_LIBRARIES pthread) + if(WINPR_HAVE_PTHREAD_MUTEX_TIMEDLOCK_SYMBOL OR WINPR_HAVE_PTHREAD_MUTEX_TIMEDLOCK_LIB + OR WINPR_HAVE_PTHREAD_MUTEX_TIMEDLOCK_LIBS + ) + set(WINPR_HAVE_PTHREAD_MUTEX_TIMEDLOCK ON) + endif(WINPR_HAVE_PTHREAD_MUTEX_TIMEDLOCK_SYMBOL OR WINPR_HAVE_PTHREAD_MUTEX_TIMEDLOCK_LIB + OR WINPR_HAVE_PTHREAD_MUTEX_TIMEDLOCK_LIBS + ) + list(REMOVE_ITEM CMAKE_REQUIRED_LIBRARIES pthread) endif() - set(OPENSSL_FEATURE_TYPE "RECOMMENDED") - set(OPENSSL_FEATURE_PURPOSE "cryptography") - set(OPENSSL_FEATURE_DESCRIPTION "encryption, certificate validation, hashing functions") +set(OPENSSL_FEATURE_TYPE "RECOMMENDED") +set(OPENSSL_FEATURE_PURPOSE "cryptography") +set(OPENSSL_FEATURE_DESCRIPTION "encryption, certificate validation, hashing functions") - set(MBEDTLS_FEATURE_TYPE "OPTIONAL") - set(MBEDTLS_FEATURE_PURPOSE "cryptography") - set(MBEDTLS_FEATURE_DESCRIPTION "encryption, certificate validation, hashing functions") +set(MBEDTLS_FEATURE_TYPE "OPTIONAL") +set(MBEDTLS_FEATURE_PURPOSE "cryptography") +set(MBEDTLS_FEATURE_DESCRIPTION "encryption, certificate validation, hashing functions") - option(WITH_LIBRESSL "build with LibreSSL" OFF) - if (WITH_LIBRESSL) - find_package(LibreSSL REQUIRED) - set(OPENSSL_INCLUDE_DIR ${LIBRESSL_INCLUDE_DIR}) - set(OPENSSL_LIBRARIES ${LIBRESSL_LIBRARIES}) - set(OPENSSL_CRYPTO_LIBRARIES ${LIBRESSL_LIBRARIES}) - set(WITH_OPENSSL ON) - set(OPENSSL_FOUND ON) - add_definitions("-DWITH_LIBRESSL") - add_definitions("-DWITH_OPENSSL") - else() - find_feature(OpenSSL ${OPENSSL_FEATURE_TYPE} ${OPENSSL_FEATURE_PURPOSE} ${OPENSSL_FEATURE_DESCRIPTION}) - find_feature(MbedTLS ${MBEDTLS_FEATURE_TYPE} ${MBEDTLS_FEATURE_PURPOSE} ${MBEDTLS_FEATURE_DESCRIPTION}) - endif() - - if (NOT OPENSSL_FOUND AND NOT MBEDTLS_FOUND AND NOT LibreSSL_FOUND) - message(FATAL_ERROR "OpenSSL or MBedTLS are required, none enabled/found") - endif() - - if(WITH_OPENSSL AND OPENSSL_FOUND) - add_definitions("-DWITH_OPENSSL") - endif() - - if(WITH_MBEDTLS AND MBEDTLS_FOUND) - add_definitions("-DWITH_MBEDTLS") - endif() - - enable_testing() - - if(MSVC) - set(TESTING_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}") - else() - set(TESTING_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/Testing") -endif() - -if (NOT WIN32 AND NOT IOS AND NOT ANDROID) - set(PKCS11_DEFAULT ON) +option(WITH_LIBRESSL "build with LibreSSL" OFF) +if(WITH_LIBRESSL) + find_package(LibreSSL REQUIRED) + set(OPENSSL_INCLUDE_DIR ${LIBRESSL_INCLUDE_DIR}) + set(OPENSSL_LIBRARIES ${LIBRESSL_LIBRARIES}) + set(OPENSSL_CRYPTO_LIBRARIES ${LIBRESSL_LIBRARIES}) + set(WITH_OPENSSL ON) + set(OPENSSL_FOUND ON) + add_definitions("-DWITH_LIBRESSL") + add_definitions("-DWITH_OPENSSL") else() - set(PKCS11_DEFAULT OFF) + find_feature(OpenSSL ${OPENSSL_FEATURE_TYPE} ${OPENSSL_FEATURE_PURPOSE} ${OPENSSL_FEATURE_DESCRIPTION}) + find_feature(MbedTLS ${MBEDTLS_FEATURE_TYPE} ${MBEDTLS_FEATURE_PURPOSE} ${MBEDTLS_FEATURE_DESCRIPTION}) +endif() + +if(NOT OPENSSL_FOUND AND NOT MBEDTLS_FOUND AND NOT LibreSSL_FOUND) + message(FATAL_ERROR "OpenSSL or MBedTLS are required, none enabled/found") +endif() + +if(WITH_OPENSSL AND OPENSSL_FOUND) + add_definitions("-DWITH_OPENSSL") +endif() + +if(WITH_MBEDTLS AND MBEDTLS_FOUND) + add_definitions("-DWITH_MBEDTLS") +endif() + +enable_testing() + +if(MSVC) + set(TESTING_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}") +else() + set(TESTING_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/Testing") +endif() + +if(NOT WIN32 AND NOT IOS AND NOT ANDROID) + set(PKCS11_DEFAULT ON) +else() + set(PKCS11_DEFAULT OFF) endif() option(WITH_PKCS11 "encryption, certificate validation, hashing functions" ${PKCS11_DEFAULT}) -if (WITH_PKCS11) - add_definitions("-DWITH_PKCS11") +if(WITH_PKCS11) + add_definitions("-DWITH_PKCS11") endif() if(BUILD_SHARED_LIBS) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWINPR_DLL") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWINPR_DLL") endif() add_definitions(-DWINPR_EXPORTS) @@ -351,15 +362,14 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR}/include) set(WINPR_INCLUDE_DIR "include/winpr${WINPR_VERSION_MAJOR}") - add_subdirectory(libwinpr) if(WITH_WINPR_TOOLS) - add_subdirectory(tools) + add_subdirectory(tools) endif() if(BUILD_TESTING_INTERNAL OR BUILD_TESTING) - add_subdirectory(test) + add_subdirectory(test) endif() add_subdirectory(include) @@ -369,20 +379,25 @@ generate_and_install_freerdp_man_from_template("wlog" "7" "${WINPR_API_VERSION}" export(PACKAGE winpr) -SetFreeRDPCMakeInstallDir(WINPR_CMAKE_INSTALL_DIR "WinPR${WINPR_VERSION_MAJOR}") +setfreerdpcmakeinstalldir(WINPR_CMAKE_INSTALL_DIR "WinPR${WINPR_VERSION_MAJOR}") -configure_package_config_file(WinPRConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/WinPRConfig.cmake - INSTALL_DESTINATION ${WINPR_CMAKE_INSTALL_DIR} - PATH_VARS WINPR_INCLUDE_DIR) +configure_package_config_file( + WinPRConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/WinPRConfig.cmake INSTALL_DESTINATION ${WINPR_CMAKE_INSTALL_DIR} + PATH_VARS WINPR_INCLUDE_DIR +) -write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/WinPRConfigVersion.cmake - VERSION ${WINPR_VERSION} COMPATIBILITY SameMajorVersion) +write_basic_package_version_file( + ${CMAKE_CURRENT_BINARY_DIR}/WinPRConfigVersion.cmake VERSION ${WINPR_VERSION} COMPATIBILITY SameMajorVersion +) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/WinPRConfig.cmake ${CMAKE_CURRENT_BINARY_DIR}/WinPRConfigVersion.cmake - DESTINATION ${WINPR_CMAKE_INSTALL_DIR}) + DESTINATION ${WINPR_CMAKE_INSTALL_DIR} +) install(EXPORT WinPRTargets DESTINATION ${WINPR_CMAKE_INSTALL_DIR}) include(pkg-config-install-prefix) -cleaning_configure_file(${CMAKE_CURRENT_SOURCE_DIR}/winpr.pc.in ${CMAKE_CURRENT_BINARY_DIR}/winpr${WINPR_VERSION_MAJOR}.pc @ONLY) +cleaning_configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/winpr.pc.in ${CMAKE_CURRENT_BINARY_DIR}/winpr${WINPR_VERSION_MAJOR}.pc @ONLY +) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/winpr${WINPR_VERSION_MAJOR}.pc DESTINATION ${PKG_CONFIG_PC_INSTALL_DIR}) diff --git a/winpr/include/CMakeLists.txt b/winpr/include/CMakeLists.txt index ec8fad0ac..b6ce1ea81 100644 --- a/winpr/include/CMakeLists.txt +++ b/winpr/include/CMakeLists.txt @@ -16,7 +16,7 @@ # limitations under the License. include(CFlagsToVar) -CFlagsToVar(C_FLAGS) +cflagstovar(C_FLAGS) cleaning_configure_file(config/version.h.in ${CMAKE_CURRENT_BINARY_DIR}/winpr/version.h) cleaning_configure_file(config/wtypes.h.in ${CMAKE_CURRENT_BINARY_DIR}/winpr/wtypes.h) @@ -24,42 +24,25 @@ cleaning_configure_file(config/build-config.h.in ${CMAKE_CURRENT_BINARY_DIR}/win cleaning_configure_file(config/buildflags.h.in ${CMAKE_CURRENT_BINARY_DIR}/winpr/buildflags.h) cleaning_configure_file(config/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/winpr/config.h) -file(GLOB_RECURSE WINPR_PUBLIC_COMMON_HEADERS - LIST_DIRECTORIES false - "winpr/*.h" -) +file(GLOB_RECURSE WINPR_PUBLIC_COMMON_HEADERS LIST_DIRECTORIES false "winpr/*.h") set(WINPR_PUBLIC_TOOLS_HEADERS ${WINPR_PUBLIC_COMMON_HEADERS}) list(FILTER WINPR_PUBLIC_TOOLS_HEADERS INCLUDE REGEX ".*winpr/tools.*") list(FILTER WINPR_PUBLIC_COMMON_HEADERS EXCLUDE REGEX ".*winpr/tools.*") -file(GLOB_RECURSE WINPR_PUBLIC_COMMON_BIN_HEADERS - LIST_DIRECTORIES false - "${CMAKE_CURRENT_BINARY_DIR}/*.h" -) +file(GLOB_RECURSE WINPR_PUBLIC_COMMON_BIN_HEADERS LIST_DIRECTORIES false "${CMAKE_CURRENT_BINARY_DIR}/*.h") list(APPEND WINPR_PUBLIC_COMMON_HEADERS ${WINPR_PUBLIC_COMMON_BIN_HEADERS}) list(SORT WINPR_PUBLIC_COMMON_HEADERS) -set_property(TARGET winpr APPEND PROPERTY SOURCES - ${WINPR_PUBLIC_COMMON_HEADERS} -) +set_property(TARGET winpr APPEND PROPERTY SOURCES ${WINPR_PUBLIC_COMMON_HEADERS}) -if (WITH_WINPR_TOOLS) - set_property(TARGET winpr-tools APPEND PROPERTY SOURCES - ${WINPR_PUBLIC_TOOLS_HEADERS} - ) +if(WITH_WINPR_TOOLS) + set_property(TARGET winpr-tools APPEND PROPERTY SOURCES ${WINPR_PUBLIC_TOOLS_HEADERS}) endif() add_library(winpr-headers INTERFACE) -target_sources(winpr-headers INTERFACE - ${WINPR_PUBLIC_COMMON_HEADERS} -) +target_sources(winpr-headers INTERFACE ${WINPR_PUBLIC_COMMON_HEADERS}) -install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ - DESTINATION ${WINPR_INCLUDE_DIR} - FILES_MATCHING PATTERN "*.h") - -install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/ - DESTINATION ${WINPR_INCLUDE_DIR} - FILES_MATCHING PATTERN "*.h") +install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${WINPR_INCLUDE_DIR} FILES_MATCHING PATTERN "*.h") +install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/ DESTINATION ${WINPR_INCLUDE_DIR} FILES_MATCHING PATTERN "*.h") diff --git a/winpr/libwinpr/CMakeLists.txt b/winpr/libwinpr/CMakeLists.txt index e9cdb7790..05975f858 100644 --- a/winpr/libwinpr/CMakeLists.txt +++ b/winpr/libwinpr/CMakeLists.txt @@ -28,134 +28,167 @@ set(WINPR_COMPILE_OPTIONS "") set(WINPR_LINK_OPTIONS "") set(WINPR_LINK_DIRS "") -macro (winpr_module_add) - file (RELATIVE_PATH _relPath "${WINPR_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}") - foreach (_src ${ARGN}) - if (_relPath) - list (APPEND WINPR_SRCS "${_relPath}/${_src}") - else() - list (APPEND WINPR_SRCS "${_src}") - endif() - endforeach() - if (_relPath) - set (WINPR_SRCS ${WINPR_SRCS} PARENT_SCOPE) +macro(winpr_module_add) + file(RELATIVE_PATH _relPath "${WINPR_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}") + foreach(_src ${ARGN}) + if(_relPath) + list(APPEND WINPR_SRCS "${_relPath}/${_src}") + else() + list(APPEND WINPR_SRCS "${_src}") endif() + endforeach() + if(_relPath) + set(WINPR_SRCS ${WINPR_SRCS} PARENT_SCOPE) + endif() endmacro() -macro (winpr_include_directory_add) - file (RELATIVE_PATH _relPath "${WINPR_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}") - foreach (_inc ${ARGN}) - if (IS_ABSOLUTE ${_inc}) - list (APPEND WINPR_INCLUDES "${_inc}") - else() - if (_relPath) - list (APPEND WINPR_INCLUDES "${_relPath}/${_inc}") - else() - list (APPEND WINPR_INCLUDES "${_inc}") - endif() - endif() - endforeach() - if (_relPath) - set (WINPR_INCLUDES ${WINPR_INCLUDES} PARENT_SCOPE) +macro(winpr_include_directory_add) + file(RELATIVE_PATH _relPath "${WINPR_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}") + foreach(_inc ${ARGN}) + if(IS_ABSOLUTE ${_inc}) + list(APPEND WINPR_INCLUDES "${_inc}") + else() + if(_relPath) + list(APPEND WINPR_INCLUDES "${_relPath}/${_inc}") + else() + list(APPEND WINPR_INCLUDES "${_inc}") + endif() endif() + endforeach() + if(_relPath) + set(WINPR_INCLUDES ${WINPR_INCLUDES} PARENT_SCOPE) + endif() endmacro() -macro (winpr_library_add_private) - foreach (_lib ${ARGN}) - list (APPEND WINPR_LIBS_PRIVATE "${_lib}") - endforeach() - set (WINPR_LIBS_PRIVATE ${WINPR_LIBS_PRIVATE} PARENT_SCOPE) +macro(winpr_library_add_private) + foreach(_lib ${ARGN}) + list(APPEND WINPR_LIBS_PRIVATE "${_lib}") + endforeach() + set(WINPR_LIBS_PRIVATE ${WINPR_LIBS_PRIVATE} PARENT_SCOPE) endmacro() -macro (winpr_library_add_public) - foreach (_lib ${ARGN}) - list (APPEND WINPR_LIBS_PUBLIC "${_lib}") - endforeach() - set (WINPR_LIBS_PUBLIC ${WINPR_LIBS_PUBLIC} PARENT_SCOPE) +macro(winpr_library_add_public) + foreach(_lib ${ARGN}) + list(APPEND WINPR_LIBS_PUBLIC "${_lib}") + endforeach() + set(WINPR_LIBS_PUBLIC ${WINPR_LIBS_PUBLIC} PARENT_SCOPE) endmacro() -macro (winpr_definition_add) - foreach (_define ${ARGN}) - list (APPEND WINPR_DEFINITIONS "${_define}") - endforeach() - set (WINPR_DEFINITIONS ${WINPR_DEFINITIONS} PARENT_SCOPE) +macro(winpr_definition_add) + foreach(_define ${ARGN}) + list(APPEND WINPR_DEFINITIONS "${_define}") + endforeach() + set(WINPR_DEFINITIONS ${WINPR_DEFINITIONS} PARENT_SCOPE) endmacro() -macro (winpr_library_add_compile_options) - foreach (_define ${ARGN}) - list (APPEND WINPR_COMPILE_OPTIONS "${_define}") - endforeach() - set (WINPR_COMPILE_OPTIONS ${WINPR_COMPILE_OPTIONS} PARENT_SCOPE) +macro(winpr_library_add_compile_options) + foreach(_define ${ARGN}) + list(APPEND WINPR_COMPILE_OPTIONS "${_define}") + endforeach() + set(WINPR_COMPILE_OPTIONS ${WINPR_COMPILE_OPTIONS} PARENT_SCOPE) endmacro() -macro (winpr_library_add_link_options) - foreach (_define ${ARGN}) - list (APPEND WINPR_LINK_OPTIONS "${_define}") - endforeach() - set (WINPR_LINK_OPTIONS ${WINPR_LINK_OPTIONS} PARENT_SCOPE) +macro(winpr_library_add_link_options) + foreach(_define ${ARGN}) + list(APPEND WINPR_LINK_OPTIONS "${_define}") + endforeach() + set(WINPR_LINK_OPTIONS ${WINPR_LINK_OPTIONS} PARENT_SCOPE) endmacro() -macro (winpr_library_add_link_directory) - foreach (_define ${ARGN}) - list (APPEND WINPR_LINK_DIRS "${_define}") - endforeach() - set (WINPR_LINK_DIRS ${WINPR_LINK_DIRS} PARENT_SCOPE) +macro(winpr_library_add_link_directory) + foreach(_define ${ARGN}) + list(APPEND WINPR_LINK_DIRS "${_define}") + endforeach() + set(WINPR_LINK_DIRS ${WINPR_LINK_DIRS} PARENT_SCOPE) endmacro() set(CMAKE_REQUIRED_LIBRARIES rt) find_package(uriparser) option(WITH_URIPARSER "use uriparser library to handle URIs" ${uriparser_FOUND}) -if (WITH_URIPARSER) - find_package(uriparser CONFIG COMPONENTS char) - if (uriparser_FOUND) - winpr_library_add_private(uriparser::uriparser) - else() - find_package(PkgConfig REQUIRED) - pkg_check_modules(uriparser REQUIRED liburiparser) - winpr_include_directory_add(${uriparser_INCLUDEDIR}) - winpr_include_directory_add(${uriparser_INCLUDE_DIRS}) - winpr_library_add_private(${uriparser_LIBRARIES}) - endif() - add_definitions("-DWITH_URIPARSER") +if(WITH_URIPARSER) + find_package(uriparser CONFIG COMPONENTS char) + if(uriparser_FOUND) + winpr_library_add_private(uriparser::uriparser) + else() + find_package(PkgConfig REQUIRED) + pkg_check_modules(uriparser REQUIRED liburiparser) + winpr_include_directory_add(${uriparser_INCLUDEDIR}) + winpr_include_directory_add(${uriparser_INCLUDE_DIRS}) + winpr_library_add_private(${uriparser_LIBRARIES}) + endif() + add_definitions("-DWITH_URIPARSER") endif() if(NOT IOS) - check_function_exists(timer_create TIMER_CREATE) - check_function_exists(timer_delete TIMER_DELETE) - check_function_exists(timer_settime TIMER_SETTIME) - check_function_exists(timer_gettime TIMER_GETTIME) - if (TIMER_CREATE AND TIMER_DELETE AND TIMER_SETTIME AND TIMER_GETTIME) - add_definitions(-DWITH_POSIX_TIMER) - winpr_library_add_private(rt) - endif() + check_function_exists(timer_create TIMER_CREATE) + check_function_exists(timer_delete TIMER_DELETE) + check_function_exists(timer_settime TIMER_SETTIME) + check_function_exists(timer_gettime TIMER_GETTIME) + if(TIMER_CREATE AND TIMER_DELETE AND TIMER_SETTIME AND TIMER_GETTIME) + add_definitions(-DWITH_POSIX_TIMER) + winpr_library_add_private(rt) + endif() endif() check_function_exists(pthread_setschedprio PTHREAD_SETSCHEDPRIO) -if (PTHREAD_SETSCHEDPRIO) - winpr_definition_add(-DPTHREAD_SETSCHEDPRIO) +if(PTHREAD_SETSCHEDPRIO) + winpr_definition_add(-DPTHREAD_SETSCHEDPRIO) endif() -if (ANDROID) - winpr_library_add_private(log) +if(ANDROID) + winpr_library_add_private(log) endif() # Level "1" API as defined for MinCore.lib -set(WINPR_CORE synch library file comm pipe interlocked security - environment crypto registry path io memory ncrypt input shell - utils error timezone sysinfo pool handle thread) +set(WINPR_CORE + synch + library + file + comm + pipe + interlocked + security + environment + crypto + registry + path + io + memory + ncrypt + input + shell + utils + error + timezone + sysinfo + pool + handle + thread +) foreach(DIR ${WINPR_CORE}) - add_subdirectory(${DIR}) - source_group("${DIR}" REGULAR_EXPRESSION "${DIR}/.*\\.[ch]") + add_subdirectory(${DIR}) + source_group("${DIR}" REGULAR_EXPRESSION "${DIR}/.*\\.[ch]") endforeach() -set(WINPR_LEVEL2 winsock sspi sspicli crt bcrypt rpc - wtsapi dsparse smartcard nt clipboard) +set(WINPR_LEVEL2 + winsock + sspi + sspicli + crt + bcrypt + rpc + wtsapi + dsparse + smartcard + nt + clipboard +) foreach(DIR ${WINPR_LEVEL2}) - add_subdirectory(${DIR}) - source_group("${DIR}" REGULAR_EXPRESSION "${DIR}/.*\\.[ch]") + add_subdirectory(${DIR}) + source_group("${DIR}" REGULAR_EXPRESSION "${DIR}/.*\\.[ch]") endforeach() set(MODULE_NAME winpr) @@ -165,23 +198,23 @@ list(REMOVE_DUPLICATES WINPR_LINK_OPTIONS) list(REMOVE_DUPLICATES WINPR_LINK_DIRS) list(REMOVE_DUPLICATES WINPR_INCLUDES) -AddTargetWithResourceFile(${MODULE_NAME} FALSE "${WINPR_VERSION}" WINPR_SRCS) +addtargetwithresourcefile(${MODULE_NAME} FALSE "${WINPR_VERSION}" WINPR_SRCS) -if (WITH_RESOURCE_VERSIONING) - target_compile_definitions(${MODULE_NAME} PRIVATE -DWITH_RESOURCE_VERSIONING) +if(WITH_RESOURCE_VERSIONING) + target_compile_definitions(${MODULE_NAME} PRIVATE -DWITH_RESOURCE_VERSIONING) endif() -if (WINPR_USE_VENDOR_PRODUCT_CONFIG_DIR) - target_compile_definitions(${MODULE_NAME} PRIVATE -DWINPR_USE_VENDOR_PRODUCT_CONFIG_DIR) +if(WINPR_USE_VENDOR_PRODUCT_CONFIG_DIR) + target_compile_definitions(${MODULE_NAME} PRIVATE -DWINPR_USE_VENDOR_PRODUCT_CONFIG_DIR) endif() -if (APPLE) - set_target_properties(${MODULE_NAME} PROPERTIES INTERPROCEDURAL_OPTIMIZATION FALSE) +if(APPLE) + set_target_properties(${MODULE_NAME} PROPERTIES INTERPROCEDURAL_OPTIMIZATION FALSE) endif() -if (NOT BUILD_SHARED_LIBS) - set(LINK_OPTS_MODE PUBLIC) +if(NOT BUILD_SHARED_LIBS) + set(LINK_OPTS_MODE PUBLIC) else() - set(LINK_OPTS_MODE PRIVATE) + set(LINK_OPTS_MODE PRIVATE) endif() target_link_options(${MODULE_NAME} ${LINK_OPTS_MODE} ${WINPR_LINK_OPTIONS}) target_include_directories(${MODULE_NAME} PRIVATE ${WINPR_INCLUDES}) @@ -191,9 +224,8 @@ target_compile_options(${MODULE_NAME} PRIVATE ${WINPR_COMPILE_OPTIONS}) target_compile_definitions(${MODULE_NAME} PRIVATE ${WINPR_DEFINITIONS}) target_link_libraries(${MODULE_NAME} PRIVATE ${WINPR_LIBS_PRIVATE} PUBLIC ${WINPR_LIBS_PUBLIC}) -install(TARGETS ${MODULE_NAME} COMPONENT libraries EXPORT WinPRTargets - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) +install(TARGETS ${MODULE_NAME} COMPONENT libraries EXPORT WinPRTargets ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +) set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR/libwinpr") diff --git a/winpr/libwinpr/bcrypt/CMakeLists.txt b/winpr/libwinpr/bcrypt/CMakeLists.txt index 48046b8f8..0c4ffdb8a 100644 --- a/winpr/libwinpr/bcrypt/CMakeLists.txt +++ b/winpr/libwinpr/bcrypt/CMakeLists.txt @@ -16,4 +16,3 @@ # limitations under the License. winpr_module_add(bcrypt.c) - diff --git a/winpr/libwinpr/bcrypt/ModuleOptions.cmake b/winpr/libwinpr/bcrypt/ModuleOptions.cmake index c1dc8f3b0..3edec7e9f 100644 --- a/winpr/libwinpr/bcrypt/ModuleOptions.cmake +++ b/winpr/libwinpr/bcrypt/ModuleOptions.cmake @@ -1,4 +1,3 @@ - set(MINWIN_LAYER "0") set(MINWIN_GROUP "none") set(MINWIN_MAJOR_VERSION "0") @@ -6,4 +5,3 @@ set(MINWIN_MINOR_VERSION "0") set(MINWIN_SHORT_NAME "bcrypt") set(MINWIN_LONG_NAME "Cryptography API: Next Generation (CNG)") set(MODULE_LIBRARY_NAME "${MINWIN_SHORT_NAME}") - diff --git a/winpr/libwinpr/clipboard/CMakeLists.txt b/winpr/libwinpr/clipboard/CMakeLists.txt index 8d1fb3428..acf01b42b 100644 --- a/winpr/libwinpr/clipboard/CMakeLists.txt +++ b/winpr/libwinpr/clipboard/CMakeLists.txt @@ -15,14 +15,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -winpr_module_add( - synthetic.c - clipboard.c - clipboard.h - synthetic_file.h - synthetic_file.c - ) +winpr_module_add(synthetic.c clipboard.c clipboard.h synthetic_file.h synthetic_file.c) if(BUILD_TESTING_INTERNAL OR BUILD_TESTING) - add_subdirectory(test) + add_subdirectory(test) endif() diff --git a/winpr/libwinpr/clipboard/ModuleOptions.cmake b/winpr/libwinpr/clipboard/ModuleOptions.cmake index f8ebeaa1e..b0ed4025b 100644 --- a/winpr/libwinpr/clipboard/ModuleOptions.cmake +++ b/winpr/libwinpr/clipboard/ModuleOptions.cmake @@ -1,4 +1,3 @@ - set(MINWIN_LAYER "0") set(MINWIN_GROUP "none") set(MINWIN_MAJOR_VERSION "0") @@ -6,4 +5,3 @@ set(MINWIN_MINOR_VERSION "0") set(MINWIN_SHORT_NAME "clipboard") set(MINWIN_LONG_NAME "Clipboard Functions") set(MODULE_LIBRARY_NAME "clipboard") - diff --git a/winpr/libwinpr/clipboard/test/CMakeLists.txt b/winpr/libwinpr/clipboard/test/CMakeLists.txt index f605868d9..9370ecda1 100644 --- a/winpr/libwinpr/clipboard/test/CMakeLists.txt +++ b/winpr/libwinpr/clipboard/test/CMakeLists.txt @@ -1,4 +1,3 @@ - set(MODULE_NAME "TestClipboard") set(MODULE_PREFIX "TEST_CLIPBOARD") @@ -6,13 +5,10 @@ disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR}) set(DRIVER ${MODULE_NAME}.c) -set(TESTS - TestClipboardFormats.c) +set(TESTS TestClipboardFormats.c) -if (BUILD_TESTING_INTERNAL) - list(APPEND TESTS - TestUri.c - ) +if(BUILD_TESTING_INTERNAL) + list(APPEND TESTS TestUri.c) endif() set(TEST_CLIP_PNG "${CMAKE_SOURCE_DIR}/resources/FreeRDP_Icon.png") @@ -21,28 +17,24 @@ file(TO_NATIVE_PATH "${TEST_CLIP_PNG}" TEST_CLIP_PNG) set(TEST_CLIP_BMP "${CMAKE_SOURCE_DIR}/resources/FreeRDP_Install.bmp") file(TO_NATIVE_PATH "${TEST_CLIP_BMP}" TEST_CLIP_BMP) -if (WIN32) - string(REPLACE "\\" "\\\\" TEST_CLIP_PNG "${TEST_CLIP_PNG}") - string(REPLACE "\\" "\\\\" TEST_CLIP_BMP "${TEST_CLIP_BMP}") +if(WIN32) + string(REPLACE "\\" "\\\\" TEST_CLIP_PNG "${TEST_CLIP_PNG}") + string(REPLACE "\\" "\\\\" TEST_CLIP_BMP "${TEST_CLIP_BMP}") endif() add_definitions(-DTEST_CLIP_BMP="${TEST_CLIP_BMP}") add_definitions(-DTEST_CLIP_PNG="${TEST_CLIP_PNG}") -create_test_sourcelist(SRCS - ${DRIVER} - ${TESTS}) +create_test_sourcelist(SRCS ${DRIVER} ${TESTS}) add_executable(${MODULE_NAME} ${SRCS}) target_link_libraries(${MODULE_NAME} winpr) -set_target_properties(${MODULE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY - "${TESTING_OUTPUT_DIRECTORY}") +set_target_properties(${MODULE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TESTING_OUTPUT_DIRECTORY}") foreach(test ${TESTS}) - get_filename_component(TestName ${test} NAME_WE) - add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) + get_filename_component(TestName ${test} NAME_WE) + add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) endforeach() set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR/Test") - diff --git a/winpr/libwinpr/comm/CMakeLists.txt b/winpr/libwinpr/comm/CMakeLists.txt index 47112d167..edd524112 100644 --- a/winpr/libwinpr/comm/CMakeLists.txt +++ b/winpr/libwinpr/comm/CMakeLists.txt @@ -18,36 +18,32 @@ set(MODULE_NAME "winpr-comm") set(MODULE_PREFIX "WINPR_COMM") -if (NOT WIN32) - set(${MODULE_PREFIX}_SRCS - comm.c - comm.h - ) - if(NOT EMSCRIPTEN) - winpr_definition_add(-DWINPR_HAVE_SERIAL_SUPPORT) - list(APPEND ${MODULE_PREFIX}_SRCS - comm_io.c - comm_ioctl.c - comm_ioctl.h - comm_serial_sys.c - comm_serial_sys.h - comm_sercx_sys.c - comm_sercx_sys.h - comm_sercx2_sys.c - comm_sercx2_sys.h - ) - else() - list(APPEND ${MODULE_PREFIX}_SRCS - comm_ioctl_dummy.c - comm_ioctl.h - ) - endif() +if(NOT WIN32) + set(${MODULE_PREFIX}_SRCS comm.c comm.h) + if(NOT EMSCRIPTEN) + winpr_definition_add(-DWINPR_HAVE_SERIAL_SUPPORT) + list( + APPEND + ${MODULE_PREFIX}_SRCS + comm_io.c + comm_ioctl.c + comm_ioctl.h + comm_serial_sys.c + comm_serial_sys.h + comm_sercx_sys.c + comm_sercx_sys.h + comm_sercx2_sys.c + comm_sercx2_sys.h + ) + else() + list(APPEND ${MODULE_PREFIX}_SRCS comm_ioctl_dummy.c comm_ioctl.h) + endif() - winpr_module_add(${${MODULE_PREFIX}_SRCS}) + winpr_module_add(${${MODULE_PREFIX}_SRCS}) - if(NOT EMSCRIPTEN) - if(BUILD_TESTING_INTERNAL AND BUILD_COMM_TESTS) - add_subdirectory(test) - endif() - endif() + if(NOT EMSCRIPTEN) + if(BUILD_TESTING_INTERNAL AND BUILD_COMM_TESTS) + add_subdirectory(test) + endif() + endif() endif() diff --git a/winpr/libwinpr/comm/ModuleOptions.cmake b/winpr/libwinpr/comm/ModuleOptions.cmake index 40955892a..e7f57a7df 100644 --- a/winpr/libwinpr/comm/ModuleOptions.cmake +++ b/winpr/libwinpr/comm/ModuleOptions.cmake @@ -1,9 +1,9 @@ - set(MINWIN_LAYER "1") set(MINWIN_GROUP "core") set(MINWIN_MAJOR_VERSION "1") set(MINWIN_MINOR_VERSION "0") set(MINWIN_SHORT_NAME "comm") set(MINWIN_LONG_NAME "Serial Communication API") -set(MODULE_LIBRARY_NAME "api-ms-win-${MINWIN_GROUP}-${MINWIN_SHORT_NAME}-l${MINWIN_LAYER}-${MINWIN_MAJOR_VERSION}-${MINWIN_MINOR_VERSION}") - +set(MODULE_LIBRARY_NAME + "api-ms-win-${MINWIN_GROUP}-${MINWIN_SHORT_NAME}-l${MINWIN_LAYER}-${MINWIN_MAJOR_VERSION}-${MINWIN_MINOR_VERSION}" +) diff --git a/winpr/libwinpr/comm/test/CMakeLists.txt b/winpr/libwinpr/comm/test/CMakeLists.txt index be1f97898..816f6e64b 100644 --- a/winpr/libwinpr/comm/test/CMakeLists.txt +++ b/winpr/libwinpr/comm/test/CMakeLists.txt @@ -1,4 +1,3 @@ - set(MODULE_NAME "TestComm") set(MODULE_PREFIX "TEST_COMM") @@ -7,19 +6,18 @@ disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR}) set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c) set(${MODULE_PREFIX}_TESTS - TestCommDevice.c - TestCommConfig.c - TestGetCommState.c - TestSetCommState.c - TestSerialChars.c - TestControlSettings.c - TestHandflow.c - TestTimeouts.c - TestCommMonitor.c) + TestCommDevice.c + TestCommConfig.c + TestGetCommState.c + TestSetCommState.c + TestSerialChars.c + TestControlSettings.c + TestHandflow.c + TestTimeouts.c + TestCommMonitor.c +) -create_test_sourcelist(${MODULE_PREFIX}_SRCS - ${${MODULE_PREFIX}_DRIVER} - ${${MODULE_PREFIX}_TESTS}) +create_test_sourcelist(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_DRIVER} ${${MODULE_PREFIX}_TESTS}) add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) @@ -28,10 +26,9 @@ target_link_libraries(${MODULE_NAME} winpr) set_target_properties(${MODULE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TESTING_OUTPUT_DIRECTORY}") foreach(test ${${MODULE_PREFIX}_TESTS}) - get_filename_component(TestName ${test} NAME_WE) - add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) - set_tests_properties(${TestName} PROPERTIES LABELS "comm" ) + get_filename_component(TestName ${test} NAME_WE) + add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) + set_tests_properties(${TestName} PROPERTIES LABELS "comm") endforeach() set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR/Test") - diff --git a/winpr/libwinpr/crt/CMakeLists.txt b/winpr/libwinpr/crt/CMakeLists.txt index c14d4f18e..18f6ad139 100644 --- a/winpr/libwinpr/crt/CMakeLists.txt +++ b/winpr/libwinpr/crt/CMakeLists.txt @@ -15,32 +15,27 @@ # See the License for the specific language governing permissions and # limitations under the License. -set (CRT_FILES alignment.c - conversion.c - buffer.c - memory.c - unicode.c - string.c) +set(CRT_FILES alignment.c conversion.c buffer.c memory.c unicode.c string.c) if(WITH_UNICODE_BUILTIN) - list(APPEND CRT_FILES unicode_builtin.c) + list(APPEND CRT_FILES unicode_builtin.c) else() - IF (ANDROID) - list(APPEND CRT_FILES unicode_android.c) - elseif (NOT APPLE AND NOT WIN32) - find_package(ICU REQUIRED i18n uc io data) - list(APPEND CRT_FILES unicode_icu.c) - winpr_include_directory_add(${ICU_INCLUDE_DIRS}) - winpr_library_add_private(${ICU_LIBRARIES}) - elseif(APPLE) - list(APPEND CRT_FILES unicode_apple.m) - find_library(FOUNDATION_FRAMEWORK Foundation REQUIRED) - winpr_library_add_private(${FOUNDATION_FRAMEWORK}) - endif() + if(ANDROID) + list(APPEND CRT_FILES unicode_android.c) + elseif(NOT APPLE AND NOT WIN32) + find_package(ICU REQUIRED i18n uc io data) + list(APPEND CRT_FILES unicode_icu.c) + winpr_include_directory_add(${ICU_INCLUDE_DIRS}) + winpr_library_add_private(${ICU_LIBRARIES}) + elseif(APPLE) + list(APPEND CRT_FILES unicode_apple.m) + find_library(FOUNDATION_FRAMEWORK Foundation REQUIRED) + winpr_library_add_private(${FOUNDATION_FRAMEWORK}) + endif() endif() winpr_module_add(${CRT_FILES}) if(BUILD_TESTING_INTERNAL OR BUILD_TESTING) - add_subdirectory(test) + add_subdirectory(test) endif() diff --git a/winpr/libwinpr/crt/ModuleOptions.cmake b/winpr/libwinpr/crt/ModuleOptions.cmake index 4530a74e5..827ff7386 100644 --- a/winpr/libwinpr/crt/ModuleOptions.cmake +++ b/winpr/libwinpr/crt/ModuleOptions.cmake @@ -1,4 +1,3 @@ - set(MINWIN_LAYER "0") set(MINWIN_GROUP "none") set(MINWIN_MAJOR_VERSION "0") @@ -6,4 +5,3 @@ set(MINWIN_MINOR_VERSION "0") set(MINWIN_SHORT_NAME "crt") set(MINWIN_LONG_NAME "Microsoft C Run-Time") set(MODULE_LIBRARY_NAME "${MINWIN_SHORT_NAME}") - diff --git a/winpr/libwinpr/crt/test/CMakeLists.txt b/winpr/libwinpr/crt/test/CMakeLists.txt index c4e733399..835719338 100644 --- a/winpr/libwinpr/crt/test/CMakeLists.txt +++ b/winpr/libwinpr/crt/test/CMakeLists.txt @@ -1,4 +1,3 @@ - set(MODULE_NAME "TestCrt") set(MODULE_PREFIX "TEST_CRT") @@ -6,16 +5,9 @@ disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR}) set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c) -set(${MODULE_PREFIX}_TESTS - TestTypes.c - TestFormatSpecifiers.c - TestAlignment.c - TestString.c - TestUnicodeConversion.c) +set(${MODULE_PREFIX}_TESTS TestTypes.c TestFormatSpecifiers.c TestAlignment.c TestString.c TestUnicodeConversion.c) -create_test_sourcelist(${MODULE_PREFIX}_SRCS - ${${MODULE_PREFIX}_DRIVER} - ${${MODULE_PREFIX}_TESTS}) +create_test_sourcelist(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_DRIVER} ${${MODULE_PREFIX}_TESTS}) add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) @@ -24,9 +16,8 @@ target_link_libraries(${MODULE_NAME} winpr) set_target_properties(${MODULE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TESTING_OUTPUT_DIRECTORY}") foreach(test ${${MODULE_PREFIX}_TESTS}) - get_filename_component(TestName ${test} NAME_WE) - add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) + get_filename_component(TestName ${test} NAME_WE) + add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) endforeach() set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR/Test") - diff --git a/winpr/libwinpr/crypto/CMakeLists.txt b/winpr/libwinpr/crypto/CMakeLists.txt index 2da5d7374..63d50f495 100644 --- a/winpr/libwinpr/crypto/CMakeLists.txt +++ b/winpr/libwinpr/crypto/CMakeLists.txt @@ -15,45 +15,36 @@ # See the License for the specific language governing permissions and # limitations under the License. -set(SRCS - hash.c - rand.c - cipher.c - cert.c - crypto.c - crypto.h -) -if (WITH_INTERNAL_RC4) - list(APPEND SRCS rc4.c rc4.h) +set(SRCS hash.c rand.c cipher.c cert.c crypto.c crypto.h) +if(WITH_INTERNAL_RC4) + list(APPEND SRCS rc4.c rc4.h) endif() -if (WITH_INTERNAL_MD4) - list(APPEND SRCS md4.c md4.h) +if(WITH_INTERNAL_MD4) + list(APPEND SRCS md4.c md4.h) endif() -if (WITH_INTERNAL_MD5) - list(APPEND SRCS md5.c md5.h) - list(APPEND SRCS hmac_md5.c hmac_md5.h) +if(WITH_INTERNAL_MD5) + list(APPEND SRCS md5.c md5.h) + list(APPEND SRCS hmac_md5.c hmac_md5.h) endif() -winpr_module_add( - ${SRCS} -) +winpr_module_add(${SRCS}) if(OPENSSL_FOUND) - winpr_include_directory_add(${OPENSSL_INCLUDE_DIR}) - winpr_library_add_private(${OPENSSL_LIBRARIES}) + winpr_include_directory_add(${OPENSSL_INCLUDE_DIR}) + winpr_library_add_private(${OPENSSL_LIBRARIES}) endif() if(MBEDTLS_FOUND) - winpr_include_directory_add(${MBEDTLS_INCLUDE_DIR}) - winpr_library_add_private(${MBEDTLS_LIBRARIES}) + winpr_include_directory_add(${MBEDTLS_INCLUDE_DIR}) + winpr_library_add_private(${MBEDTLS_LIBRARIES}) endif() if(WIN32) - winpr_library_add_public(crypt32) + winpr_library_add_public(crypt32) endif() if(BUILD_TESTING_INTERNAL OR BUILD_TESTING) - add_subdirectory(test) + add_subdirectory(test) endif() diff --git a/winpr/libwinpr/crypto/ModuleOptions.cmake b/winpr/libwinpr/crypto/ModuleOptions.cmake index 39cbfe1e1..3c7d9cdf1 100644 --- a/winpr/libwinpr/crypto/ModuleOptions.cmake +++ b/winpr/libwinpr/crypto/ModuleOptions.cmake @@ -1,4 +1,3 @@ - set(MINWIN_LAYER "1") set(MINWIN_GROUP "core") set(MINWIN_MAJOR_VERSION "1") @@ -6,4 +5,3 @@ set(MINWIN_MINOR_VERSION "0") set(MINWIN_SHORT_NAME "crypto") set(MINWIN_LONG_NAME "Cryptography API (CryptoAPI)") set(MODULE_LIBRARY_NAME "crypt32") - diff --git a/winpr/libwinpr/crypto/test/CMakeLists.txt b/winpr/libwinpr/crypto/test/CMakeLists.txt index d64dce03f..d8257950b 100644 --- a/winpr/libwinpr/crypto/test/CMakeLists.txt +++ b/winpr/libwinpr/crypto/test/CMakeLists.txt @@ -1,4 +1,3 @@ - set(MODULE_NAME "TestCrypto") set(MODULE_PREFIX "TEST_CRYPTO") @@ -6,22 +5,16 @@ disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR}) set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c) -set(${MODULE_PREFIX}_TESTS - TestCryptoHash.c - TestCryptoRand.c - TestCryptoCipher.c - TestCryptoProtectData.c - TestCryptoProtectMemory.c - TestCryptoCertEnumCertificatesInStore.c) +set(${MODULE_PREFIX}_TESTS TestCryptoHash.c TestCryptoRand.c TestCryptoCipher.c TestCryptoProtectData.c + TestCryptoProtectMemory.c TestCryptoCertEnumCertificatesInStore.c +) -create_test_sourcelist(${MODULE_PREFIX}_SRCS - ${${MODULE_PREFIX}_DRIVER} - ${${MODULE_PREFIX}_TESTS}) +create_test_sourcelist(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_DRIVER} ${${MODULE_PREFIX}_TESTS}) add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) if(WIN32) - set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} secur32 crypt32 cryptui) + set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} secur32 crypt32 cryptui) endif() target_link_libraries(${MODULE_NAME} winpr) @@ -29,8 +22,8 @@ target_link_libraries(${MODULE_NAME} winpr) set_target_properties(${MODULE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TESTING_OUTPUT_DIRECTORY}") foreach(test ${${MODULE_PREFIX}_TESTS}) - get_filename_component(TestName ${test} NAME_WE) - add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) + get_filename_component(TestName ${test} NAME_WE) + add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) endforeach() set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR/Test") diff --git a/winpr/libwinpr/dsparse/CMakeLists.txt b/winpr/libwinpr/dsparse/CMakeLists.txt index 23eff4593..b65e4a541 100644 --- a/winpr/libwinpr/dsparse/CMakeLists.txt +++ b/winpr/libwinpr/dsparse/CMakeLists.txt @@ -18,9 +18,9 @@ winpr_module_add(dsparse.c) if(WIN32) - winpr_library_add_public(ntdsapi) + winpr_library_add_public(ntdsapi) endif() if(BUILD_TESTING_INTERNAL OR BUILD_TESTING) - add_subdirectory(test) + add_subdirectory(test) endif() diff --git a/winpr/libwinpr/dsparse/ModuleOptions.cmake b/winpr/libwinpr/dsparse/ModuleOptions.cmake index 647de1ba2..d5e46e9ec 100644 --- a/winpr/libwinpr/dsparse/ModuleOptions.cmake +++ b/winpr/libwinpr/dsparse/ModuleOptions.cmake @@ -1,4 +1,3 @@ - set(MINWIN_LAYER "0") set(MINWIN_GROUP "none") set(MINWIN_MAJOR_VERSION "0") @@ -6,4 +5,3 @@ set(MINWIN_MINOR_VERSION "0") set(MINWIN_SHORT_NAME "dsparse") set(MINWIN_LONG_NAME "Domain Controller and Replication Management Functions") set(MODULE_LIBRARY_NAME "${MINWIN_SHORT_NAME}") - diff --git a/winpr/libwinpr/dsparse/test/CMakeLists.txt b/winpr/libwinpr/dsparse/test/CMakeLists.txt index d3fd14dac..05cb6b0c9 100644 --- a/winpr/libwinpr/dsparse/test/CMakeLists.txt +++ b/winpr/libwinpr/dsparse/test/CMakeLists.txt @@ -1,4 +1,3 @@ - set(MODULE_NAME "TestDsParse") set(MODULE_PREFIX "TEST_DSPARSE") @@ -6,12 +5,9 @@ disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR}) set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c) -set(${MODULE_PREFIX}_TESTS - TestDsMakeSpn.c) +set(${MODULE_PREFIX}_TESTS TestDsMakeSpn.c) -create_test_sourcelist(${MODULE_PREFIX}_SRCS - ${${MODULE_PREFIX}_DRIVER} - ${${MODULE_PREFIX}_TESTS}) +create_test_sourcelist(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_DRIVER} ${${MODULE_PREFIX}_TESTS}) add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) @@ -20,8 +16,8 @@ target_link_libraries(${MODULE_NAME} winpr) set_target_properties(${MODULE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TESTING_OUTPUT_DIRECTORY}") foreach(test ${${MODULE_PREFIX}_TESTS}) - get_filename_component(TestName ${test} NAME_WE) - add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) + get_filename_component(TestName ${test} NAME_WE) + add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) endforeach() set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR/Test") diff --git a/winpr/libwinpr/environment/CMakeLists.txt b/winpr/libwinpr/environment/CMakeLists.txt index 6d2cf7aa1..91c8d726d 100644 --- a/winpr/libwinpr/environment/CMakeLists.txt +++ b/winpr/libwinpr/environment/CMakeLists.txt @@ -18,5 +18,5 @@ winpr_module_add(environment.c) if(BUILD_TESTING_INTERNAL OR BUILD_TESTING) - add_subdirectory(test) + add_subdirectory(test) endif() diff --git a/winpr/libwinpr/environment/ModuleOptions.cmake b/winpr/libwinpr/environment/ModuleOptions.cmake index d7b39ae40..76a4281ca 100644 --- a/winpr/libwinpr/environment/ModuleOptions.cmake +++ b/winpr/libwinpr/environment/ModuleOptions.cmake @@ -1,9 +1,9 @@ - set(MINWIN_LAYER "1") set(MINWIN_GROUP "core") set(MINWIN_MAJOR_VERSION "2") set(MINWIN_MINOR_VERSION "0") set(MINWIN_SHORT_NAME "processenvironment") set(MINWIN_LONG_NAME "Process Environment Functions") -set(MODULE_LIBRARY_NAME "api-ms-win-${MINWIN_GROUP}-${MINWIN_SHORT_NAME}-l${MINWIN_LAYER}-${MINWIN_MAJOR_VERSION}-${MINWIN_MINOR_VERSION}") - +set(MODULE_LIBRARY_NAME + "api-ms-win-${MINWIN_GROUP}-${MINWIN_SHORT_NAME}-l${MINWIN_LAYER}-${MINWIN_MAJOR_VERSION}-${MINWIN_MINOR_VERSION}" +) diff --git a/winpr/libwinpr/environment/test/CMakeLists.txt b/winpr/libwinpr/environment/test/CMakeLists.txt index 18db7f079..b207e61cc 100644 --- a/winpr/libwinpr/environment/test/CMakeLists.txt +++ b/winpr/libwinpr/environment/test/CMakeLists.txt @@ -1,4 +1,3 @@ - set(MODULE_NAME "TestEnvironment") set(MODULE_PREFIX "TEST_ENVIRONMENT") @@ -6,15 +5,11 @@ disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR}) set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c) -set(${MODULE_PREFIX}_TESTS - TestEnvironmentGetEnvironmentStrings.c - TestEnvironmentSetEnvironmentVariable.c - TestEnvironmentMergeEnvironmentStrings.c - TestEnvironmentGetSetEB.c) +set(${MODULE_PREFIX}_TESTS TestEnvironmentGetEnvironmentStrings.c TestEnvironmentSetEnvironmentVariable.c + TestEnvironmentMergeEnvironmentStrings.c TestEnvironmentGetSetEB.c +) -create_test_sourcelist(${MODULE_PREFIX}_SRCS - ${${MODULE_PREFIX}_DRIVER} - ${${MODULE_PREFIX}_TESTS}) +create_test_sourcelist(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_DRIVER} ${${MODULE_PREFIX}_TESTS}) add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) @@ -23,8 +18,8 @@ target_link_libraries(${MODULE_NAME} winpr) set_target_properties(${MODULE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TESTING_OUTPUT_DIRECTORY}") foreach(test ${${MODULE_PREFIX}_TESTS}) - get_filename_component(TestName ${test} NAME_WE) - add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) + get_filename_component(TestName ${test} NAME_WE) + add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) endforeach() set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR/Test") diff --git a/winpr/libwinpr/error/CMakeLists.txt b/winpr/libwinpr/error/CMakeLists.txt index 1ebf35625..e9d9bffcb 100644 --- a/winpr/libwinpr/error/CMakeLists.txt +++ b/winpr/libwinpr/error/CMakeLists.txt @@ -18,5 +18,5 @@ winpr_module_add(error.c) if(BUILD_TESTING_INTERNAL OR BUILD_TESTING) - add_subdirectory(test) + add_subdirectory(test) endif() diff --git a/winpr/libwinpr/error/ModuleOptions.cmake b/winpr/libwinpr/error/ModuleOptions.cmake index b455bd742..ff50ca63a 100644 --- a/winpr/libwinpr/error/ModuleOptions.cmake +++ b/winpr/libwinpr/error/ModuleOptions.cmake @@ -1,9 +1,9 @@ - set(MINWIN_LAYER "1") set(MINWIN_GROUP "core") set(MINWIN_MAJOR_VERSION "1") set(MINWIN_MINOR_VERSION "1") set(MINWIN_SHORT_NAME "errorhandling") set(MINWIN_LONG_NAME "Error Handling Functions") -set(MODULE_LIBRARY_NAME "api-ms-win-${MINWIN_GROUP}-${MINWIN_SHORT_NAME}-l${MINWIN_LAYER}-${MINWIN_MAJOR_VERSION}-${MINWIN_MINOR_VERSION}") - +set(MODULE_LIBRARY_NAME + "api-ms-win-${MINWIN_GROUP}-${MINWIN_SHORT_NAME}-l${MINWIN_LAYER}-${MINWIN_MAJOR_VERSION}-${MINWIN_MINOR_VERSION}" +) diff --git a/winpr/libwinpr/error/test/CMakeLists.txt b/winpr/libwinpr/error/test/CMakeLists.txt index 960ef411d..578d06e1f 100644 --- a/winpr/libwinpr/error/test/CMakeLists.txt +++ b/winpr/libwinpr/error/test/CMakeLists.txt @@ -1,4 +1,3 @@ - set(MODULE_NAME "TestError") set(MODULE_PREFIX "TEST_ERROR") @@ -6,12 +5,9 @@ disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR}) set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c) -set(${MODULE_PREFIX}_TESTS - TestErrorSetLastError.c) +set(${MODULE_PREFIX}_TESTS TestErrorSetLastError.c) -create_test_sourcelist(${MODULE_PREFIX}_SRCS - ${${MODULE_PREFIX}_DRIVER} - ${${MODULE_PREFIX}_TESTS}) +create_test_sourcelist(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_DRIVER} ${${MODULE_PREFIX}_TESTS}) add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) @@ -20,9 +16,8 @@ target_link_libraries(${MODULE_NAME} winpr) set_target_properties(${MODULE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TESTING_OUTPUT_DIRECTORY}") foreach(test ${${MODULE_PREFIX}_TESTS}) - get_filename_component(TestName ${test} NAME_WE) - add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) + get_filename_component(TestName ${test} NAME_WE) + add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) endforeach() set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR/Test") - diff --git a/winpr/libwinpr/file/CMakeLists.txt b/winpr/libwinpr/file/CMakeLists.txt index 0ff3928f8..c3f8606e1 100644 --- a/winpr/libwinpr/file/CMakeLists.txt +++ b/winpr/libwinpr/file/CMakeLists.txt @@ -15,14 +15,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -winpr_module_add( - generic.c - namedPipeClient.c - namedPipeClient.h - pattern.c - file.c -) +winpr_module_add(generic.c namedPipeClient.c namedPipeClient.h pattern.c file.c) if(BUILD_TESTING_INTERNAL OR BUILD_TESTING) - add_subdirectory(test) + add_subdirectory(test) endif() diff --git a/winpr/libwinpr/file/ModuleOptions.cmake b/winpr/libwinpr/file/ModuleOptions.cmake index e2f0d36d2..1830cd7cc 100644 --- a/winpr/libwinpr/file/ModuleOptions.cmake +++ b/winpr/libwinpr/file/ModuleOptions.cmake @@ -1,9 +1,9 @@ - set(MINWIN_LAYER "1") set(MINWIN_GROUP "core") set(MINWIN_MAJOR_VERSION "2") set(MINWIN_MINOR_VERSION "0") set(MINWIN_SHORT_NAME "file") set(MINWIN_LONG_NAME "File Functions") -set(MODULE_LIBRARY_NAME "api-ms-win-${MINWIN_GROUP}-${MINWIN_SHORT_NAME}-l${MINWIN_LAYER}-${MINWIN_MAJOR_VERSION}-${MINWIN_MINOR_VERSION}") - +set(MODULE_LIBRARY_NAME + "api-ms-win-${MINWIN_GROUP}-${MINWIN_SHORT_NAME}-l${MINWIN_LAYER}-${MINWIN_MAJOR_VERSION}-${MINWIN_MINOR_VERSION}" +) diff --git a/winpr/libwinpr/file/test/CMakeLists.txt b/winpr/libwinpr/file/test/CMakeLists.txt index ad7d47e2f..7d72f70fd 100644 --- a/winpr/libwinpr/file/test/CMakeLists.txt +++ b/winpr/libwinpr/file/test/CMakeLists.txt @@ -1,60 +1,57 @@ +if(NOT WIN32) + set(MODULE_NAME "TestFile") + set(MODULE_PREFIX "TEST_FILE") -if (NOT WIN32) - set(MODULE_NAME "TestFile") - set(MODULE_PREFIX "TEST_FILE") + disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR}) -disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR}) + set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c) - set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c) + set(${MODULE_PREFIX}_TESTS + TestFileCreateFile.c + TestFileDeleteFile.c + TestFileReadFile.c + TestSetFileAttributes.c + TestFileWriteFile.c + TestFilePatternMatch.c + TestFileFindFirstFile.c + TestFileFindFirstFileEx.c + TestFileFindNextFile.c + TestFileGetStdHandle.c + ) - set(${MODULE_PREFIX}_TESTS - TestFileCreateFile.c - TestFileDeleteFile.c - TestFileReadFile.c - TestSetFileAttributes.c - TestFileWriteFile.c - TestFilePatternMatch.c - TestFileFindFirstFile.c - TestFileFindFirstFileEx.c - TestFileFindNextFile.c - TestFileGetStdHandle.c - ) + create_test_sourcelist(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_DRIVER} ${${MODULE_PREFIX}_TESTS}) - create_test_sourcelist(${MODULE_PREFIX}_SRCS - ${${MODULE_PREFIX}_DRIVER} - ${${MODULE_PREFIX}_TESTS}) + add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) - add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) + target_link_libraries(${MODULE_NAME} winpr) - target_link_libraries(${MODULE_NAME} winpr) + set_target_properties(${MODULE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TESTING_OUTPUT_DIRECTORY}") - set_target_properties(${MODULE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TESTING_OUTPUT_DIRECTORY}") + if(NOT MSVC) + set(TEST_AREA "${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME}Area") + else() + set(TEST_AREA "${TESTING_OUTPUT_DIRECTORY}/${CMAKE_BUILD_TYPE}/${MODULE_NAME}Area") + endif() - if(NOT MSVC) - set(TEST_AREA "${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME}Area") - else() - set(TEST_AREA "${TESTING_OUTPUT_DIRECTORY}/${CMAKE_BUILD_TYPE}/${MODULE_NAME}Area") - endif() + file(MAKE_DIRECTORY "${TEST_AREA}") + file(WRITE "${TEST_AREA}/TestFile1" "TestFile1") + file(WRITE "${TEST_AREA}/TestFile2" "TestFile2") + file(WRITE "${TEST_AREA}/TestFile3" "TestFile3") + file(MAKE_DIRECTORY "${TEST_AREA}/TestDirectory1") + file(WRITE "${TEST_AREA}/TestDirectory1/TestDirectory1File1" "TestDirectory1File1") + file(MAKE_DIRECTORY "${TEST_AREA}/TestDirectory2") + file(WRITE "${TEST_AREA}/TestDirectory2/TestDirectory2File1" "TestDirectory2File1") + file(WRITE "${TEST_AREA}/TestDirectory2/TestDirectory2File2" "TestDirectory2File2") + file(MAKE_DIRECTORY "${TEST_AREA}/TestDirectory3") + file(WRITE "${TEST_AREA}/TestDirectory3/TestDirectory3File1" "TestDirectory3File1") + file(WRITE "${TEST_AREA}/TestDirectory3/TestDirectory3File2" "TestDirectory3File2") + file(WRITE "${TEST_AREA}/TestDirectory3/TestDirectory3File3" "TestDirectory3File3") - file(MAKE_DIRECTORY "${TEST_AREA}") - file(WRITE "${TEST_AREA}/TestFile1" "TestFile1") - file(WRITE "${TEST_AREA}/TestFile2" "TestFile2") - file(WRITE "${TEST_AREA}/TestFile3" "TestFile3") - file(MAKE_DIRECTORY "${TEST_AREA}/TestDirectory1") - file(WRITE "${TEST_AREA}/TestDirectory1/TestDirectory1File1" "TestDirectory1File1") - file(MAKE_DIRECTORY "${TEST_AREA}/TestDirectory2") - file(WRITE "${TEST_AREA}/TestDirectory2/TestDirectory2File1" "TestDirectory2File1") - file(WRITE "${TEST_AREA}/TestDirectory2/TestDirectory2File2" "TestDirectory2File2") - file(MAKE_DIRECTORY "${TEST_AREA}/TestDirectory3") - file(WRITE "${TEST_AREA}/TestDirectory3/TestDirectory3File1" "TestDirectory3File1") - file(WRITE "${TEST_AREA}/TestDirectory3/TestDirectory3File2" "TestDirectory3File2") - file(WRITE "${TEST_AREA}/TestDirectory3/TestDirectory3File3" "TestDirectory3File3") + foreach(test ${${MODULE_PREFIX}_TESTS}) + get_filename_component(TestName ${test} NAME_WE) + add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName} ${TEST_AREA}) + endforeach() - foreach(test ${${MODULE_PREFIX}_TESTS}) - get_filename_component(TestName ${test} NAME_WE) - add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName} ${TEST_AREA}) - endforeach() - - set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR/Test") + set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR/Test") endif() diff --git a/winpr/libwinpr/handle/CMakeLists.txt b/winpr/libwinpr/handle/CMakeLists.txt index 48c7aea3f..e70981551 100644 --- a/winpr/libwinpr/handle/CMakeLists.txt +++ b/winpr/libwinpr/handle/CMakeLists.txt @@ -17,4 +17,3 @@ # limitations under the License. winpr_module_add(handle.c handle.h nonehandle.c nonehandle.h) - diff --git a/winpr/libwinpr/handle/ModuleOptions.cmake b/winpr/libwinpr/handle/ModuleOptions.cmake index 545a8e9cc..4a571ba66 100644 --- a/winpr/libwinpr/handle/ModuleOptions.cmake +++ b/winpr/libwinpr/handle/ModuleOptions.cmake @@ -1,9 +1,9 @@ - set(MINWIN_LAYER "1") set(MINWIN_GROUP "core") set(MINWIN_MAJOR_VERSION "1") set(MINWIN_MINOR_VERSION "0") set(MINWIN_SHORT_NAME "handle") set(MINWIN_LONG_NAME "Handle and Object Functions") -set(MODULE_LIBRARY_NAME "api-ms-win-${MINWIN_GROUP}-${MINWIN_SHORT_NAME}-l${MINWIN_LAYER}-${MINWIN_MAJOR_VERSION}-${MINWIN_MINOR_VERSION}") - +set(MODULE_LIBRARY_NAME + "api-ms-win-${MINWIN_GROUP}-${MINWIN_SHORT_NAME}-l${MINWIN_LAYER}-${MINWIN_MAJOR_VERSION}-${MINWIN_MINOR_VERSION}" +) diff --git a/winpr/libwinpr/input/CMakeLists.txt b/winpr/libwinpr/input/CMakeLists.txt index b23754a60..5eba25e11 100644 --- a/winpr/libwinpr/input/CMakeLists.txt +++ b/winpr/libwinpr/input/CMakeLists.txt @@ -15,7 +15,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -winpr_module_add( - virtualkey.c - scancode.c - keycode.c) +winpr_module_add(virtualkey.c scancode.c keycode.c) diff --git a/winpr/libwinpr/input/ModuleOptions.cmake b/winpr/libwinpr/input/ModuleOptions.cmake index db32710f2..4531e4386 100644 --- a/winpr/libwinpr/input/ModuleOptions.cmake +++ b/winpr/libwinpr/input/ModuleOptions.cmake @@ -1,4 +1,3 @@ - set(MINWIN_LAYER "1") set(MINWIN_GROUP "core") set(MINWIN_MAJOR_VERSION "1") @@ -6,4 +5,3 @@ set(MINWIN_MINOR_VERSION "0") set(MINWIN_SHORT_NAME "input") set(MINWIN_LONG_NAME "Input Functions") set(MODULE_LIBRARY_NAME "input") - diff --git a/winpr/libwinpr/interlocked/CMakeLists.txt b/winpr/libwinpr/interlocked/CMakeLists.txt index 867a8e0ee..296cf8c27 100644 --- a/winpr/libwinpr/interlocked/CMakeLists.txt +++ b/winpr/libwinpr/interlocked/CMakeLists.txt @@ -18,5 +18,5 @@ winpr_module_add(interlocked.c) if(BUILD_TESTING_INTERNAL OR BUILD_TESTING) - add_subdirectory(test) + add_subdirectory(test) endif() diff --git a/winpr/libwinpr/interlocked/ModuleOptions.cmake b/winpr/libwinpr/interlocked/ModuleOptions.cmake index 8a1600aef..90767f3c6 100644 --- a/winpr/libwinpr/interlocked/ModuleOptions.cmake +++ b/winpr/libwinpr/interlocked/ModuleOptions.cmake @@ -1,9 +1,9 @@ - set(MINWIN_LAYER "1") set(MINWIN_GROUP "core") set(MINWIN_MAJOR_VERSION "2") set(MINWIN_MINOR_VERSION "0") set(MINWIN_SHORT_NAME "interlocked") set(MINWIN_LONG_NAME "Interlocked Functions") -set(MODULE_LIBRARY_NAME "api-ms-win-${MINWIN_GROUP}-${MINWIN_SHORT_NAME}-l${MINWIN_LAYER}-${MINWIN_MAJOR_VERSION}-${MINWIN_MINOR_VERSION}") - +set(MODULE_LIBRARY_NAME + "api-ms-win-${MINWIN_GROUP}-${MINWIN_SHORT_NAME}-l${MINWIN_LAYER}-${MINWIN_MAJOR_VERSION}-${MINWIN_MINOR_VERSION}" +) diff --git a/winpr/libwinpr/interlocked/test/CMakeLists.txt b/winpr/libwinpr/interlocked/test/CMakeLists.txt index 94c1d44f4..4afb6542b 100644 --- a/winpr/libwinpr/interlocked/test/CMakeLists.txt +++ b/winpr/libwinpr/interlocked/test/CMakeLists.txt @@ -1,4 +1,3 @@ - set(MODULE_NAME "TestInterlocked") set(MODULE_PREFIX "TEST_INTERLOCKED") @@ -6,14 +5,9 @@ disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR}) set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c) -set(${MODULE_PREFIX}_TESTS - TestInterlockedAccess.c - TestInterlockedSList.c - TestInterlockedDList.c) +set(${MODULE_PREFIX}_TESTS TestInterlockedAccess.c TestInterlockedSList.c TestInterlockedDList.c) -create_test_sourcelist(${MODULE_PREFIX}_SRCS - ${${MODULE_PREFIX}_DRIVER} - ${${MODULE_PREFIX}_TESTS}) +create_test_sourcelist(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_DRIVER} ${${MODULE_PREFIX}_TESTS}) add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) @@ -22,9 +16,8 @@ target_link_libraries(${MODULE_NAME} winpr) set_target_properties(${MODULE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TESTING_OUTPUT_DIRECTORY}") foreach(test ${${MODULE_PREFIX}_TESTS}) - get_filename_component(TestName ${test} NAME_WE) - add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) + get_filename_component(TestName ${test} NAME_WE) + add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) endforeach() set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR/Test") - diff --git a/winpr/libwinpr/io/CMakeLists.txt b/winpr/libwinpr/io/CMakeLists.txt index 89cc434ac..d8fdcab3d 100644 --- a/winpr/libwinpr/io/CMakeLists.txt +++ b/winpr/libwinpr/io/CMakeLists.txt @@ -18,5 +18,5 @@ winpr_module_add(device.c io.c io.h) if(BUILD_TESTING_INTERNAL OR BUILD_TESTING) - add_subdirectory(test) + add_subdirectory(test) endif() diff --git a/winpr/libwinpr/io/ModuleOptions.cmake b/winpr/libwinpr/io/ModuleOptions.cmake index f9f991d4c..9e7ac864e 100644 --- a/winpr/libwinpr/io/ModuleOptions.cmake +++ b/winpr/libwinpr/io/ModuleOptions.cmake @@ -1,9 +1,9 @@ - set(MINWIN_LAYER "1") set(MINWIN_GROUP "core") set(MINWIN_MAJOR_VERSION "1") set(MINWIN_MINOR_VERSION "1") set(MINWIN_SHORT_NAME "io") set(MINWIN_LONG_NAME "Asynchronous I/O Functions") -set(MODULE_LIBRARY_NAME "api-ms-win-${MINWIN_GROUP}-${MINWIN_SHORT_NAME}-l${MINWIN_LAYER}-${MINWIN_MAJOR_VERSION}-${MINWIN_MINOR_VERSION}") - +set(MODULE_LIBRARY_NAME + "api-ms-win-${MINWIN_GROUP}-${MINWIN_SHORT_NAME}-l${MINWIN_LAYER}-${MINWIN_MAJOR_VERSION}-${MINWIN_MINOR_VERSION}" +) diff --git a/winpr/libwinpr/io/test/CMakeLists.txt b/winpr/libwinpr/io/test/CMakeLists.txt index ac7b4772d..e13785522 100644 --- a/winpr/libwinpr/io/test/CMakeLists.txt +++ b/winpr/libwinpr/io/test/CMakeLists.txt @@ -1,4 +1,3 @@ - set(MODULE_NAME "TestIo") set(MODULE_PREFIX "TEST_IO") @@ -6,12 +5,9 @@ disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR}) set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c) -set(${MODULE_PREFIX}_TESTS - TestIoGetOverlappedResult.c) +set(${MODULE_PREFIX}_TESTS TestIoGetOverlappedResult.c) -create_test_sourcelist(${MODULE_PREFIX}_SRCS - ${${MODULE_PREFIX}_DRIVER} - ${${MODULE_PREFIX}_TESTS}) +create_test_sourcelist(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_DRIVER} ${${MODULE_PREFIX}_TESTS}) add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) @@ -20,8 +16,8 @@ target_link_libraries(${MODULE_NAME} winpr) set_target_properties(${MODULE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TESTING_OUTPUT_DIRECTORY}") foreach(test ${${MODULE_PREFIX}_TESTS}) - get_filename_component(TestName ${test} NAME_WE) - add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) + get_filename_component(TestName ${test} NAME_WE) + add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) endforeach() set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR/Test") diff --git a/winpr/libwinpr/library/CMakeLists.txt b/winpr/libwinpr/library/CMakeLists.txt index 66b1f0389..264864bf1 100644 --- a/winpr/libwinpr/library/CMakeLists.txt +++ b/winpr/libwinpr/library/CMakeLists.txt @@ -18,5 +18,5 @@ winpr_module_add(library.c) if(BUILD_TESTING_INTERNAL OR BUILD_TESTING) - add_subdirectory(test) + add_subdirectory(test) endif() diff --git a/winpr/libwinpr/library/ModuleOptions.cmake b/winpr/libwinpr/library/ModuleOptions.cmake index affda8690..b1dcf644b 100644 --- a/winpr/libwinpr/library/ModuleOptions.cmake +++ b/winpr/libwinpr/library/ModuleOptions.cmake @@ -1,9 +1,9 @@ - set(MINWIN_LAYER "1") set(MINWIN_GROUP "core") set(MINWIN_MAJOR_VERSION "1") set(MINWIN_MINOR_VERSION "1") set(MINWIN_SHORT_NAME "libraryloader") set(MINWIN_LONG_NAME "Dynamic-Link Library Functions") -set(MODULE_LIBRARY_NAME "api-ms-win-${MINWIN_GROUP}-${MINWIN_SHORT_NAME}-l${MINWIN_LAYER}-${MINWIN_MAJOR_VERSION}-${MINWIN_MINOR_VERSION}") - +set(MODULE_LIBRARY_NAME + "api-ms-win-${MINWIN_GROUP}-${MINWIN_SHORT_NAME}-l${MINWIN_LAYER}-${MINWIN_MAJOR_VERSION}-${MINWIN_MINOR_VERSION}" +) diff --git a/winpr/libwinpr/library/test/CMakeLists.txt b/winpr/libwinpr/library/test/CMakeLists.txt index e4ff4696a..0e95d87e5 100644 --- a/winpr/libwinpr/library/test/CMakeLists.txt +++ b/winpr/libwinpr/library/test/CMakeLists.txt @@ -1,4 +1,3 @@ - set(MODULE_NAME "TestLibrary") set(MODULE_PREFIX "TEST_LIBRARY") @@ -6,14 +5,9 @@ disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR}) set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c) -set(${MODULE_PREFIX}_TESTS - TestLibraryLoadLibrary.c - TestLibraryGetProcAddress.c - TestLibraryGetModuleFileName.c) +set(${MODULE_PREFIX}_TESTS TestLibraryLoadLibrary.c TestLibraryGetProcAddress.c TestLibraryGetModuleFileName.c) -create_test_sourcelist(${MODULE_PREFIX}_SRCS - ${${MODULE_PREFIX}_DRIVER} - ${${MODULE_PREFIX}_TESTS}) +create_test_sourcelist(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_DRIVER} ${${MODULE_PREFIX}_TESTS}) add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) @@ -24,12 +18,11 @@ set_target_properties(${MODULE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TEST set(TEST_AREA "${MODULE_NAME}Area") foreach(test ${${MODULE_PREFIX}_TESTS}) - get_filename_component(TestName ${test} NAME_WE) - add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) + get_filename_component(TestName ${test} NAME_WE) + add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) endforeach() set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR/Test") add_subdirectory(TestLibraryA) add_subdirectory(TestLibraryB) - diff --git a/winpr/libwinpr/library/test/TestLibraryB/CMakeLists.txt b/winpr/libwinpr/library/test/TestLibraryB/CMakeLists.txt index 860df8c7d..dbd3e9fbc 100644 --- a/winpr/libwinpr/library/test/TestLibraryB/CMakeLists.txt +++ b/winpr/libwinpr/library/test/TestLibraryB/CMakeLists.txt @@ -27,4 +27,3 @@ set_target_properties(${MODULE_NAME} PROPERTIES PREFIX "") set_target_properties(${MODULE_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${TESTING_OUTPUT_DIRECTORY}") set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR/Test/Extra") - diff --git a/winpr/libwinpr/memory/CMakeLists.txt b/winpr/libwinpr/memory/CMakeLists.txt index 79f5301f0..fad6090e6 100644 --- a/winpr/libwinpr/memory/CMakeLists.txt +++ b/winpr/libwinpr/memory/CMakeLists.txt @@ -18,5 +18,5 @@ winpr_module_add(memory.c memory.h) if(BUILD_TESTING_INTERNAL OR BUILD_TESTING) - add_subdirectory(test) + add_subdirectory(test) endif() diff --git a/winpr/libwinpr/memory/ModuleOptions.cmake b/winpr/libwinpr/memory/ModuleOptions.cmake index 704ddca19..d5dfca1c8 100644 --- a/winpr/libwinpr/memory/ModuleOptions.cmake +++ b/winpr/libwinpr/memory/ModuleOptions.cmake @@ -1,9 +1,9 @@ - set(MINWIN_LAYER "1") set(MINWIN_GROUP "core") set(MINWIN_MAJOR_VERSION "1") set(MINWIN_MINOR_VERSION "2") set(MINWIN_SHORT_NAME "memory") set(MINWIN_LONG_NAME "Memory Functions") -set(MODULE_LIBRARY_NAME "api-ms-win-${MINWIN_GROUP}-${MINWIN_SHORT_NAME}-l${MINWIN_LAYER}-${MINWIN_MAJOR_VERSION}-${MINWIN_MINOR_VERSION}") - +set(MODULE_LIBRARY_NAME + "api-ms-win-${MINWIN_GROUP}-${MINWIN_SHORT_NAME}-l${MINWIN_LAYER}-${MINWIN_MAJOR_VERSION}-${MINWIN_MINOR_VERSION}" +) diff --git a/winpr/libwinpr/memory/test/CMakeLists.txt b/winpr/libwinpr/memory/test/CMakeLists.txt index 1344ed5b7..3b6c502e7 100644 --- a/winpr/libwinpr/memory/test/CMakeLists.txt +++ b/winpr/libwinpr/memory/test/CMakeLists.txt @@ -1,4 +1,3 @@ - set(MODULE_NAME "TestMemory") set(MODULE_PREFIX "TEST_MEMORY") @@ -6,20 +5,17 @@ disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR}) set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c) -set(${MODULE_PREFIX}_TESTS - TestMemoryCreateFileMapping.c) +set(${MODULE_PREFIX}_TESTS TestMemoryCreateFileMapping.c) -create_test_sourcelist(${MODULE_PREFIX}_SRCS - ${${MODULE_PREFIX}_DRIVER} - ${${MODULE_PREFIX}_TESTS}) +create_test_sourcelist(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_DRIVER} ${${MODULE_PREFIX}_TESTS}) add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) set_target_properties(${MODULE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TESTING_OUTPUT_DIRECTORY}") foreach(test ${${MODULE_PREFIX}_TESTS}) - get_filename_component(TestName ${test} NAME_WE) - add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) + get_filename_component(TestName ${test} NAME_WE) + add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) endforeach() set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR/Test") diff --git a/winpr/libwinpr/ncrypt/CMakeLists.txt b/winpr/libwinpr/ncrypt/CMakeLists.txt index 0b26aa3b6..825489dbc 100644 --- a/winpr/libwinpr/ncrypt/CMakeLists.txt +++ b/winpr/libwinpr/ncrypt/CMakeLists.txt @@ -15,22 +15,16 @@ # See the License for the specific language governing permissions and # limitations under the License. -if (WITH_PKCS11) - winpr_module_add( - ncrypt_pkcs11.c - pkcs11-headers/pkcs11.h - ) +if(WITH_PKCS11) + winpr_module_add(ncrypt_pkcs11.c pkcs11-headers/pkcs11.h) endif() -winpr_module_add( - ncrypt.c - ncrypt.h -) +winpr_module_add(ncrypt.c ncrypt.h) -if (WIN32) - winpr_library_add_public(ncrypt) +if(WIN32) + winpr_library_add_public(ncrypt) endif() if(BUILD_TESTING_INTERNAL OR BUILD_TESTING) - add_subdirectory(test) + add_subdirectory(test) endif() diff --git a/winpr/libwinpr/ncrypt/ModuleOptions.cmake b/winpr/libwinpr/ncrypt/ModuleOptions.cmake index 80729fc53..54df271e4 100644 --- a/winpr/libwinpr/ncrypt/ModuleOptions.cmake +++ b/winpr/libwinpr/ncrypt/ModuleOptions.cmake @@ -1,4 +1,3 @@ - set(MINWIN_LAYER "1") set(MINWIN_GROUP "core") set(MINWIN_MAJOR_VERSION "1") @@ -6,4 +5,3 @@ set(MINWIN_MINOR_VERSION "0") set(MINWIN_SHORT_NAME "ncrypt") set(MINWIN_LONG_NAME "NCrypt Functions") set(MODULE_LIBRARY_NAME "ncrypt") - diff --git a/winpr/libwinpr/ncrypt/test/CMakeLists.txt b/winpr/libwinpr/ncrypt/test/CMakeLists.txt index 2ad66c646..9bec9edd7 100644 --- a/winpr/libwinpr/ncrypt/test/CMakeLists.txt +++ b/winpr/libwinpr/ncrypt/test/CMakeLists.txt @@ -5,27 +5,22 @@ disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR}) set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c) -set(${MODULE_PREFIX}_TESTS - TestNCryptSmartcard.c - TestNCryptProviders.c -) +set(${MODULE_PREFIX}_TESTS TestNCryptSmartcard.c TestNCryptProviders.c) -create_test_sourcelist(${MODULE_PREFIX}_SRCS - ${${MODULE_PREFIX}_DRIVER} - ${${MODULE_PREFIX}_TESTS}) +create_test_sourcelist(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_DRIVER} ${${MODULE_PREFIX}_TESTS}) add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) set_target_properties(${MODULE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TESTING_OUTPUT_DIRECTORY}") foreach(test ${${MODULE_PREFIX}_TESTS}) - get_filename_component(TestName ${test} NAME_WE) - add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) + get_filename_component(TestName ${test} NAME_WE) + add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) endforeach() target_link_libraries(${MODULE_NAME} winpr ${OPENSSL_LIBRARIES}) if(WIN32) - target_link_libraries(${MODULE_NAME} ncrypt) + target_link_libraries(${MODULE_NAME} ncrypt) endif() set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR/Test") diff --git a/winpr/libwinpr/nt/CMakeLists.txt b/winpr/libwinpr/nt/CMakeLists.txt index 3dcc703e2..5152185a7 100644 --- a/winpr/libwinpr/nt/CMakeLists.txt +++ b/winpr/libwinpr/nt/CMakeLists.txt @@ -17,10 +17,8 @@ winpr_module_add(nt.c ntstatus.c) -winpr_library_add_private( - ${CMAKE_THREAD_LIBS_INIT} - ${CMAKE_DL_LIBS}) +winpr_library_add_private(${CMAKE_THREAD_LIBS_INIT} ${CMAKE_DL_LIBS}) if(BUILD_TESTING_INTERNAL OR BUILD_TESTING) - add_subdirectory(test) + add_subdirectory(test) endif() diff --git a/winpr/libwinpr/nt/ModuleOptions.cmake b/winpr/libwinpr/nt/ModuleOptions.cmake index 750a8f556..31ac6e78d 100644 --- a/winpr/libwinpr/nt/ModuleOptions.cmake +++ b/winpr/libwinpr/nt/ModuleOptions.cmake @@ -1,4 +1,3 @@ - set(MINWIN_LAYER "0") set(MINWIN_GROUP "none") set(MINWIN_MAJOR_VERSION "0") diff --git a/winpr/libwinpr/nt/test/CMakeLists.txt b/winpr/libwinpr/nt/test/CMakeLists.txt index 01b06df0f..9658e66b0 100644 --- a/winpr/libwinpr/nt/test/CMakeLists.txt +++ b/winpr/libwinpr/nt/test/CMakeLists.txt @@ -1,4 +1,3 @@ - set(MODULE_NAME "TestNt") set(MODULE_PREFIX "TEST_NT") @@ -6,12 +5,9 @@ disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR}) set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c) -set(${MODULE_PREFIX}_TESTS - TestNtCurrentTeb.c) +set(${MODULE_PREFIX}_TESTS TestNtCurrentTeb.c) -create_test_sourcelist(${MODULE_PREFIX}_SRCS - ${${MODULE_PREFIX}_DRIVER} - ${${MODULE_PREFIX}_TESTS}) +create_test_sourcelist(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_DRIVER} ${${MODULE_PREFIX}_TESTS}) add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) @@ -20,9 +16,8 @@ target_link_libraries(${MODULE_NAME} winpr) set_target_properties(${MODULE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TESTING_OUTPUT_DIRECTORY}") foreach(test ${${MODULE_PREFIX}_TESTS}) - get_filename_component(TestName ${test} NAME_WE) - add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) + get_filename_component(TestName ${test} NAME_WE) + add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) endforeach() set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR/Test") - diff --git a/winpr/libwinpr/path/CMakeLists.txt b/winpr/libwinpr/path/CMakeLists.txt index cd1c8c5bb..404c0ff23 100644 --- a/winpr/libwinpr/path/CMakeLists.txt +++ b/winpr/libwinpr/path/CMakeLists.txt @@ -17,14 +17,14 @@ winpr_module_add(path.c shell.c) -if (MSVC OR MINGW) - winpr_library_add_public(shlwapi) +if(MSVC OR MINGW) + winpr_library_add_public(shlwapi) endif() -if (IOS) - winpr_module_add(shell_ios.m) -endif (IOS) +if(IOS) + winpr_module_add(shell_ios.m) +endif(IOS) if(BUILD_TESTING_INTERNAL OR BUILD_TESTING) - add_subdirectory(test) + add_subdirectory(test) endif() diff --git a/winpr/libwinpr/path/ModuleOptions.cmake b/winpr/libwinpr/path/ModuleOptions.cmake index b330a21e2..b0a53dae4 100644 --- a/winpr/libwinpr/path/ModuleOptions.cmake +++ b/winpr/libwinpr/path/ModuleOptions.cmake @@ -1,9 +1,9 @@ - set(MINWIN_LAYER "1") set(MINWIN_GROUP "core") set(MINWIN_MAJOR_VERSION "1") set(MINWIN_MINOR_VERSION "0") set(MINWIN_SHORT_NAME "path") set(MINWIN_LONG_NAME "Path Functions") -set(MODULE_LIBRARY_NAME "api-ms-win-${MINWIN_GROUP}-${MINWIN_SHORT_NAME}-l${MINWIN_LAYER}-${MINWIN_MAJOR_VERSION}-${MINWIN_MINOR_VERSION}") - +set(MODULE_LIBRARY_NAME + "api-ms-win-${MINWIN_GROUP}-${MINWIN_SHORT_NAME}-l${MINWIN_LAYER}-${MINWIN_MAJOR_VERSION}-${MINWIN_MINOR_VERSION}" +) diff --git a/winpr/libwinpr/path/test/CMakeLists.txt b/winpr/libwinpr/path/test/CMakeLists.txt index c3553ce80..c552f9f0c 100644 --- a/winpr/libwinpr/path/test/CMakeLists.txt +++ b/winpr/libwinpr/path/test/CMakeLists.txt @@ -1,4 +1,3 @@ - set(MODULE_NAME "TestPath") set(MODULE_PREFIX "TEST_PATH") @@ -7,34 +6,33 @@ disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR}) set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c) set(${MODULE_PREFIX}_TESTS - TestPathCchAddBackslash.c - TestPathCchRemoveBackslash.c - TestPathCchAddBackslashEx.c - TestPathCchRemoveBackslashEx.c - TestPathCchAddExtension.c - TestPathCchAppend.c - TestPathCchAppendEx.c - TestPathCchCanonicalize.c - TestPathCchCanonicalizeEx.c - TestPathAllocCanonicalize.c - TestPathCchCombine.c - TestPathCchCombineEx.c - TestPathAllocCombine.c - TestPathCchFindExtension.c - TestPathCchRenameExtension.c - TestPathCchRemoveExtension.c - TestPathCchIsRoot.c - TestPathIsUNCEx.c - TestPathCchSkipRoot.c - TestPathCchStripToRoot.c - TestPathCchStripPrefix.c - TestPathCchRemoveFileSpec.c - TestPathShell.c - TestPathMakePath.c) + TestPathCchAddBackslash.c + TestPathCchRemoveBackslash.c + TestPathCchAddBackslashEx.c + TestPathCchRemoveBackslashEx.c + TestPathCchAddExtension.c + TestPathCchAppend.c + TestPathCchAppendEx.c + TestPathCchCanonicalize.c + TestPathCchCanonicalizeEx.c + TestPathAllocCanonicalize.c + TestPathCchCombine.c + TestPathCchCombineEx.c + TestPathAllocCombine.c + TestPathCchFindExtension.c + TestPathCchRenameExtension.c + TestPathCchRemoveExtension.c + TestPathCchIsRoot.c + TestPathIsUNCEx.c + TestPathCchSkipRoot.c + TestPathCchStripToRoot.c + TestPathCchStripPrefix.c + TestPathCchRemoveFileSpec.c + TestPathShell.c + TestPathMakePath.c +) -create_test_sourcelist(${MODULE_PREFIX}_SRCS - ${${MODULE_PREFIX}_DRIVER} - ${${MODULE_PREFIX}_TESTS}) +create_test_sourcelist(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_DRIVER} ${${MODULE_PREFIX}_TESTS}) add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) @@ -43,8 +41,8 @@ target_link_libraries(${MODULE_NAME} winpr) set_target_properties(${MODULE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TESTING_OUTPUT_DIRECTORY}") foreach(test ${${MODULE_PREFIX}_TESTS}) - get_filename_component(TestName ${test} NAME_WE) - add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) + get_filename_component(TestName ${test} NAME_WE) + add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) endforeach() set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR/Test") diff --git a/winpr/libwinpr/pipe/CMakeLists.txt b/winpr/libwinpr/pipe/CMakeLists.txt index f40ad8598..c36391223 100644 --- a/winpr/libwinpr/pipe/CMakeLists.txt +++ b/winpr/libwinpr/pipe/CMakeLists.txt @@ -18,5 +18,5 @@ winpr_module_add(pipe.c pipe.h) if(BUILD_TESTING_INTERNAL OR BUILD_TESTING) - add_subdirectory(test) + add_subdirectory(test) endif() diff --git a/winpr/libwinpr/pipe/ModuleOptions.cmake b/winpr/libwinpr/pipe/ModuleOptions.cmake index 557e6a149..731f49de2 100644 --- a/winpr/libwinpr/pipe/ModuleOptions.cmake +++ b/winpr/libwinpr/pipe/ModuleOptions.cmake @@ -1,9 +1,9 @@ - set(MINWIN_LAYER "1") set(MINWIN_GROUP "core") set(MINWIN_MAJOR_VERSION "2") set(MINWIN_MINOR_VERSION "0") set(MINWIN_SHORT_NAME "namedpipe") set(MINWIN_LONG_NAME "Named Pipe Functions") -set(MODULE_LIBRARY_NAME "api-ms-win-${MINWIN_GROUP}-${MINWIN_SHORT_NAME}-l${MINWIN_LAYER}-${MINWIN_MAJOR_VERSION}-${MINWIN_MINOR_VERSION}") - +set(MODULE_LIBRARY_NAME + "api-ms-win-${MINWIN_GROUP}-${MINWIN_SHORT_NAME}-l${MINWIN_LAYER}-${MINWIN_MAJOR_VERSION}-${MINWIN_MINOR_VERSION}" +) diff --git a/winpr/libwinpr/pipe/test/CMakeLists.txt b/winpr/libwinpr/pipe/test/CMakeLists.txt index 78a61f863..92495e79b 100644 --- a/winpr/libwinpr/pipe/test/CMakeLists.txt +++ b/winpr/libwinpr/pipe/test/CMakeLists.txt @@ -1,4 +1,3 @@ - set(MODULE_NAME "TestPipe") set(MODULE_PREFIX "TEST_PIPE") @@ -6,14 +5,9 @@ disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR}) set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c) -set(${MODULE_PREFIX}_TESTS - TestPipeCreatePipe.c - TestPipeCreateNamedPipe.c - TestPipeCreateNamedPipeOverlapped.c) +set(${MODULE_PREFIX}_TESTS TestPipeCreatePipe.c TestPipeCreateNamedPipe.c TestPipeCreateNamedPipeOverlapped.c) -create_test_sourcelist(${MODULE_PREFIX}_SRCS - ${${MODULE_PREFIX}_DRIVER} - ${${MODULE_PREFIX}_TESTS}) +create_test_sourcelist(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_DRIVER} ${${MODULE_PREFIX}_TESTS}) add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) @@ -22,8 +16,8 @@ target_link_libraries(${MODULE_NAME} winpr) set_target_properties(${MODULE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TESTING_OUTPUT_DIRECTORY}") foreach(test ${${MODULE_PREFIX}_TESTS}) - get_filename_component(TestName ${test} NAME_WE) - add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) + get_filename_component(TestName ${test} NAME_WE) + add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) endforeach() set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR/Test") diff --git a/winpr/libwinpr/pool/CMakeLists.txt b/winpr/libwinpr/pool/CMakeLists.txt index 8c8336ef4..fb2dee58f 100644 --- a/winpr/libwinpr/pool/CMakeLists.txt +++ b/winpr/libwinpr/pool/CMakeLists.txt @@ -16,22 +16,19 @@ # limitations under the License. winpr_module_add( - synch.c - work.c - timer.c - io.c - cleanup_group.c - pool.c - pool.h - callback.c - callback_cleanup.c) + synch.c + work.c + timer.c + io.c + cleanup_group.c + pool.c + pool.h + callback.c + callback_cleanup.c +) -winpr_library_add_private( - ${CMAKE_THREAD_LIBS_INIT} - ${CMAKE_DL_LIBS}) +winpr_library_add_private(${CMAKE_THREAD_LIBS_INIT} ${CMAKE_DL_LIBS}) if(BUILD_TESTING_INTERNAL OR BUILD_TESTING) - add_subdirectory(test) + add_subdirectory(test) endif() - - diff --git a/winpr/libwinpr/pool/ModuleOptions.cmake b/winpr/libwinpr/pool/ModuleOptions.cmake index d5472ec3b..e2d7e38db 100644 --- a/winpr/libwinpr/pool/ModuleOptions.cmake +++ b/winpr/libwinpr/pool/ModuleOptions.cmake @@ -1,9 +1,9 @@ - set(MINWIN_LAYER "1") set(MINWIN_GROUP "core") set(MINWIN_MAJOR_VERSION "2") set(MINWIN_MINOR_VERSION "1") set(MINWIN_SHORT_NAME "threadpool") set(MINWIN_LONG_NAME "Thread Pool API") -set(MODULE_LIBRARY_NAME "api-ms-win-${MINWIN_GROUP}-${MINWIN_SHORT_NAME}-l${MINWIN_LAYER}-${MINWIN_MAJOR_VERSION}-${MINWIN_MINOR_VERSION}") - +set(MODULE_LIBRARY_NAME + "api-ms-win-${MINWIN_GROUP}-${MINWIN_SHORT_NAME}-l${MINWIN_LAYER}-${MINWIN_MAJOR_VERSION}-${MINWIN_MINOR_VERSION}" +) diff --git a/winpr/libwinpr/pool/test/CMakeLists.txt b/winpr/libwinpr/pool/test/CMakeLists.txt index a7905080d..e591e8a9f 100644 --- a/winpr/libwinpr/pool/test/CMakeLists.txt +++ b/winpr/libwinpr/pool/test/CMakeLists.txt @@ -1,4 +1,3 @@ - set(MODULE_NAME "TestPool") set(MODULE_PREFIX "TEST_POOL") @@ -6,16 +5,9 @@ disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR}) set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c) -set(${MODULE_PREFIX}_TESTS - TestPoolIO.c - TestPoolSynch.c - TestPoolThread.c - TestPoolTimer.c - TestPoolWork.c) +set(${MODULE_PREFIX}_TESTS TestPoolIO.c TestPoolSynch.c TestPoolThread.c TestPoolTimer.c TestPoolWork.c) -create_test_sourcelist(${MODULE_PREFIX}_SRCS - ${${MODULE_PREFIX}_DRIVER} - ${${MODULE_PREFIX}_TESTS}) +create_test_sourcelist(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_DRIVER} ${${MODULE_PREFIX}_TESTS}) add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) @@ -24,9 +16,8 @@ target_link_libraries(${MODULE_NAME} winpr) set_target_properties(${MODULE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TESTING_OUTPUT_DIRECTORY}") foreach(test ${${MODULE_PREFIX}_TESTS}) - get_filename_component(TestName ${test} NAME_WE) - add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) + get_filename_component(TestName ${test} NAME_WE) + add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) endforeach() set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR/Test") - diff --git a/winpr/libwinpr/registry/CMakeLists.txt b/winpr/libwinpr/registry/CMakeLists.txt index 4400afdd5..3b33e6185 100644 --- a/winpr/libwinpr/registry/CMakeLists.txt +++ b/winpr/libwinpr/registry/CMakeLists.txt @@ -15,7 +15,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -winpr_module_add( - registry_reg.c - registry_reg.h - registry.c) +winpr_module_add(registry_reg.c registry_reg.h registry.c) diff --git a/winpr/libwinpr/registry/ModuleOptions.cmake b/winpr/libwinpr/registry/ModuleOptions.cmake index a83eb09c7..7c71eb014 100644 --- a/winpr/libwinpr/registry/ModuleOptions.cmake +++ b/winpr/libwinpr/registry/ModuleOptions.cmake @@ -1,9 +1,9 @@ - set(MINWIN_LAYER "1") set(MINWIN_GROUP "core") set(MINWIN_MAJOR_VERSION "1") set(MINWIN_MINOR_VERSION "0") set(MINWIN_SHORT_NAME "registry") set(MINWIN_LONG_NAME "Registry Functions") -set(MODULE_LIBRARY_NAME "api-ms-win-${MINWIN_GROUP}-${MINWIN_SHORT_NAME}-l${MINWIN_LAYER}-${MINWIN_MAJOR_VERSION}-${MINWIN_MINOR_VERSION}") - +set(MODULE_LIBRARY_NAME + "api-ms-win-${MINWIN_GROUP}-${MINWIN_SHORT_NAME}-l${MINWIN_LAYER}-${MINWIN_MAJOR_VERSION}-${MINWIN_MINOR_VERSION}" +) diff --git a/winpr/libwinpr/rpc/CMakeLists.txt b/winpr/libwinpr/rpc/CMakeLists.txt index e3e851aa1..14166a61d 100644 --- a/winpr/libwinpr/rpc/CMakeLists.txt +++ b/winpr/libwinpr/rpc/CMakeLists.txt @@ -15,14 +15,12 @@ # See the License for the specific language governing permissions and # limitations under the License. -winpr_module_add( - rpc.c -) +winpr_module_add(rpc.c) winpr_include_directory_add(${OPENSSL_INCLUDE_DIR}) winpr_library_add_private(${OPENSSL_LIBRARIES}) if(WIN32) - winpr_library_add_public(ws2_32 rpcrt4) + winpr_library_add_public(ws2_32 rpcrt4) endif() diff --git a/winpr/libwinpr/rpc/ModuleOptions.cmake b/winpr/libwinpr/rpc/ModuleOptions.cmake index 55987fef3..de65b390a 100644 --- a/winpr/libwinpr/rpc/ModuleOptions.cmake +++ b/winpr/libwinpr/rpc/ModuleOptions.cmake @@ -1,4 +1,3 @@ - set(MINWIN_LAYER "0") set(MINWIN_GROUP "none") set(MINWIN_MAJOR_VERSION "0") @@ -6,4 +5,3 @@ set(MINWIN_MINOR_VERSION "0") set(MINWIN_SHORT_NAME "rpcrt4") set(MINWIN_LONG_NAME "RPC NDR Engine") set(MODULE_LIBRARY_NAME "${MINWIN_SHORT_NAME}") - diff --git a/winpr/libwinpr/security/CMakeLists.txt b/winpr/libwinpr/security/CMakeLists.txt index 0b8fcbc4c..cf4857395 100644 --- a/winpr/libwinpr/security/CMakeLists.txt +++ b/winpr/libwinpr/security/CMakeLists.txt @@ -18,5 +18,5 @@ winpr_module_add(security.c) if(BUILD_TESTING_INTERNAL OR BUILD_TESTING) - add_subdirectory(test) + add_subdirectory(test) endif() diff --git a/winpr/libwinpr/security/ModuleOptions.cmake b/winpr/libwinpr/security/ModuleOptions.cmake index 66fa71ac9..e9b5902dd 100644 --- a/winpr/libwinpr/security/ModuleOptions.cmake +++ b/winpr/libwinpr/security/ModuleOptions.cmake @@ -1,8 +1,9 @@ - set(MINWIN_LAYER "1") set(MINWIN_GROUP "security") set(MINWIN_MAJOR_VERSION "2") set(MINWIN_MINOR_VERSION "0") set(MINWIN_SHORT_NAME "base") set(MINWIN_LONG_NAME "Base Security Functions") -set(MODULE_LIBRARY_NAME "api-ms-win-${MINWIN_GROUP}-${MINWIN_SHORT_NAME}-l${MINWIN_LAYER}-${MINWIN_MAJOR_VERSION}-${MINWIN_MINOR_VERSION}") +set(MODULE_LIBRARY_NAME + "api-ms-win-${MINWIN_GROUP}-${MINWIN_SHORT_NAME}-l${MINWIN_LAYER}-${MINWIN_MAJOR_VERSION}-${MINWIN_MINOR_VERSION}" +) diff --git a/winpr/libwinpr/security/test/CMakeLists.txt b/winpr/libwinpr/security/test/CMakeLists.txt index bd0fbc2b7..c9632cd04 100644 --- a/winpr/libwinpr/security/test/CMakeLists.txt +++ b/winpr/libwinpr/security/test/CMakeLists.txt @@ -1,4 +1,3 @@ - set(MODULE_NAME "TestSecurity") set(MODULE_PREFIX "TEST_SECURITY") @@ -6,20 +5,17 @@ disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR}) set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c) -set(${MODULE_PREFIX}_TESTS - TestSecurityToken.c) +set(${MODULE_PREFIX}_TESTS TestSecurityToken.c) -create_test_sourcelist(${MODULE_PREFIX}_SRCS - ${${MODULE_PREFIX}_DRIVER} - ${${MODULE_PREFIX}_TESTS}) +create_test_sourcelist(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_DRIVER} ${${MODULE_PREFIX}_TESTS}) add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) set_target_properties(${MODULE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TESTING_OUTPUT_DIRECTORY}") foreach(test ${${MODULE_PREFIX}_TESTS}) - get_filename_component(TestName ${test} NAME_WE) - add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) + get_filename_component(TestName ${test} NAME_WE) + add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) endforeach() set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR/Test") diff --git a/winpr/libwinpr/shell/CMakeLists.txt b/winpr/libwinpr/shell/CMakeLists.txt index 24b47e3ca..3fa4f4e17 100644 --- a/winpr/libwinpr/shell/CMakeLists.txt +++ b/winpr/libwinpr/shell/CMakeLists.txt @@ -15,6 +15,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -if (NOT ANDROID) - winpr_module_add(shell.c) +if(NOT ANDROID) + winpr_module_add(shell.c) endif() diff --git a/winpr/libwinpr/shell/ModuleOptions.cmake b/winpr/libwinpr/shell/ModuleOptions.cmake index 116680dd7..3aed558c6 100644 --- a/winpr/libwinpr/shell/ModuleOptions.cmake +++ b/winpr/libwinpr/shell/ModuleOptions.cmake @@ -1,4 +1,3 @@ - set(MINWIN_LAYER "0") set(MINWIN_GROUP "none") set(MINWIN_MAJOR_VERSION "0") @@ -6,4 +5,3 @@ set(MINWIN_MINOR_VERSION "0") set(MINWIN_SHORT_NAME "shell") set(MINWIN_LONG_NAME "Shell Functions") set(MODULE_LIBRARY_NAME "${MINWIN_SHORT_NAME}") - diff --git a/winpr/libwinpr/smartcard/CMakeLists.txt b/winpr/libwinpr/smartcard/CMakeLists.txt index 80664aa2d..1064f6254 100644 --- a/winpr/libwinpr/smartcard/CMakeLists.txt +++ b/winpr/libwinpr/smartcard/CMakeLists.txt @@ -18,43 +18,33 @@ set(MODULE_PREFIX "WINPR_SMARTCARD") if(PCSC_WINPR_FOUND) - winpr_definition_add(-DWITH_WINPR_PCSC) + winpr_definition_add(-DWITH_WINPR_PCSC) endif() option(WITH_SMARTCARD_PCSC "Enable smartcard PCSC backend" ON) - -set(${MODULE_PREFIX}_SRCS - smartcard.c - smartcard.h) +set(${MODULE_PREFIX}_SRCS smartcard.c smartcard.h) if(WITH_SMARTCARD_PCSC) - winpr_definition_add(-DWITH_SMARTCARD_PCSC) - list(APPEND ${MODULE_PREFIX}_SRCS - smartcard_pcsc.c - smartcard_pcsc.h) + winpr_definition_add(-DWITH_SMARTCARD_PCSC) + list(APPEND ${MODULE_PREFIX}_SRCS smartcard_pcsc.c smartcard_pcsc.h) endif() if(WITH_SMARTCARD_INSPECT) - winpr_definition_add(-DWITH_SMARTCARD_INSPECT) - list(APPEND ${MODULE_PREFIX}_SRCS - smartcard_inspect.c - smartcard_inspect.h) + winpr_definition_add(-DWITH_SMARTCARD_INSPECT) + list(APPEND ${MODULE_PREFIX}_SRCS smartcard_inspect.c smartcard_inspect.h) endif() if(WIN32) - list(APPEND ${MODULE_PREFIX}_SRCS - smartcard_windows.c - smartcard_windows.h) + list(APPEND ${MODULE_PREFIX}_SRCS smartcard_windows.c smartcard_windows.h) endif() winpr_module_add(${${MODULE_PREFIX}_SRCS}) if(PCSC_WINPR_FOUND) - winpr_library_add_private(${PCSC_WINPR_LIBRARY}) + winpr_library_add_private(${PCSC_WINPR_LIBRARY}) endif() if(BUILD_TESTING_INTERNAL OR BUILD_TESTING) - add_subdirectory(test) + add_subdirectory(test) endif() - diff --git a/winpr/libwinpr/smartcard/ModuleOptions.cmake b/winpr/libwinpr/smartcard/ModuleOptions.cmake index afb4a1ea4..92b77d31d 100644 --- a/winpr/libwinpr/smartcard/ModuleOptions.cmake +++ b/winpr/libwinpr/smartcard/ModuleOptions.cmake @@ -1,4 +1,3 @@ - set(MINWIN_LAYER "0") set(MINWIN_GROUP "none") set(MINWIN_MAJOR_VERSION "0") @@ -6,4 +5,3 @@ set(MINWIN_MINOR_VERSION "0") set(MINWIN_SHORT_NAME "smartcard") set(MINWIN_LONG_NAME "Smart Card API") set(MODULE_LIBRARY_NAME "${MINWIN_SHORT_NAME}") - diff --git a/winpr/libwinpr/smartcard/test/CMakeLists.txt b/winpr/libwinpr/smartcard/test/CMakeLists.txt index 5f6c9ce14..e8c590ef2 100644 --- a/winpr/libwinpr/smartcard/test/CMakeLists.txt +++ b/winpr/libwinpr/smartcard/test/CMakeLists.txt @@ -1,4 +1,3 @@ - set(MODULE_NAME "TestSmartCard") set(MODULE_PREFIX "TEST_SMARTCARD") @@ -6,12 +5,9 @@ disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR}) set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c) -set(${MODULE_PREFIX}_TESTS - TestSmartCardListReaders.c) +set(${MODULE_PREFIX}_TESTS TestSmartCardListReaders.c) -create_test_sourcelist(${MODULE_PREFIX}_SRCS - ${${MODULE_PREFIX}_DRIVER} - ${${MODULE_PREFIX}_TESTS}) +create_test_sourcelist(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_DRIVER} ${${MODULE_PREFIX}_TESTS}) add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) @@ -20,9 +16,8 @@ target_link_libraries(${MODULE_NAME} winpr) set_target_properties(${MODULE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TESTING_OUTPUT_DIRECTORY}") foreach(test ${${MODULE_PREFIX}_TESTS}) - get_filename_component(TestName ${test} NAME_WE) - add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) + get_filename_component(TestName ${test} NAME_WE) + add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) endforeach() set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR/Test") - diff --git a/winpr/libwinpr/sspi/CMakeLists.txt b/winpr/libwinpr/sspi/CMakeLists.txt index c9ef3862e..f89535ccb 100644 --- a/winpr/libwinpr/sspi/CMakeLists.txt +++ b/winpr/libwinpr/sspi/CMakeLists.txt @@ -18,112 +18,101 @@ set(MODULE_PREFIX "WINPR_SSPI") set(${MODULE_PREFIX}_NTLM_SRCS - NTLM/ntlm_av_pairs.c - NTLM/ntlm_av_pairs.h - NTLM/ntlm_compute.c - NTLM/ntlm_compute.h - NTLM/ntlm_message.c - NTLM/ntlm_message.h - NTLM/ntlm.c - NTLM/ntlm.h - NTLM/ntlm_export.h) + NTLM/ntlm_av_pairs.c + NTLM/ntlm_av_pairs.h + NTLM/ntlm_compute.c + NTLM/ntlm_compute.h + NTLM/ntlm_message.c + NTLM/ntlm_message.h + NTLM/ntlm.c + NTLM/ntlm.h + NTLM/ntlm_export.h +) -set(${MODULE_PREFIX}_KERBEROS_SRCS - Kerberos/kerberos.c - Kerberos/kerberos.h) +set(${MODULE_PREFIX}_KERBEROS_SRCS Kerberos/kerberos.c Kerberos/kerberos.h) -set(${MODULE_PREFIX}_NEGOTIATE_SRCS - Negotiate/negotiate.c - Negotiate/negotiate.h) +set(${MODULE_PREFIX}_NEGOTIATE_SRCS Negotiate/negotiate.c Negotiate/negotiate.h) -set(${MODULE_PREFIX}_SCHANNEL_SRCS - Schannel/schannel_openssl.c - Schannel/schannel_openssl.h - Schannel/schannel.c - Schannel/schannel.h) +set(${MODULE_PREFIX}_SCHANNEL_SRCS Schannel/schannel_openssl.c Schannel/schannel_openssl.h Schannel/schannel.c + Schannel/schannel.h +) -set(${MODULE_PREFIX}_CREDSSP_SRCS - CredSSP/credssp.c - CredSSP/credssp.h) +set(${MODULE_PREFIX}_CREDSSP_SRCS CredSSP/credssp.c CredSSP/credssp.h) set(${MODULE_PREFIX}_SRCS - sspi_winpr.c - sspi_winpr.h - sspi_export.c - sspi_gss.c - sspi_gss.h - sspi.c - sspi.h) + sspi_winpr.c + sspi_winpr.h + sspi_export.c + sspi_gss.c + sspi_gss.h + sspi.c + sspi.h +) set(KRB5_DEFAULT OFF) -if (NOT WIN32 AND NOT ANDROID AND NOT IOS AND NOT APPLE) - set(KRB5_DEFAULT ON) +if(NOT WIN32 AND NOT ANDROID AND NOT IOS AND NOT APPLE) + set(KRB5_DEFAULT ON) endif() option(WITH_DEBUG_SCHANNEL "Compile support for SCHANNEL debug" ${DEFAULT_DEBUG_OPTION}) -if (WITH_DEBUG_SCHANNEL) - winpr_definition_add("-DWITH_DEBUG_SCHANNEL") +if(WITH_DEBUG_SCHANNEL) + winpr_definition_add("-DWITH_DEBUG_SCHANNEL") endif() option(WITH_KRB5 "Compile support for kerberos authentication." ${KRB5_DEFAULT}) -if (WITH_KRB5) - find_package(KRB5 REQUIRED) +if(WITH_KRB5) + find_package(KRB5 REQUIRED) - list(APPEND ${MODULE_PREFIX}_KERBEROS_SRCS - Kerberos/krb5glue.h) + list(APPEND ${MODULE_PREFIX}_KERBEROS_SRCS Kerberos/krb5glue.h) - winpr_include_directory_add(${KRB5_INCLUDEDIR}) - winpr_include_directory_add(${KRB5_INCLUDE_DIRS}) - winpr_library_add_private(${KRB5_LIBRARIES}) - winpr_library_add_private(${KRB5_LIBRARY}) - winpr_library_add_compile_options(${KRB5_CFLAGS}) - winpr_library_add_link_options(${KRB5_LDFLAGS}) - winpr_library_add_link_directory(${KRB5_LIBRARY_DIRS}) + winpr_include_directory_add(${KRB5_INCLUDEDIR}) + winpr_include_directory_add(${KRB5_INCLUDE_DIRS}) + winpr_library_add_private(${KRB5_LIBRARIES}) + winpr_library_add_private(${KRB5_LIBRARY}) + winpr_library_add_compile_options(${KRB5_CFLAGS}) + winpr_library_add_link_options(${KRB5_LDFLAGS}) + winpr_library_add_link_directory(${KRB5_LIBRARY_DIRS}) - winpr_definition_add("-DWITH_KRB5") + winpr_definition_add("-DWITH_KRB5") - if(KRB5_FLAVOUR STREQUAL "MIT") - winpr_definition_add("-DWITH_KRB5_MIT") - list(APPEND ${MODULE_PREFIX}_KERBEROS_SRCS - Kerberos/krb5glue_mit.c - ) - elseif(KRB5_FLAVOUR STREQUAL "Heimdal") - winpr_definition_add("-DWITH_KRB5_HEIMDAL") - list(APPEND ${MODULE_PREFIX}_KERBEROS_SRCS - Kerberos/krb5glue_heimdal.c - ) - else() - message(WARNING "Kerberos version not detected") - endif() + if(KRB5_FLAVOUR STREQUAL "MIT") + winpr_definition_add("-DWITH_KRB5_MIT") + list(APPEND ${MODULE_PREFIX}_KERBEROS_SRCS Kerberos/krb5glue_mit.c) + elseif(KRB5_FLAVOUR STREQUAL "Heimdal") + winpr_definition_add("-DWITH_KRB5_HEIMDAL") + list(APPEND ${MODULE_PREFIX}_KERBEROS_SRCS Kerberos/krb5glue_heimdal.c) + else() + message(WARNING "Kerberos version not detected") + endif() - include(CMakeDependentOption) - CMAKE_DEPENDENT_OPTION(WITH_KRB5_NO_NTLM_FALLBACK "Do not fall back to NTLM if no kerberos ticket available" OFF "WITH_KRB5" OFF) - if (WITH_KRB5_NO_NTLM_FALLBACK) - add_definitions("-DWITH_KRB5_NO_NTLM_FALLBACK") - endif() + include(CMakeDependentOption) + cmake_dependent_option( + WITH_KRB5_NO_NTLM_FALLBACK "Do not fall back to NTLM if no kerberos ticket available" OFF "WITH_KRB5" OFF + ) + if(WITH_KRB5_NO_NTLM_FALLBACK) + add_definitions("-DWITH_KRB5_NO_NTLM_FALLBACK") + endif() endif() -winpr_module_add(${${MODULE_PREFIX}_CREDSSP_SRCS} - ${${MODULE_PREFIX}_NTLM_SRCS} - ${${MODULE_PREFIX}_KERBEROS_SRCS} - ${${MODULE_PREFIX}_NEGOTIATE_SRCS} - ${${MODULE_PREFIX}_SCHANNEL_SRCS} - ${${MODULE_PREFIX}_SRCS}) +winpr_module_add( + ${${MODULE_PREFIX}_CREDSSP_SRCS} ${${MODULE_PREFIX}_NTLM_SRCS} ${${MODULE_PREFIX}_KERBEROS_SRCS} + ${${MODULE_PREFIX}_NEGOTIATE_SRCS} ${${MODULE_PREFIX}_SCHANNEL_SRCS} ${${MODULE_PREFIX}_SRCS} +) if(OPENSSL_FOUND) - winpr_include_directory_add(${OPENSSL_INCLUDE_DIR}) - winpr_library_add_private(${OPENSSL_LIBRARIES}) + winpr_include_directory_add(${OPENSSL_INCLUDE_DIR}) + winpr_library_add_private(${OPENSSL_LIBRARIES}) endif() if(MBEDTLS_FOUND) - winpr_include_directory_add(${MBEDTLS_INCLUDE_DIR}) - winpr_library_add_private(${MBEDTLS_LIBRARIES}) + winpr_include_directory_add(${MBEDTLS_INCLUDE_DIR}) + winpr_library_add_private(${MBEDTLS_LIBRARIES}) endif() if(WIN32) - winpr_library_add_public(ws2_32) + winpr_library_add_public(ws2_32) endif() if(BUILD_TESTING_INTERNAL OR BUILD_TESTING) - add_subdirectory(test) + add_subdirectory(test) endif() diff --git a/winpr/libwinpr/sspi/ModuleOptions.cmake b/winpr/libwinpr/sspi/ModuleOptions.cmake index b947e302b..d7684544e 100644 --- a/winpr/libwinpr/sspi/ModuleOptions.cmake +++ b/winpr/libwinpr/sspi/ModuleOptions.cmake @@ -1,4 +1,3 @@ - set(MINWIN_LAYER "0") set(MINWIN_GROUP "none") set(MINWIN_MAJOR_VERSION "0") @@ -6,4 +5,3 @@ set(MINWIN_MINOR_VERSION "0") set(MINWIN_SHORT_NAME "sspi") set(MINWIN_LONG_NAME "Security Support Provider Interface") set(MODULE_LIBRARY_NAME "${MINWIN_SHORT_NAME}") - diff --git a/winpr/libwinpr/sspi/test/CMakeLists.txt b/winpr/libwinpr/sspi/test/CMakeLists.txt index f01e0b71f..1f894aa17 100644 --- a/winpr/libwinpr/sspi/test/CMakeLists.txt +++ b/winpr/libwinpr/sspi/test/CMakeLists.txt @@ -1,4 +1,3 @@ - set(MODULE_NAME "TestSspi") set(MODULE_PREFIX "TEST_SSPI") @@ -7,24 +6,20 @@ disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR}) set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c) set(${MODULE_PREFIX}_TESTS - TestQuerySecurityPackageInfo.c - TestEnumerateSecurityPackages.c - TestInitializeSecurityContext.c - TestAcquireCredentialsHandle.c - TestCredSSP.c - #TestSchannel.c - TestNTLM.c) + TestQuerySecurityPackageInfo.c TestEnumerateSecurityPackages.c TestInitializeSecurityContext.c + TestAcquireCredentialsHandle.c TestCredSSP.c + #TestSchannel.c + TestNTLM.c +) -create_test_sourcelist(${MODULE_PREFIX}_SRCS - ${${MODULE_PREFIX}_DRIVER} - ${${MODULE_PREFIX}_TESTS}) +create_test_sourcelist(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_DRIVER} ${${MODULE_PREFIX}_TESTS}) include_directories(SYSTEM ${OPENSSL_INCLUDE_DIR}) add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) if(WIN32) - set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} secur32 crypt32) + set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} secur32 crypt32) endif() target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS} winpr) @@ -32,9 +27,8 @@ target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS} winpr) set_target_properties(${MODULE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TESTING_OUTPUT_DIRECTORY}") foreach(test ${${MODULE_PREFIX}_TESTS}) - get_filename_component(TestName ${test} NAME_WE) - add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) + get_filename_component(TestName ${test} NAME_WE) + add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) endforeach() set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR/Test") - diff --git a/winpr/libwinpr/sspicli/ModuleOptions.cmake b/winpr/libwinpr/sspicli/ModuleOptions.cmake index 3a356c74c..953a96cbd 100644 --- a/winpr/libwinpr/sspicli/ModuleOptions.cmake +++ b/winpr/libwinpr/sspicli/ModuleOptions.cmake @@ -1,4 +1,3 @@ - set(MINWIN_LAYER "0") set(MINWIN_GROUP "none") set(MINWIN_MAJOR_VERSION "0") @@ -6,4 +5,3 @@ set(MINWIN_MINOR_VERSION "0") set(MINWIN_SHORT_NAME "sspicli") set(MINWIN_LONG_NAME "Authentication Functions") set(MODULE_LIBRARY_NAME "${MINWIN_SHORT_NAME}") - diff --git a/winpr/libwinpr/synch/CMakeLists.txt b/winpr/libwinpr/synch/CMakeLists.txt index c6a7eb1ef..9c1609fc3 100644 --- a/winpr/libwinpr/synch/CMakeLists.txt +++ b/winpr/libwinpr/synch/CMakeLists.txt @@ -16,25 +16,26 @@ # limitations under the License. winpr_module_add( - address.c - barrier.c - critical.c - event.c - init.c - mutex.c - pollset.c - pollset.h - semaphore.c - sleep.c - synch.h - timer.c - wait.c) + address.c + barrier.c + critical.c + event.c + init.c + mutex.c + pollset.c + pollset.h + semaphore.c + sleep.c + synch.h + timer.c + wait.c +) if(FREEBSD) - winpr_include_directory_add(${EPOLLSHIM_INCLUDE_DIR}) - winpr_library_add_private(${EPOLLSHIM_LIBS}) + winpr_include_directory_add(${EPOLLSHIM_INCLUDE_DIR}) + winpr_library_add_private(${EPOLLSHIM_LIBS}) endif() if(BUILD_TESTING_INTERNAL OR BUILD_TESTING) - add_subdirectory(test) + add_subdirectory(test) endif() diff --git a/winpr/libwinpr/synch/ModuleOptions.cmake b/winpr/libwinpr/synch/ModuleOptions.cmake index 1aac06df5..87e1b2789 100644 --- a/winpr/libwinpr/synch/ModuleOptions.cmake +++ b/winpr/libwinpr/synch/ModuleOptions.cmake @@ -1,9 +1,9 @@ - set(MINWIN_LAYER "1") set(MINWIN_GROUP "core") set(MINWIN_MAJOR_VERSION "2") set(MINWIN_MINOR_VERSION "0") set(MINWIN_SHORT_NAME "synch") set(MINWIN_LONG_NAME "Synchronization Functions") -set(MODULE_LIBRARY_NAME "api-ms-win-${MINWIN_GROUP}-${MINWIN_SHORT_NAME}-l${MINWIN_LAYER}-${MINWIN_MAJOR_VERSION}-${MINWIN_MINOR_VERSION}") - +set(MODULE_LIBRARY_NAME + "api-ms-win-${MINWIN_GROUP}-${MINWIN_SHORT_NAME}-l${MINWIN_LAYER}-${MINWIN_MAJOR_VERSION}-${MINWIN_MINOR_VERSION}" +) diff --git a/winpr/libwinpr/synch/test/CMakeLists.txt b/winpr/libwinpr/synch/test/CMakeLists.txt index 02fe8887b..f0da185d5 100644 --- a/winpr/libwinpr/synch/test/CMakeLists.txt +++ b/winpr/libwinpr/synch/test/CMakeLists.txt @@ -1,4 +1,3 @@ - set(MODULE_NAME "TestSynch") set(MODULE_PREFIX "TEST_SYNCH") @@ -7,25 +6,24 @@ disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR}) set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c) set(${MODULE_PREFIX}_TESTS - TestSynchInit.c - TestSynchEvent.c - TestSynchMutex.c - TestSynchBarrier.c - TestSynchCritical.c - TestSynchSemaphore.c - TestSynchThread.c + TestSynchInit.c + TestSynchEvent.c + TestSynchMutex.c + TestSynchBarrier.c + TestSynchCritical.c + TestSynchSemaphore.c + TestSynchThread.c # TestSynchMultipleThreads.c - TestSynchTimerQueue.c - TestSynchWaitableTimer.c - TestSynchWaitableTimerAPC.c - TestSynchAPC.c) + TestSynchTimerQueue.c + TestSynchWaitableTimer.c + TestSynchWaitableTimerAPC.c + TestSynchAPC.c +) -create_test_sourcelist(${MODULE_PREFIX}_SRCS - ${${MODULE_PREFIX}_DRIVER} - ${${MODULE_PREFIX}_TESTS}) +create_test_sourcelist(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_DRIVER} ${${MODULE_PREFIX}_TESTS}) if(FREEBSD) - include_directories(SYSTEM ${EPOLLSHIM_INCLUDE_DIR}) + include_directories(SYSTEM ${EPOLLSHIM_INCLUDE_DIR}) endif() add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) @@ -35,9 +33,8 @@ target_link_libraries(${MODULE_NAME} winpr) set_target_properties(${MODULE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TESTING_OUTPUT_DIRECTORY}") foreach(test ${${MODULE_PREFIX}_TESTS}) - get_filename_component(TestName ${test} NAME_WE) - add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) + get_filename_component(TestName ${test} NAME_WE) + add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) endforeach() set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR/Test") - diff --git a/winpr/libwinpr/sysinfo/CMakeLists.txt b/winpr/libwinpr/sysinfo/CMakeLists.txt index 2b785fe39..5f4e98c27 100644 --- a/winpr/libwinpr/sysinfo/CMakeLists.txt +++ b/winpr/libwinpr/sysinfo/CMakeLists.txt @@ -16,16 +16,15 @@ # limitations under the License. if(ANDROID) - add_subdirectory(cpufeatures) + add_subdirectory(cpufeatures) endif() winpr_module_add(sysinfo.c) if((NOT WIN32) AND (NOT APPLE) AND (NOT ANDROID) AND (NOT OPENBSD)) - winpr_library_add_private(rt) + winpr_library_add_private(rt) endif() if(BUILD_TESTING_INTERNAL OR BUILD_TESTING) - add_subdirectory(test) + add_subdirectory(test) endif() - diff --git a/winpr/libwinpr/sysinfo/ModuleOptions.cmake b/winpr/libwinpr/sysinfo/ModuleOptions.cmake index 6a7ff02de..39fcc0e71 100644 --- a/winpr/libwinpr/sysinfo/ModuleOptions.cmake +++ b/winpr/libwinpr/sysinfo/ModuleOptions.cmake @@ -1,9 +1,9 @@ - set(MINWIN_LAYER "1") set(MINWIN_GROUP "core") set(MINWIN_MAJOR_VERSION "2") set(MINWIN_MINOR_VERSION "0") set(MINWIN_SHORT_NAME "sysinfo") set(MINWIN_LONG_NAME "System Information Functions") -set(MODULE_LIBRARY_NAME "api-ms-win-${MINWIN_GROUP}-${MINWIN_SHORT_NAME}-l${MINWIN_LAYER}-${MINWIN_MAJOR_VERSION}-${MINWIN_MINOR_VERSION}") - +set(MODULE_LIBRARY_NAME + "api-ms-win-${MINWIN_GROUP}-${MINWIN_SHORT_NAME}-l${MINWIN_LAYER}-${MINWIN_MAJOR_VERSION}-${MINWIN_MINOR_VERSION}" +) diff --git a/winpr/libwinpr/sysinfo/cpufeatures/CMakeLists.txt b/winpr/libwinpr/sysinfo/cpufeatures/CMakeLists.txt index f1b93df73..c84c274c0 100644 --- a/winpr/libwinpr/sysinfo/cpufeatures/CMakeLists.txt +++ b/winpr/libwinpr/sysinfo/cpufeatures/CMakeLists.txt @@ -17,4 +17,3 @@ # limitations under the License. winpr_module_add(cpu-features.c cpu-features.h) - diff --git a/winpr/libwinpr/sysinfo/test/CMakeLists.txt b/winpr/libwinpr/sysinfo/test/CMakeLists.txt index 67efcfb11..423e59bde 100644 --- a/winpr/libwinpr/sysinfo/test/CMakeLists.txt +++ b/winpr/libwinpr/sysinfo/test/CMakeLists.txt @@ -1,4 +1,3 @@ - set(MODULE_NAME "TestSysInfo") set(MODULE_PREFIX "TEST_SYSINFO") @@ -6,16 +5,11 @@ disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR}) set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c) -set(${MODULE_PREFIX}_TESTS - TestGetNativeSystemInfo.c - TestCPUFeatures.c - TestGetComputerName.c - TestSystemTime.c - TestLocalTime.c) +set(${MODULE_PREFIX}_TESTS TestGetNativeSystemInfo.c TestCPUFeatures.c TestGetComputerName.c TestSystemTime.c + TestLocalTime.c +) -create_test_sourcelist(${MODULE_PREFIX}_SRCS - ${${MODULE_PREFIX}_DRIVER} - ${${MODULE_PREFIX}_TESTS}) +create_test_sourcelist(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_DRIVER} ${${MODULE_PREFIX}_TESTS}) add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) @@ -24,9 +18,8 @@ target_link_libraries(${MODULE_NAME} winpr) set_target_properties(${MODULE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TESTING_OUTPUT_DIRECTORY}") foreach(test ${${MODULE_PREFIX}_TESTS}) - get_filename_component(TestName ${test} NAME_WE) - add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) + get_filename_component(TestName ${test} NAME_WE) + add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) endforeach() set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR/Test") - diff --git a/winpr/libwinpr/thread/CMakeLists.txt b/winpr/libwinpr/thread/CMakeLists.txt index 6431ae0c7..500bf2b87 100644 --- a/winpr/libwinpr/thread/CMakeLists.txt +++ b/winpr/libwinpr/thread/CMakeLists.txt @@ -16,15 +16,16 @@ # limitations under the License. winpr_module_add( - apc.h - apc.c - argv.c - process.c - processor.c - thread.c - thread.h - tls.c) + apc.h + apc.c + argv.c + process.c + processor.c + thread.c + thread.h + tls.c +) if(BUILD_TESTING_INTERNAL OR BUILD_TESTING) - add_subdirectory(test) + add_subdirectory(test) endif() diff --git a/winpr/libwinpr/thread/ModuleOptions.cmake b/winpr/libwinpr/thread/ModuleOptions.cmake index ae52dd9d0..1bbf6c8b4 100644 --- a/winpr/libwinpr/thread/ModuleOptions.cmake +++ b/winpr/libwinpr/thread/ModuleOptions.cmake @@ -1,9 +1,9 @@ - set(MINWIN_LAYER "1") set(MINWIN_GROUP "core") set(MINWIN_MAJOR_VERSION "1") set(MINWIN_MINOR_VERSION "1") set(MINWIN_SHORT_NAME "processthreads") set(MINWIN_LONG_NAME "Process and Thread Functions") -set(MODULE_LIBRARY_NAME "api-ms-win-${MINWIN_GROUP}-${MINWIN_SHORT_NAME}-l${MINWIN_LAYER}-${MINWIN_MAJOR_VERSION}-${MINWIN_MINOR_VERSION}") - +set(MODULE_LIBRARY_NAME + "api-ms-win-${MINWIN_GROUP}-${MINWIN_SHORT_NAME}-l${MINWIN_LAYER}-${MINWIN_MAJOR_VERSION}-${MINWIN_MINOR_VERSION}" +) diff --git a/winpr/libwinpr/thread/test/CMakeLists.txt b/winpr/libwinpr/thread/test/CMakeLists.txt index 548122bee..b65536d04 100644 --- a/winpr/libwinpr/thread/test/CMakeLists.txt +++ b/winpr/libwinpr/thread/test/CMakeLists.txt @@ -1,4 +1,3 @@ - set(MODULE_NAME "TestThread") set(MODULE_PREFIX "TEST_THREAD") @@ -6,14 +5,9 @@ disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR}) set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c) -set(${MODULE_PREFIX}_TESTS - TestThreadCommandLineToArgv.c - TestThreadCreateProcess.c - TestThreadExitThread.c) +set(${MODULE_PREFIX}_TESTS TestThreadCommandLineToArgv.c TestThreadCreateProcess.c TestThreadExitThread.c) -create_test_sourcelist(${MODULE_PREFIX}_SRCS - ${${MODULE_PREFIX}_DRIVER} - ${${MODULE_PREFIX}_TESTS}) +create_test_sourcelist(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_DRIVER} ${${MODULE_PREFIX}_TESTS}) add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) @@ -22,8 +16,8 @@ target_link_libraries(${MODULE_NAME} winpr) set_target_properties(${MODULE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TESTING_OUTPUT_DIRECTORY}") foreach(test ${${MODULE_PREFIX}_TESTS}) - get_filename_component(TestName ${test} NAME_WE) - add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) + get_filename_component(TestName ${test} NAME_WE) + add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) endforeach() set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR/Test") diff --git a/winpr/libwinpr/timezone/CMakeLists.txt b/winpr/libwinpr/timezone/CMakeLists.txt index a05ec028d..1689c76a6 100644 --- a/winpr/libwinpr/timezone/CMakeLists.txt +++ b/winpr/libwinpr/timezone/CMakeLists.txt @@ -16,56 +16,44 @@ # limitations under the License. option(WITH_TIMEZONE_COMPILED "Use compiled in timezone definitions" ON) -if (WITH_TIMEZONE_COMPILED) - winpr_definition_add(-DWITH_TIMEZONE_COMPILED) +if(WITH_TIMEZONE_COMPILED) + winpr_definition_add(-DWITH_TIMEZONE_COMPILED) endif() include(CMakeDependentOption) cmake_dependent_option(WITH_TIMEZONE_FROM_FILE "Use timezone definitions from JSON file" OFF WITH_WINPR_JSON OFF) -if (WITH_TIMEZONE_FROM_FILE) +if(WITH_TIMEZONE_FROM_FILE) - winpr_definition_add(-DWINPR_RESOURCE_ROOT="${WINPR_RESOURCE_ROOT}") - winpr_definition_add(-DWITH_TIMEZONE_FROM_FILE) + winpr_definition_add(-DWINPR_RESOURCE_ROOT="${WINPR_RESOURCE_ROOT}") + winpr_definition_add(-DWITH_TIMEZONE_FROM_FILE) - install(FILES TimeZoneNameMap.json DESTINATION ${WINPR_RESOURCE_ROOT}) + install(FILES TimeZoneNameMap.json DESTINATION ${WINPR_RESOURCE_ROOT}) endif() -set(SRCS - TimeZoneNameMapUtils.c - TimeZoneNameMap.h - timezone.c - ) -if (WITH_TIMEZONE_COMPILED) - list(APPEND SRCS - TimeZoneNameMap_static.h - ) +set(SRCS TimeZoneNameMapUtils.c TimeZoneNameMap.h timezone.c) +if(WITH_TIMEZONE_COMPILED) + list(APPEND SRCS TimeZoneNameMap_static.h) endif() -if (NOT WIN32) - list(APPEND SRCS - TimeZoneIanaAbbrevMap.c - TimeZoneIanaAbbrevMap.h - ) +if(NOT WIN32) + list(APPEND SRCS TimeZoneIanaAbbrevMap.c TimeZoneIanaAbbrevMap.h) endif() option(WITH_TIMEZONE_ICU "Use ICU for improved timezone mapping" OFF) -if (WITH_TIMEZONE_ICU) - find_package(ICU COMPONENTS i18n uc REQUIRED) - winpr_include_directory_add(${ICU_INCLUDE_DIRS}) - winpr_library_add_private(${ICU_LIBRARIES}) - winpr_definition_add(-DWITH_TIMEZONE_ICU) +if(WITH_TIMEZONE_ICU) + find_package(ICU COMPONENTS i18n uc REQUIRED) + winpr_include_directory_add(${ICU_INCLUDE_DIRS}) + winpr_library_add_private(${ICU_LIBRARIES}) + winpr_definition_add(-DWITH_TIMEZONE_ICU) else() - list(APPEND SRCS - WindowsZones.c - WindowsZones.h - ) + list(APPEND SRCS WindowsZones.c WindowsZones.h) endif() winpr_module_add(${SRCS}) -if (WIN32) - option(WITH_TIMEZONE_UPDATER "Build C# tzextract" OFF) - if (WITH_TIMEZONE_UPDATER) - add_subdirectory(utils) - endif() +if(WIN32) + option(WITH_TIMEZONE_UPDATER "Build C# tzextract" OFF) + if(WITH_TIMEZONE_UPDATER) + add_subdirectory(utils) + endif() endif() diff --git a/winpr/libwinpr/timezone/ModuleOptions.cmake b/winpr/libwinpr/timezone/ModuleOptions.cmake index 7f5df3830..b6f1aed2e 100644 --- a/winpr/libwinpr/timezone/ModuleOptions.cmake +++ b/winpr/libwinpr/timezone/ModuleOptions.cmake @@ -1,9 +1,9 @@ - set(MINWIN_LAYER "1") set(MINWIN_GROUP "core") set(MINWIN_MAJOR_VERSION "1") set(MINWIN_MINOR_VERSION "0") set(MINWIN_SHORT_NAME "timezone") set(MINWIN_LONG_NAME "Time Zone Functions") -set(MODULE_LIBRARY_NAME "api-ms-win-${MINWIN_GROUP}-${MINWIN_SHORT_NAME}-l${MINWIN_LAYER}-${MINWIN_MAJOR_VERSION}-${MINWIN_MINOR_VERSION}") - +set(MODULE_LIBRARY_NAME + "api-ms-win-${MINWIN_GROUP}-${MINWIN_SHORT_NAME}-l${MINWIN_LAYER}-${MINWIN_MAJOR_VERSION}-${MINWIN_MINOR_VERSION}" +) diff --git a/winpr/libwinpr/timezone/utils/CMakeLists.txt b/winpr/libwinpr/timezone/utils/CMakeLists.txt index cefda40e9..0edf04b13 100644 --- a/winpr/libwinpr/timezone/utils/CMakeLists.txt +++ b/winpr/libwinpr/timezone/utils/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.13) if(POLICY CMP0091) - cmake_policy(SET CMP0091 NEW) + cmake_policy(SET CMP0091 NEW) endif() project(tzextract VERSION 1.0.0 LANGUAGES CSharp) @@ -10,24 +10,22 @@ set(CMAKE_CSharp_FLAGS "/langversion:10") set(CMAKE_DOTNET_TARGET_FRAMEWORK "net6.0") set(CMAKE_DOTNET_SDK "Microsoft.NET.Sdk") -add_executable(${PROJECT_NAME} - tzextract.cs -) +add_executable(${PROJECT_NAME} tzextract.cs) set_property(TARGET ${PROJECT_NAME} PROPERTY WIN32_EXECUTABLE FALSE) -set_property(TARGET ${PROJECT_NAME} PROPERTY VS_DOTNET_REFERENCES - "System" - "System.Collections.Generic" - "System.IO" - "System.Net.Http" - "System.Linq" - "System.Threading" - "System.Threading.Tasks" - ) -install(TARGETS ${PROJECT_NAME} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBRARY_DIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBRARY_DIR} - RUNTIME DESTINATION ${CMAKE_INSTALL_BINARY_DIR} - INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDE_DIR} +set_property( + TARGET ${PROJECT_NAME} + PROPERTY VS_DOTNET_REFERENCES + "System" + "System.Collections.Generic" + "System.IO" + "System.Net.Http" + "System.Linq" + "System.Threading" + "System.Threading.Tasks" +) +install(TARGETS ${PROJECT_NAME} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBRARY_DIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBRARY_DIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINARY_DIR} INCLUDES + DESTINATION ${CMAKE_INSTALL_INCLUDE_DIR} ) diff --git a/winpr/libwinpr/utils/CMakeLists.txt b/winpr/libwinpr/utils/CMakeLists.txt index b838d76e0..f9761446a 100644 --- a/winpr/libwinpr/utils/CMakeLists.txt +++ b/winpr/libwinpr/utils/CMakeLists.txt @@ -21,226 +21,205 @@ include(CMakeDependentOption) winpr_include_directory_add(${CMAKE_CURRENT_SOURCE_DIR}) option(WITH_LODEPNG "build WinPR with PNG support" OFF) -if (WITH_LODEPNG) - find_package(lodepng REQUIRED) +if(WITH_LODEPNG) + find_package(lodepng REQUIRED) - winpr_definition_add(-DWITH_LODEPNG) - set(WINPR_WITH_PNG ON CACHE BOOL "build cache") + winpr_definition_add(-DWITH_LODEPNG) + set(WINPR_WITH_PNG ON CACHE BOOL "build cache") - winpr_include_directory_add(${lodepng_INCLUDE_DIRS}) - winpr_library_add_private(${lodepng_LIBRARIES}) + winpr_include_directory_add(${lodepng_INCLUDE_DIRS}) + winpr_library_add_private(${lodepng_LIBRARIES}) endif() option(WINPR_UTILS_IMAGE_PNG "Add PNG <--> BMP conversion support to clipboard" OFF) -if (WINPR_UTILS_IMAGE_PNG) - find_package(PNG REQUIRED) +if(WINPR_UTILS_IMAGE_PNG) + find_package(PNG REQUIRED) - set(WINPR_WITH_PNG ON CACHE BOOL "build cache") - winpr_include_directory_add(${PNG_INCLUDE_DIRS}) - winpr_library_add_private(${PNG_LIBRARIES}) + set(WINPR_WITH_PNG ON CACHE BOOL "build cache") + winpr_include_directory_add(${PNG_INCLUDE_DIRS}) + winpr_library_add_private(${PNG_LIBRARIES}) endif() option(WINPR_UTILS_IMAGE_WEBP "Add WebP <--> BMP conversion support to clipboard" OFF) -if (WINPR_UTILS_IMAGE_WEBP) - find_package(PkgConfig REQUIRED) - pkg_check_modules(WEBP libwebp REQUIRED) +if(WINPR_UTILS_IMAGE_WEBP) + find_package(PkgConfig REQUIRED) + pkg_check_modules(WEBP libwebp REQUIRED) - winpr_include_directory_add(${WEBP_INCLUDE_DIRS}) - winpr_library_add_private(${WEBP_LIBRARIES}) + winpr_include_directory_add(${WEBP_INCLUDE_DIRS}) + winpr_library_add_private(${WEBP_LIBRARIES}) endif() option(WINPR_UTILS_IMAGE_JPEG "Add Jpeg <--> BMP conversion support to clipboard" OFF) -if (WINPR_UTILS_IMAGE_JPEG) - find_package(PkgConfig REQUIRED) - pkg_check_modules(JPEG libjpeg REQUIRED) +if(WINPR_UTILS_IMAGE_JPEG) + find_package(PkgConfig REQUIRED) + pkg_check_modules(JPEG libjpeg REQUIRED) - winpr_include_directory_add(${JPEG_INCLUDE_DIRS}) - winpr_library_add_private(${JPEG_LIBRARIES}) + winpr_include_directory_add(${JPEG_INCLUDE_DIRS}) + winpr_library_add_private(${JPEG_LIBRARIES}) endif() - set(COLLECTIONS_SRCS - collections/Object.c - collections/Queue.c - collections/Stack.c - collections/PubSub.c - collections/BitStream.c - collections/ArrayList.c - collections/LinkedList.c - collections/HashTable.c - collections/ListDictionary.c - collections/CountdownEvent.c - collections/BufferPool.c - collections/ObjectPool.c - collections/StreamPool.c - collections/MessageQueue.c - collections/MessagePipe.c) + collections/Object.c + collections/Queue.c + collections/Stack.c + collections/PubSub.c + collections/BitStream.c + collections/ArrayList.c + collections/LinkedList.c + collections/HashTable.c + collections/ListDictionary.c + collections/CountdownEvent.c + collections/BufferPool.c + collections/ObjectPool.c + collections/StreamPool.c + collections/MessageQueue.c + collections/MessagePipe.c +) -if (WINPR_HAVE_SYSLOG_H) - set(SYSLOG_SRCS - wlog/SyslogAppender.c - wlog/SyslogAppender.h - ) +if(WINPR_HAVE_SYSLOG_H) + set(SYSLOG_SRCS wlog/SyslogAppender.c wlog/SyslogAppender.h) endif() find_package(libsystemd) option(WITH_SYSTEMD "allows to export wLog to systemd journal" ${libsystemd_FOUND}) if(WITH_LIBSYSTEMD) - find_package(libsystemd REQUIRED) - set(WINPR_HAVE_JOURNALD_H TRUE) - set(JOURNALD_SRCS - wlog/JournaldAppender.c - wlog/JournaldAppender.h - ) - winpr_include_directory_add(${LIBSYSTEMD_INCLUDE_DIR}) - winpr_library_add_private(${LIBSYSTEMD_LIBRARY}) + find_package(libsystemd REQUIRED) + set(WINPR_HAVE_JOURNALD_H TRUE) + set(JOURNALD_SRCS wlog/JournaldAppender.c wlog/JournaldAppender.h) + winpr_include_directory_add(${LIBSYSTEMD_INCLUDE_DIR}) + winpr_library_add_private(${LIBSYSTEMD_LIBRARY}) else() - unset(WINPR_HAVE_JOURNALD_H) + unset(WINPR_HAVE_JOURNALD_H) endif() set(WLOG_SRCS - wlog/wlog.c - wlog/wlog.h - wlog/Layout.c - wlog/Layout.h - wlog/Message.c - wlog/Message.h - wlog/DataMessage.c - wlog/DataMessage.h - wlog/ImageMessage.c - wlog/ImageMessage.h - wlog/PacketMessage.c - wlog/PacketMessage.h - wlog/Appender.c - wlog/Appender.h - wlog/FileAppender.c - wlog/FileAppender.h - wlog/BinaryAppender.c - wlog/BinaryAppender.h - wlog/CallbackAppender.c - wlog/CallbackAppender.h - wlog/ConsoleAppender.c - wlog/ConsoleAppender.h - wlog/UdpAppender.c - wlog/UdpAppender.h - ${SYSLOG_SRCS} - ${JOURNALD_SRCS} - ) - -set(ASN1_SRCS - asn1/asn1.c + wlog/wlog.c + wlog/wlog.h + wlog/Layout.c + wlog/Layout.h + wlog/Message.c + wlog/Message.h + wlog/DataMessage.c + wlog/DataMessage.h + wlog/ImageMessage.c + wlog/ImageMessage.h + wlog/PacketMessage.c + wlog/PacketMessage.h + wlog/Appender.c + wlog/Appender.h + wlog/FileAppender.c + wlog/FileAppender.h + wlog/BinaryAppender.c + wlog/BinaryAppender.h + wlog/CallbackAppender.c + wlog/CallbackAppender.h + wlog/ConsoleAppender.c + wlog/ConsoleAppender.h + wlog/UdpAppender.c + wlog/UdpAppender.h + ${SYSLOG_SRCS} + ${JOURNALD_SRCS} ) +set(ASN1_SRCS asn1/asn1.c) + set(SRCS - ini.c - sam.c - ntlm.c - image.c - print.c - stream.h - stream.c - strlst.c - debug.c - winpr.c - cmdline.c - ssl.c) + ini.c + sam.c + ntlm.c + image.c + print.c + stream.h + stream.c + strlst.c + debug.c + winpr.c + cmdline.c + ssl.c +) -if (ANDROID) - list(APPEND SRCS android.h android.c) - include_directories(${CMAKE_CURRENT_SOURCE_DIR}) - if (NOT WINPR_HAVE_UNWIND_H) - message("[backtrace] android NDK without unwind.h, falling back to corkscrew") - set(WINPR_HAVE_CORKSCREW 1) - endif() +if(ANDROID) + list(APPEND SRCS android.h android.c) + include_directories(${CMAKE_CURRENT_SOURCE_DIR}) + if(NOT WINPR_HAVE_UNWIND_H) + message("[backtrace] android NDK without unwind.h, falling back to corkscrew") + set(WINPR_HAVE_CORKSCREW 1) + endif() endif() -if (WINPR_HAVE_CORKSCREW) - list(APPEND SRCS - corkscrew/debug.c - corkscrew/debug.h) +if(WINPR_HAVE_CORKSCREW) + list(APPEND SRCS corkscrew/debug.c corkscrew/debug.h) endif() -if (WIN32) - list(APPEND SRCS - windows/debug.c - windows/debug.h) +if(WIN32) + list(APPEND SRCS windows/debug.c windows/debug.h) endif() -if (WINPR_HAVE_EXECINFO_H) - option(USE_EXECINFO "Use execinfo.h to generate backtraces" ON) - if (USE_EXECINFO) - winpr_definition_add(-DUSE_EXECINFO) - list(APPEND SRCS - execinfo/debug.c - execinfo/debug.h) - endif() +if(WINPR_HAVE_EXECINFO_H) + option(USE_EXECINFO "Use execinfo.h to generate backtraces" ON) + if(USE_EXECINFO) + winpr_definition_add(-DUSE_EXECINFO) + list(APPEND SRCS execinfo/debug.c execinfo/debug.h) + endif() endif() -if (WINPR_HAVE_UNWIND_H) - option(USE_UNWIND "Use unwind.h to generate backtraces" ON) - if (USE_UNWIND) - winpr_definition_add(-DUSE_UNWIND) - list(APPEND SRCS - unwind/debug.c - unwind/debug.h) - endif() +if(WINPR_HAVE_UNWIND_H) + option(USE_UNWIND "Use unwind.h to generate backtraces" ON) + if(USE_UNWIND) + winpr_definition_add(-DUSE_UNWIND) + list(APPEND SRCS unwind/debug.c unwind/debug.h) + endif() endif() include(JsonDetect) -if (NOT WITH_JSON_DISABLED) - if (JSONC_FOUND AND NOT WITH_CJSON_REQUIRED) - winpr_library_add_private(${JSONC_LIBRARIES}) - winpr_include_directory_add(${JSONC_INCLUDE_DIRS}) - winpr_definition_add(-DWITH_JSONC) - set(WITH_WINPR_JSON ON CACHE INTERNAL "internal") - elseif (CJSON_FOUND) - winpr_library_add_private(${CJSON_LIBRARIES}) - winpr_include_directory_add(${CJSON_INCLUDE_DIRS}) - winpr_definition_add(-DWITH_CJSON) - set(WITH_WINPR_JSON ON CACHE INTERNAL "internal") - endif() +if(NOT WITH_JSON_DISABLED) + if(JSONC_FOUND AND NOT WITH_CJSON_REQUIRED) + winpr_library_add_private(${JSONC_LIBRARIES}) + winpr_include_directory_add(${JSONC_INCLUDE_DIRS}) + winpr_definition_add(-DWITH_JSONC) + set(WITH_WINPR_JSON ON CACHE INTERNAL "internal") + elseif(CJSON_FOUND) + winpr_library_add_private(${CJSON_LIBRARIES}) + winpr_include_directory_add(${CJSON_INCLUDE_DIRS}) + winpr_definition_add(-DWITH_CJSON) + set(WITH_WINPR_JSON ON CACHE INTERNAL "internal") + endif() endif() winpr_module_add(json/json.c) -winpr_module_add(${SRCS} - ${COLLECTIONS_SRCS} - ${WLOG_SRCS} - ${ASN1_SRCS} -) +winpr_module_add(${SRCS} ${COLLECTIONS_SRCS} ${WLOG_SRCS} ${ASN1_SRCS}) -winpr_include_directory_add( - "." -) +winpr_include_directory_add(".") if(OPENSSL_FOUND) - winpr_include_directory_add(${OPENSSL_INCLUDE_DIR}) - winpr_library_add_private(${OPENSSL_LIBRARIES}) + winpr_include_directory_add(${OPENSSL_INCLUDE_DIR}) + winpr_library_add_private(${OPENSSL_LIBRARIES}) endif() if(MBEDTLS_FOUND) - winpr_include_directory_add(${MBEDTLS_INCLUDE_DIR}) - winpr_library_add_private(${MBEDTLS_LIBRARIES}) + winpr_include_directory_add(${MBEDTLS_INCLUDE_DIR}) + winpr_library_add_private(${MBEDTLS_LIBRARIES}) endif() if(UNIX) - winpr_library_add_private(m) + winpr_library_add_private(m) - set(CMAKE_REQUIRED_INCLUDES backtrace.h) - check_function_exists(backtrace BACKTRACE) - if (NOT BACKTRACE) - set(CMAKE_REQUIRED_LIBRARIES execinfo) - check_function_exists(backtrace EXECINFO) - if (EXECINFO) - winpr_library_add_private(execinfo) - endif() - endif() + set(CMAKE_REQUIRED_INCLUDES backtrace.h) + check_function_exists(backtrace BACKTRACE) + if(NOT BACKTRACE) + set(CMAKE_REQUIRED_LIBRARIES execinfo) + check_function_exists(backtrace EXECINFO) + if(EXECINFO) + winpr_library_add_private(execinfo) + endif() + endif() endif() if(WIN32) - winpr_library_add_public(dbghelp) + winpr_library_add_public(dbghelp) endif() if(BUILD_TESTING_INTERNAL OR BUILD_TESTING) - add_subdirectory(test) + add_subdirectory(test) endif() diff --git a/winpr/libwinpr/utils/ModuleOptions.cmake b/winpr/libwinpr/utils/ModuleOptions.cmake index 9e37ca69e..cc0d0ed44 100644 --- a/winpr/libwinpr/utils/ModuleOptions.cmake +++ b/winpr/libwinpr/utils/ModuleOptions.cmake @@ -1,4 +1,3 @@ - set(MINWIN_LAYER "0") set(MINWIN_GROUP "none") set(MINWIN_MAJOR_VERSION "0") @@ -6,4 +5,3 @@ set(MINWIN_MINOR_VERSION "0") set(MINWIN_SHORT_NAME "utils") set(MINWIN_LONG_NAME "WinPR Utils") set(MODULE_LIBRARY_NAME "${MINWIN_SHORT_NAME}") - diff --git a/winpr/libwinpr/utils/test/CMakeLists.txt b/winpr/libwinpr/utils/test/CMakeLists.txt index a5101b7be..acabe5c33 100644 --- a/winpr/libwinpr/utils/test/CMakeLists.txt +++ b/winpr/libwinpr/utils/test/CMakeLists.txt @@ -1,4 +1,3 @@ - set(MODULE_NAME "TestWinPRUtils") set(MODULE_PREFIX "TEST_WINPR_UTILS") @@ -7,37 +6,34 @@ disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR}) set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c) set(${MODULE_PREFIX}_TESTS - TestIni.c - TestVersion.c - TestImage.c - TestBacktrace.c - TestQueue.c - TestPrint.c - TestPubSub.c - TestStream.c - TestBitStream.c - TestArrayList.c - TestLinkedList.c - TestListDictionary.c - TestCmdLine.c - TestASN1.c - TestWLog.c - TestWLogCallback.c - TestHashTable.c - TestBufferPool.c - TestStreamPool.c - TestMessageQueue.c - TestMessagePipe.c) + TestIni.c + TestVersion.c + TestImage.c + TestBacktrace.c + TestQueue.c + TestPrint.c + TestPubSub.c + TestStream.c + TestBitStream.c + TestArrayList.c + TestLinkedList.c + TestListDictionary.c + TestCmdLine.c + TestASN1.c + TestWLog.c + TestWLogCallback.c + TestHashTable.c + TestBufferPool.c + TestStreamPool.c + TestMessageQueue.c + TestMessagePipe.c +) -if (WITH_LODEPNG) - list(APPEND ${MODULES_PREFIX}_TESTS - TestImage.c - ) +if(WITH_LODEPNG) + list(APPEND ${MODULES_PREFIX}_TESTS TestImage.c) endif() -create_test_sourcelist(${MODULE_PREFIX}_SRCS - ${${MODULE_PREFIX}_DRIVER} - ${${MODULE_PREFIX}_TESTS}) +create_test_sourcelist(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_DRIVER} ${${MODULE_PREFIX}_TESTS}) add_definitions(-DTEST_SOURCE_PATH="${CMAKE_CURRENT_SOURCE_DIR}") add_definitions(-DTEST_BINARY_PATH="${CMAKE_CURRENT_BINARY_DIR}") @@ -49,9 +45,8 @@ target_link_libraries(${MODULE_NAME} winpr) set_target_properties(${MODULE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TESTING_OUTPUT_DIRECTORY}") foreach(test ${${MODULE_PREFIX}_TESTS}) - get_filename_component(TestName ${test} NAME_WE) - add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) + get_filename_component(TestName ${test} NAME_WE) + add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) endforeach() set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR/Test") - diff --git a/winpr/libwinpr/winsock/CMakeLists.txt b/winpr/libwinpr/winsock/CMakeLists.txt index ef13cd1d1..8cc0c5e2a 100644 --- a/winpr/libwinpr/winsock/CMakeLists.txt +++ b/winpr/libwinpr/winsock/CMakeLists.txt @@ -18,5 +18,5 @@ winpr_module_add(winsock.c) if(WIN32) - winpr_library_add_public(ws2_32) + winpr_library_add_public(ws2_32) endif() diff --git a/winpr/libwinpr/winsock/ModuleOptions.cmake b/winpr/libwinpr/winsock/ModuleOptions.cmake index af49b6e84..1aaeb3cea 100644 --- a/winpr/libwinpr/winsock/ModuleOptions.cmake +++ b/winpr/libwinpr/winsock/ModuleOptions.cmake @@ -1,4 +1,3 @@ - set(MINWIN_LAYER "0") set(MINWIN_GROUP "none") set(MINWIN_MAJOR_VERSION "0") diff --git a/winpr/libwinpr/wtsapi/CMakeLists.txt b/winpr/libwinpr/wtsapi/CMakeLists.txt index e49f93f4c..3669221b1 100644 --- a/winpr/libwinpr/wtsapi/CMakeLists.txt +++ b/winpr/libwinpr/wtsapi/CMakeLists.txt @@ -18,13 +18,13 @@ winpr_module_add(wtsapi.c) if(WIN32) - winpr_module_add(wtsapi_win32.c wtsapi_win32.h) + winpr_module_add(wtsapi_win32.c wtsapi_win32.h) - if (MINGW) - winpr_library_add_private(ntdll.lib) # Only required with MINGW - endif() + if(MINGW) + winpr_library_add_private(ntdll.lib) # Only required with MINGW + endif() endif() if(BUILD_TESTING_INTERNAL OR BUILD_TESTING) - add_subdirectory(test) + add_subdirectory(test) endif() diff --git a/winpr/libwinpr/wtsapi/ModuleOptions.cmake b/winpr/libwinpr/wtsapi/ModuleOptions.cmake index 0575367f2..7f1dcad64 100644 --- a/winpr/libwinpr/wtsapi/ModuleOptions.cmake +++ b/winpr/libwinpr/wtsapi/ModuleOptions.cmake @@ -1,9 +1,9 @@ - set(MINWIN_LAYER "0") set(MINWIN_GROUP "none") set(MINWIN_MAJOR_VERSION "0") set(MINWIN_MINOR_VERSION "0") set(MINWIN_SHORT_NAME "wtsapi") set(MINWIN_LONG_NAME "Windows Terminal Services API") -set(MODULE_LIBRARY_NAME "api-ms-win-${MINWIN_GROUP}-${MINWIN_SHORT_NAME}-l${MINWIN_LAYER}-${MINWIN_MAJOR_VERSION}-${MINWIN_MINOR_VERSION}") - +set(MODULE_LIBRARY_NAME + "api-ms-win-${MINWIN_GROUP}-${MINWIN_SHORT_NAME}-l${MINWIN_LAYER}-${MINWIN_MAJOR_VERSION}-${MINWIN_MINOR_VERSION}" +) diff --git a/winpr/libwinpr/wtsapi/test/CMakeLists.txt b/winpr/libwinpr/wtsapi/test/CMakeLists.txt index 59ceefcf5..dc50f3c15 100644 --- a/winpr/libwinpr/wtsapi/test/CMakeLists.txt +++ b/winpr/libwinpr/wtsapi/test/CMakeLists.txt @@ -1,4 +1,3 @@ - set(MODULE_NAME "TestWtsApi") set(MODULE_PREFIX "TEST_WTSAPI") @@ -6,71 +5,56 @@ disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR}) set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c) -set(UNIX_ONLY - TestWtsApiShutdownSystem.c - TestWtsApiWaitSystemEvent.c - ) +set(UNIX_ONLY TestWtsApiShutdownSystem.c TestWtsApiWaitSystemEvent.c) -set(${MODULE_PREFIX}_TESTS - TestWtsApiEnumerateProcesses.c - TestWtsApiEnumerateSessions.c - TestWtsApiQuerySessionInformation.c - TestWtsApiSessionNotification.c - ) +set(${MODULE_PREFIX}_TESTS TestWtsApiEnumerateProcesses.c TestWtsApiEnumerateSessions.c + TestWtsApiQuerySessionInformation.c TestWtsApiSessionNotification.c +) if(NOT WIN32) - set(${MODULE_PREFIX}_TESTS ${${MODULE_PREFIX}_TESTS} ${UNIX_ONLY}) + set(${MODULE_PREFIX}_TESTS ${${MODULE_PREFIX}_TESTS} ${UNIX_ONLY}) endif() -create_test_sourcelist(${MODULE_PREFIX}_SRCS - ${${MODULE_PREFIX}_DRIVER} - ${${MODULE_PREFIX}_TESTS}) +create_test_sourcelist(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_DRIVER} ${${MODULE_PREFIX}_TESTS}) add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) - target_link_libraries(${MODULE_NAME} winpr) set_target_properties(${MODULE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TESTING_OUTPUT_DIRECTORY}") foreach(test ${${MODULE_PREFIX}_TESTS}) - get_filename_component(TestName ${test} NAME_WE) - add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) + get_filename_component(TestName ${test} NAME_WE) + add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) endforeach() set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR/Test") if(TESTS_WTSAPI_EXTRA) -set(MODULE_NAME "TestWtsApiExtra") -set(MODULE_PREFIX "TEST_WTSAPI_EXTRA") + set(MODULE_NAME "TestWtsApiExtra") + set(MODULE_PREFIX "TEST_WTSAPI_EXTRA") -set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c) + set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c) -set(${MODULE_PREFIX}_TESTS - TestWtsApiExtraDisconnectSession.c - TestWtsApiExtraDynamicVirtualChannel.c - TestWtsApiExtraLogoffSession.c - TestWtsApiExtraSendMessage.c - TestWtsApiExtraVirtualChannel.c - TestWtsApiExtraStartRemoteSessionEx.c - ) + set(${MODULE_PREFIX}_TESTS + TestWtsApiExtraDisconnectSession.c TestWtsApiExtraDynamicVirtualChannel.c TestWtsApiExtraLogoffSession.c + TestWtsApiExtraSendMessage.c TestWtsApiExtraVirtualChannel.c TestWtsApiExtraStartRemoteSessionEx.c + ) -create_test_sourcelist(${MODULE_PREFIX}_SRCS - ${${MODULE_PREFIX}_DRIVER} - ${${MODULE_PREFIX}_TESTS}) + create_test_sourcelist(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_DRIVER} ${${MODULE_PREFIX}_TESTS}) -add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) + add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) -target_link_libraries(${MODULE_NAME} winpr) + target_link_libraries(${MODULE_NAME} winpr) -set_target_properties(${MODULE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TESTING_OUTPUT_DIRECTORY}") + set_target_properties(${MODULE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TESTING_OUTPUT_DIRECTORY}") -foreach(test ${${MODULE_PREFIX}_TESTS}) - get_filename_component(TestName ${test} NAME_WE) - add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) - set_tests_properties(${TestName} PROPERTIES LABELS "WTSAPI_EXTRA") -endforeach() + foreach(test ${${MODULE_PREFIX}_TESTS}) + get_filename_component(TestName ${test} NAME_WE) + add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) + set_tests_properties(${TestName} PROPERTIES LABELS "WTSAPI_EXTRA") + endforeach() -set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR/Test") + set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR/Test") endif() diff --git a/winpr/test/CMakeLists.txt b/winpr/test/CMakeLists.txt index 297b7dc2a..bef2fb7cc 100644 --- a/winpr/test/CMakeLists.txt +++ b/winpr/test/CMakeLists.txt @@ -1,4 +1,3 @@ - set(MODULE_NAME "TestWinPR") set(MODULE_PREFIX "TEST_WINPR") @@ -8,9 +7,7 @@ set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c) set(${MODULE_PREFIX}_TESTS TestIntrinsics.c TestTypes.c) -create_test_sourcelist(${MODULE_PREFIX}_SRCS - ${${MODULE_PREFIX}_DRIVER} - ${${MODULE_PREFIX}_TESTS}) +create_test_sourcelist(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_DRIVER} ${${MODULE_PREFIX}_TESTS}) add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) @@ -19,8 +16,8 @@ target_link_libraries(${MODULE_NAME} winpr) set_target_properties(${MODULE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TESTING_OUTPUT_DIRECTORY}") foreach(test ${${MODULE_PREFIX}_TESTS}) - get_filename_component(TestName ${test} NAME_WE) - add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) + get_filename_component(TestName ${test} NAME_WE) + add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) endforeach() set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR/Test") diff --git a/winpr/tools/CMakeLists.txt b/winpr/tools/CMakeLists.txt index dda87e7b4..144cec86c 100644 --- a/winpr/tools/CMakeLists.txt +++ b/winpr/tools/CMakeLists.txt @@ -32,50 +32,50 @@ set(WINPR_TOOLS_LIBS "") set(WINPR_TOOLS_INCLUDES "") set(WINPR_TOOLS_DEFINITIONS "") -macro (winpr_tools_module_add) - file (RELATIVE_PATH _relPath "${WINPR_TOOLS_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}") - foreach (_src ${ARGN}) - if (_relPath) - list (APPEND WINPR_TOOLS_SRCS "${_relPath}/${_src}") - else() - list (APPEND WINPR_TOOLS_SRCS "${_src}") - endif() - endforeach() - if (_relPath) - set (WINPR_TOOLS_SRCS ${WINPR_TOOLS_SRCS} PARENT_SCOPE) +macro(winpr_tools_module_add) + file(RELATIVE_PATH _relPath "${WINPR_TOOLS_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}") + foreach(_src ${ARGN}) + if(_relPath) + list(APPEND WINPR_TOOLS_SRCS "${_relPath}/${_src}") + else() + list(APPEND WINPR_TOOLS_SRCS "${_src}") endif() + endforeach() + if(_relPath) + set(WINPR_TOOLS_SRCS ${WINPR_TOOLS_SRCS} PARENT_SCOPE) + endif() endmacro() -macro (winpr_tools_include_directory_add) - file (RELATIVE_PATH _relPath "${WINPR_TOOLS_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}") - foreach (_inc ${ARGN}) - if (IS_ABSOLUTE ${_inc}) - list (APPEND WINPR_TOOLS_INCLUDES "${_inc}") - else() - if (_relPath) - list (APPEND WINPR_TOOLS_INCLUDES "${_relPath}/${_inc}") - else() - list (APPEND WINPR_TOOLS_INCLUDES "${_inc}") - endif() - endif() - endforeach() - if (_relPath) - set (WINPR_TOOLS_INCLUDES ${WINPR_TOOLS_INCLUDES} PARENT_SCOPE) +macro(winpr_tools_include_directory_add) + file(RELATIVE_PATH _relPath "${WINPR_TOOLS_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}") + foreach(_inc ${ARGN}) + if(IS_ABSOLUTE ${_inc}) + list(APPEND WINPR_TOOLS_INCLUDES "${_inc}") + else() + if(_relPath) + list(APPEND WINPR_TOOLS_INCLUDES "${_relPath}/${_inc}") + else() + list(APPEND WINPR_TOOLS_INCLUDES "${_inc}") + endif() endif() + endforeach() + if(_relPath) + set(WINPR_TOOLS_INCLUDES ${WINPR_TOOLS_INCLUDES} PARENT_SCOPE) + endif() endmacro() -macro (winpr_tools_library_add) - foreach (_lib ${ARGN}) - list (APPEND WINPR_TOOLS_LIBS "${_lib}") - endforeach() - set (WINPR_TOOLS_LIBS ${WINPR_TOOLS_LIBS} PARENT_SCOPE) +macro(winpr_tools_library_add) + foreach(_lib ${ARGN}) + list(APPEND WINPR_TOOLS_LIBS "${_lib}") + endforeach() + set(WINPR_TOOLS_LIBS ${WINPR_TOOLS_LIBS} PARENT_SCOPE) endmacro() -macro (winpr_tools_definition_add) - foreach (_define ${ARGN}) - list (APPEND WINPR_TOOLS_DEFINITONS "${_define}") - endforeach() - set (WINPR_TOOLS_DEFINITONS ${WINPR_TOOLS_DEFINITONS} PARENT_SCOPE) +macro(winpr_tools_definition_add) + foreach(_define ${ARGN}) + list(APPEND WINPR_TOOLS_DEFINITONS "${_define}") + endforeach() + set(WINPR_TOOLS_DEFINITONS ${WINPR_TOOLS_DEFINITONS} PARENT_SCOPE) endmacro() add_subdirectory(makecert) @@ -85,16 +85,15 @@ list(REMOVE_DUPLICATES WINPR_TOOLS_DEFINITIONS) list(REMOVE_DUPLICATES WINPR_TOOLS_INCLUDES) include_directories(${WINPR_TOOLS_INCLUDES}) -AddTargetWithResourceFile(${MODULE_NAME} FALSE "${WINPR_VERSION}" WINPR_TOOLS_SRCS) +addtargetwithresourcefile(${MODULE_NAME} FALSE "${WINPR_VERSION}" WINPR_TOOLS_SRCS) add_definitions(${WINPR_DEFINITIONS}) target_include_directories(${MODULE_NAME} INTERFACE $) target_link_libraries(${MODULE_NAME} PRIVATE ${WINPR_TOOLS_LIBS}) -install(TARGETS ${MODULE_NAME} COMPONENT libraries EXPORT WinPR-toolsTargets - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) +install(TARGETS ${MODULE_NAME} COMPONENT libraries EXPORT WinPR-toolsTargets ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +) set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR/Tools") @@ -103,21 +102,29 @@ add_subdirectory(makecert-cli) add_subdirectory(hash-cli) include(pkg-config-install-prefix) -cleaning_configure_file(${CMAKE_CURRENT_SOURCE_DIR}/winpr-tools.pc.in ${CMAKE_CURRENT_BINARY_DIR}/winpr-tools${WINPR_TOOLS_VERSION_MAJOR}.pc @ONLY) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/winpr-tools${WINPR_TOOLS_VERSION_MAJOR}.pc DESTINATION ${PKG_CONFIG_PC_INSTALL_DIR}) +cleaning_configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/winpr-tools.pc.in ${CMAKE_CURRENT_BINARY_DIR}/winpr-tools${WINPR_TOOLS_VERSION_MAJOR}.pc + @ONLY +) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/winpr-tools${WINPR_TOOLS_VERSION_MAJOR}.pc + DESTINATION ${PKG_CONFIG_PC_INSTALL_DIR} +) export(PACKAGE ${MODULE_NAME}) -SetFreeRDPCMakeInstallDir(WINPR_CMAKE_INSTALL_DIR "WinPR-tools${WINPR_VERSION_MAJOR}") +setfreerdpcmakeinstalldir(WINPR_CMAKE_INSTALL_DIR "WinPR-tools${WINPR_VERSION_MAJOR}") -configure_package_config_file(WinPR-toolsConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/WinPR-toolsConfig.cmake - INSTALL_DESTINATION ${WINPR_CMAKE_INSTALL_DIR} - PATH_VARS WINPR_INCLUDE_DIR) +configure_package_config_file( + WinPR-toolsConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/WinPR-toolsConfig.cmake + INSTALL_DESTINATION ${WINPR_CMAKE_INSTALL_DIR} PATH_VARS WINPR_INCLUDE_DIR +) -write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/WinPR-toolsConfigVersion.cmake - VERSION ${WINPR_VERSION} COMPATIBILITY SameMajorVersion) +write_basic_package_version_file( + ${CMAKE_CURRENT_BINARY_DIR}/WinPR-toolsConfigVersion.cmake VERSION ${WINPR_VERSION} COMPATIBILITY SameMajorVersion +) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/WinPR-toolsConfig.cmake ${CMAKE_CURRENT_BINARY_DIR}/WinPR-toolsConfigVersion.cmake - DESTINATION ${WINPR_CMAKE_INSTALL_DIR}) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/WinPR-toolsConfig.cmake + ${CMAKE_CURRENT_BINARY_DIR}/WinPR-toolsConfigVersion.cmake DESTINATION ${WINPR_CMAKE_INSTALL_DIR} +) install(EXPORT WinPR-toolsTargets DESTINATION ${WINPR_CMAKE_INSTALL_DIR}) diff --git a/winpr/tools/hash-cli/CMakeLists.txt b/winpr/tools/hash-cli/CMakeLists.txt index 8eb9e6692..025963127 100644 --- a/winpr/tools/hash-cli/CMakeLists.txt +++ b/winpr/tools/hash-cli/CMakeLists.txt @@ -18,10 +18,9 @@ set(MODULE_NAME "winpr-hash") set(MODULE_PREFIX "WINPR_TOOLS_HASH") -set(${MODULE_PREFIX}_SRCS - hash.c) +set(${MODULE_PREFIX}_SRCS hash.c) -AddTargetWithResourceFile(${MODULE_NAME} TRUE "${WINPR_VERSION}" ${MODULE_PREFIX}_SRCS) +addtargetwithresourcefile(${MODULE_NAME} TRUE "${WINPR_VERSION}" ${MODULE_PREFIX}_SRCS) set(${MODULE_PREFIX}_LIBS winpr) diff --git a/winpr/tools/makecert-cli/CMakeLists.txt b/winpr/tools/makecert-cli/CMakeLists.txt index fe9c6f735..ad9e3807b 100644 --- a/winpr/tools/makecert-cli/CMakeLists.txt +++ b/winpr/tools/makecert-cli/CMakeLists.txt @@ -19,10 +19,9 @@ set(MODULE_NAME "winpr-makecert") set(MODULE_PREFIX "WINPR_MAKECERT") -set(${MODULE_PREFIX}_SRCS - main.c) +set(${MODULE_PREFIX}_SRCS main.c) -AddTargetWithResourceFile(${MODULE_NAME} TRUE "${WINPR_VERSION}" ${MODULE_PREFIX}_SRCS) +addtargetwithresourcefile(${MODULE_NAME} TRUE "${WINPR_VERSION}" ${MODULE_PREFIX}_SRCS) set(${MODULE_PREFIX}_LIBS winpr-tools) diff --git a/winpr/tools/makecert/CMakeLists.txt b/winpr/tools/makecert/CMakeLists.txt index de3ef9235..37b831125 100644 --- a/winpr/tools/makecert/CMakeLists.txt +++ b/winpr/tools/makecert/CMakeLists.txt @@ -21,23 +21,21 @@ set(MODULE_PREFIX "WINPR_MAKECERT_TOOL") set(${MODULE_PREFIX}_SRCS makecert.c) if(OPENSSL_FOUND) - winpr_tools_include_directory_add(${OPENSSL_INCLUDE_DIR}) + winpr_tools_include_directory_add(${OPENSSL_INCLUDE_DIR}) endif() if(MBEDTLS_FOUND) - winpr_tools_include_directory_add(${MBEDTLS_INCLUDE_DIR}) + winpr_tools_include_directory_add(${MBEDTLS_INCLUDE_DIR}) endif() - winpr_tools_module_add(${${MODULE_PREFIX}_SRCS}) if(OPENSSL_FOUND) - list(APPEND ${MODULE_PREFIX}_LIBS ${OPENSSL_LIBRARIES}) + list(APPEND ${MODULE_PREFIX}_LIBS ${OPENSSL_LIBRARIES}) endif() if(MBEDTLS_FOUND) - list(APPEND ${MODULE_PREFIX}_LIBS ${MBEDTLS_LIBRARIES}) + list(APPEND ${MODULE_PREFIX}_LIBS ${MBEDTLS_LIBRARIES}) endif() - winpr_tools_library_add(${${MODULE_PREFIX}_LIBS} winpr)