From ac5dcbf56584bd5c6a7159283914d55bb8ced41e Mon Sep 17 00:00:00 2001 From: Bernhard Miklautz Date: Fri, 20 Jan 2012 11:37:55 +0100 Subject: [PATCH 1/5] Fixed optimization flags for release builds. cmake uses CMAKE_C_FLAGS_RELEASE in addition to CMAKE_C_FLAGS for make based build systems. Without the fix the optimization level argument is set twice (-O2 -O3) and -O3 was used instead of -O2. --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6899c34af..30e1c56a2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -65,6 +65,7 @@ if(CMAKE_COMPILER_IS_GNUCC) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-but-set-variable") endif() if(CMAKE_BUILD_TYPE STREQUAL "Release") + set(CMAKE_C_FLAGS_RELEASE "-DNDEBUG") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2") endif() if(WITH_SSE2_TARGET) From cc24a7ad6a27a0df91202ebaf246def9d9644886 Mon Sep 17 00:00:00 2001 From: Bernhard Miklautz Date: Fri, 20 Jan 2012 12:32:27 +0100 Subject: [PATCH 2/5] Changed cmake find prefix for pulseaudio. Now option (WITH_PULSEAUDIO) and package prefix (PULSEAUDIO_FOUND) match. --- channels/drdynvc/audin/CMakeLists.txt | 2 +- channels/drdynvc/tsmf/CMakeLists.txt | 2 +- channels/rdpsnd/CMakeLists.txt | 2 +- cmake/FindPulseAudio.cmake | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/channels/drdynvc/audin/CMakeLists.txt b/channels/drdynvc/audin/CMakeLists.txt index 14a48252c..a08c16f26 100644 --- a/channels/drdynvc/audin/CMakeLists.txt +++ b/channels/drdynvc/audin/CMakeLists.txt @@ -35,7 +35,7 @@ if(ALSA_FOUND) add_subdirectory(alsa) endif() -if(PULSE_FOUND) +if(PULSEAUDIO_FOUND) add_subdirectory(pulse) endif() diff --git a/channels/drdynvc/tsmf/CMakeLists.txt b/channels/drdynvc/tsmf/CMakeLists.txt index 7df0e3a35..438fc7c1d 100644 --- a/channels/drdynvc/tsmf/CMakeLists.txt +++ b/channels/drdynvc/tsmf/CMakeLists.txt @@ -51,7 +51,7 @@ if(ALSA_FOUND) add_subdirectory(alsa) endif() -if(PULSE_FOUND) +if(PULSEAUDIO_FOUND) add_subdirectory(pulse) endif() diff --git a/channels/rdpsnd/CMakeLists.txt b/channels/rdpsnd/CMakeLists.txt index c5413ee38..79f5a36d5 100644 --- a/channels/rdpsnd/CMakeLists.txt +++ b/channels/rdpsnd/CMakeLists.txt @@ -33,7 +33,7 @@ if(ALSA_FOUND) add_subdirectory(alsa) endif() -if(PULSE_FOUND) +if(PULSEAUDIO_FOUND) add_subdirectory(pulse) endif() diff --git a/cmake/FindPulseAudio.cmake b/cmake/FindPulseAudio.cmake index e30c6459b..3266ee276 100644 --- a/cmake/FindPulseAudio.cmake +++ b/cmake/FindPulseAudio.cmake @@ -1 +1 @@ -pkg_check_modules(PULSE libpulse) +pkg_check_modules(PULSEAUDIO libpulse) From 81004b44c53763e0ed4e03952aef1e396106c6da Mon Sep 17 00:00:00 2001 From: Bernhard Miklautz Date: Mon, 23 Jan 2012 13:46:42 +0100 Subject: [PATCH 3/5] build: Honor REQUIRE if set in find_package FIND_PACKAGE_HANDLE_STANDARD_ARGS handles REQUIRE only correct if called with the same package name as find_package was called with. The returned xxxx_FOUND is still uppercase. --- cmake/FindCUnit.cmake | 2 +- cmake/FindDirectFB.cmake | 2 +- cmake/FindXKBFile.cmake | 2 +- cmake/FindXShm.cmake | 2 +- cmake/FindXTest.cmake | 2 +- cmake/FindXcursor.cmake | 2 +- cmake/FindXdamage.cmake | 3 ++- cmake/FindXext.cmake | 2 +- cmake/FindXfixes.cmake | 2 +- cmake/FindXinerama.cmake | 2 +- cmake/FindXv.cmake | 2 +- 11 files changed, 12 insertions(+), 11 deletions(-) diff --git a/cmake/FindCUnit.cmake b/cmake/FindCUnit.cmake index a66a28c33..3e6b17518 100644 --- a/cmake/FindCUnit.cmake +++ b/cmake/FindCUnit.cmake @@ -37,7 +37,7 @@ find_library(CUNIT_LIBRARY NAMES cunit ) include(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(CUNIT DEFAULT_MSG CUNIT_LIBRARY CUNIT_INCLUDE_DIR) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(CUnit DEFAULT_MSG CUNIT_LIBRARY CUNIT_INCLUDE_DIR) if(CUNIT_FOUND) set( CUNIT_LIBRARIES ${CUNIT_LIBRARY} ) diff --git a/cmake/FindDirectFB.cmake b/cmake/FindDirectFB.cmake index 647bea314..6fe24caef 100644 --- a/cmake/FindDirectFB.cmake +++ b/cmake/FindDirectFB.cmake @@ -38,7 +38,7 @@ find_library(DIRECTFB_LIBRARY NAMES directfb ) include(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(DIRECTFB DEFAULT_MSG DIRECTFB_LIBRARY DIRECTFB_INCLUDE_DIR) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(DirectFB DEFAULT_MSG DIRECTFB_LIBRARY DIRECTFB_INCLUDE_DIR) if(DIRECTFB_FOUND) set( DIRECTFB_LIBRARIES ${DIRECTFB_LIBRARY} ) diff --git a/cmake/FindXKBFile.cmake b/cmake/FindXKBFile.cmake index 4c0a33374..e47ff997a 100644 --- a/cmake/FindXKBFile.cmake +++ b/cmake/FindXKBFile.cmake @@ -38,7 +38,7 @@ find_library(XKBFILE_LIBRARY NAMES xkbfile ) include(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(XKBFILE DEFAULT_MSG XKBFILE_LIBRARY XKBFILE_INCLUDE_DIR) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(XKBFile DEFAULT_MSG XKBFILE_LIBRARY XKBFILE_INCLUDE_DIR) if(XKBFILE_FOUND) set( XKBFILE_LIBRARIES ${XKBFILE_LIBRARY} ) diff --git a/cmake/FindXShm.cmake b/cmake/FindXShm.cmake index 8213f25e8..cc4b6d5c0 100644 --- a/cmake/FindXShm.cmake +++ b/cmake/FindXShm.cmake @@ -38,7 +38,7 @@ find_library(XSHM_LIBRARY NAMES Xext ) include(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(XSHM DEFAULT_MSG XSHM_LIBRARY XSHM_INCLUDE_DIR) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(XShm DEFAULT_MSG XSHM_LIBRARY XSHM_INCLUDE_DIR) if(XSHM_FOUND) set( XSHM_LIBRARIES ${XSHM_LIBRARY} ) diff --git a/cmake/FindXTest.cmake b/cmake/FindXTest.cmake index 85fe7b8c8..f4a8561e6 100644 --- a/cmake/FindXTest.cmake +++ b/cmake/FindXTest.cmake @@ -38,7 +38,7 @@ find_library(XTEST_LIBRARY NAMES Xtst ) include(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(XTEST DEFAULT_MSG XTEST_LIBRARY XTEST_INCLUDE_DIR) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(XTest DEFAULT_MSG XTEST_LIBRARY XTEST_INCLUDE_DIR) if(XTEST_FOUND) set( XTEST_LIBRARIES ${XTEST_LIBRARY} ) diff --git a/cmake/FindXcursor.cmake b/cmake/FindXcursor.cmake index 4eead70bb..cc22bbd39 100644 --- a/cmake/FindXcursor.cmake +++ b/cmake/FindXcursor.cmake @@ -38,7 +38,7 @@ find_library(XCURSOR_LIBRARY NAMES Xcursor ) include(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(XCURSOR DEFAULT_MSG XCURSOR_LIBRARY XCURSOR_INCLUDE_DIR) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(Xcursor DEFAULT_MSG XCURSOR_LIBRARY XCURSOR_INCLUDE_DIR) if(XCURSOR_FOUND) set( XCURSOR_LIBRARIES ${XCURSOR_LIBRARY} ) diff --git a/cmake/FindXdamage.cmake b/cmake/FindXdamage.cmake index 61d41587f..a3ddf28a2 100644 --- a/cmake/FindXdamage.cmake +++ b/cmake/FindXdamage.cmake @@ -38,11 +38,12 @@ find_library(XDAMAGE_LIBRARY NAMES Xdamage ) include(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(XDAMAGE DEFAULT_MSG XDAMAGE_LIBRARY XDAMAGE_INCLUDE_DIR) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(Xdamage DEFAULT_MSG XDAMAGE_LIBRARY XDAMAGE_INCLUDE_DIR) if(XDAMAGE_FOUND) set( XDAMAGE_LIBRARIES ${XDAMAGE_LIBRARY} ) set( XDAMAGE_INCLUDE_DIRS ${XDAMAGE_INCLUDE_DIR} ) endif() + mark_as_advanced(XDAMAGE_INCLUDE_DIR XDAMAGE_LIBRARY) diff --git a/cmake/FindXext.cmake b/cmake/FindXext.cmake index 8429ec645..8cfe552f8 100644 --- a/cmake/FindXext.cmake +++ b/cmake/FindXext.cmake @@ -38,7 +38,7 @@ find_library(XEXT_LIBRARY NAMES Xext ) include(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(XEXT DEFAULT_MSG XEXT_LIBRARY XEXT_INCLUDE_DIR) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(Xext DEFAULT_MSG XEXT_LIBRARY XEXT_INCLUDE_DIR) if(XEXT_FOUND) set( XEXT_LIBRARIES ${XEXT_LIBRARY} ) diff --git a/cmake/FindXfixes.cmake b/cmake/FindXfixes.cmake index c3875766e..a7e633ea2 100644 --- a/cmake/FindXfixes.cmake +++ b/cmake/FindXfixes.cmake @@ -38,7 +38,7 @@ find_library(XFIXES_LIBRARY NAMES Xfixes ) include(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(XFIXES DEFAULT_MSG XFIXES_LIBRARY XFIXES_INCLUDE_DIR) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(Xfixes DEFAULT_MSG XFIXES_LIBRARY XFIXES_INCLUDE_DIR) if(XFIXES_FOUND) set( XFIXES_LIBRARIES ${XFIXES_LIBRARY} ) diff --git a/cmake/FindXinerama.cmake b/cmake/FindXinerama.cmake index 3f786133b..ff9f4d1f2 100644 --- a/cmake/FindXinerama.cmake +++ b/cmake/FindXinerama.cmake @@ -38,7 +38,7 @@ find_library(XINERAMA_LIBRARY NAMES Xinerama ) include(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(XINERAMA DEFAULT_MSG XINERAMA_LIBRARY XINERAMA_INCLUDE_DIR) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(Xinerama DEFAULT_MSG XINERAMA_LIBRARY XINERAMA_INCLUDE_DIR) if(XINERAMA_FOUND) set( XINERAMA_LIBRARIES ${XINERAMA_LIBRARY} ) diff --git a/cmake/FindXv.cmake b/cmake/FindXv.cmake index e8887d730..346e6c628 100644 --- a/cmake/FindXv.cmake +++ b/cmake/FindXv.cmake @@ -38,7 +38,7 @@ find_library(XV_LIBRARY NAMES Xv ) include(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(XV DEFAULT_MSG XV_LIBRARY XV_INCLUDE_DIR) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(Xv DEFAULT_MSG XV_LIBRARY XV_INCLUDE_DIR) if(XV_FOUND) set( XV_LIBRARIES ${XV_LIBRARY} ) From 668c8c8cefcd3707c05f002e723b72d2643e2935 Mon Sep 17 00:00:00 2001 From: Bernhard Miklautz Date: Mon, 23 Jan 2012 14:19:40 +0100 Subject: [PATCH 4/5] build: use WITH_XXX instead of XXX_FOUND To check if something should be en- or disabled WITH_XXX should be used and not XXX_FOUND. If XXX_FOUND is used and something gets disabled afterwards (by setting WITH_XXX to OFF) it will be compiled in as long as XXX_FOUND is found in cmake's cache file. So disabling a feature, or option, without clearing the CMakeCache.txt might result in builds with unwanted configuration. --- CMakeLists.txt | 2 +- channels/drdynvc/audin/CMakeLists.txt | 4 ++-- channels/drdynvc/tsmf/CMakeLists.txt | 6 +++--- channels/rdpdr/CMakeLists.txt | 2 +- channels/rdpdr/printer/CMakeLists.txt | 5 +++-- channels/rdpdr/printer/printer_main.c | 4 ++-- channels/rdpsnd/CMakeLists.txt | 4 ++-- client/CMakeLists.txt | 4 ++-- client/X11/CMakeLists.txt | 8 ++++---- config.h.in | 4 ---- libfreerdp-kbd/CMakeLists.txt | 12 +++++++----- server/CMakeLists.txt | 2 +- server/X11/CMakeLists.txt | 10 +++++----- 13 files changed, 33 insertions(+), 34 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 30e1c56a2..eeb931b59 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -140,7 +140,7 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/freerdp.pc DESTINATION ${CMAKE_INSTALL # Build CUnit find_optional_package(CUnit) -if(CUNIT_FOUND) +if(WITH_CUNIT) enable_testing() add_subdirectory(cunit) endif() diff --git a/channels/drdynvc/audin/CMakeLists.txt b/channels/drdynvc/audin/CMakeLists.txt index a08c16f26..37fe00462 100644 --- a/channels/drdynvc/audin/CMakeLists.txt +++ b/channels/drdynvc/audin/CMakeLists.txt @@ -31,11 +31,11 @@ target_link_libraries(audin freerdp-utils) install(TARGETS audin DESTINATION ${FREERDP_PLUGIN_PATH}) -if(ALSA_FOUND) +if(WITH_ALSA) add_subdirectory(alsa) endif() -if(PULSEAUDIO_FOUND) +if(WITH_PULSEAUDIO) add_subdirectory(pulse) endif() diff --git a/channels/drdynvc/tsmf/CMakeLists.txt b/channels/drdynvc/tsmf/CMakeLists.txt index 438fc7c1d..e28cac6e7 100644 --- a/channels/drdynvc/tsmf/CMakeLists.txt +++ b/channels/drdynvc/tsmf/CMakeLists.txt @@ -43,15 +43,15 @@ target_link_libraries(tsmf freerdp-utils) install(TARGETS tsmf DESTINATION ${FREERDP_PLUGIN_PATH}) -if(FFMPEG_FOUND) +if(WITH_FFMPEG) add_subdirectory(ffmpeg) endif() -if(ALSA_FOUND) +if(WITH_ALSA) add_subdirectory(alsa) endif() -if(PULSEAUDIO_FOUND) +if(WITH_PULSEAUDIO) add_subdirectory(pulse) endif() diff --git a/channels/rdpdr/CMakeLists.txt b/channels/rdpdr/CMakeLists.txt index a05b61893..e43aeff7b 100644 --- a/channels/rdpdr/CMakeLists.txt +++ b/channels/rdpdr/CMakeLists.txt @@ -42,6 +42,6 @@ add_subdirectory(printer) add_subdirectory(parallel) add_subdirectory(serial) -if(PCSC_FOUND) +if(WITH_PCSC) add_subdirectory(smartcard) endif() diff --git a/channels/rdpdr/printer/CMakeLists.txt b/channels/rdpdr/printer/CMakeLists.txt index d70eb02e5..d0f184cf7 100644 --- a/channels/rdpdr/printer/CMakeLists.txt +++ b/channels/rdpdr/printer/CMakeLists.txt @@ -22,13 +22,14 @@ set(PRINTER_SRCS printer_main.h ) -if(CUPS_FOUND) +if(WITH_CUPS) set(PRINTER_SRCS ${PRINTER_SRCS} printer_cups.c printer_cups.h ) include_directories(${CUPS_INCLUDE_DIR}) + add_definitions(-DWITH_CUPS) endif() include_directories(..) @@ -38,7 +39,7 @@ set_target_properties(printer PROPERTIES PREFIX "") target_link_libraries(printer freerdp-utils) -if(CUPS_FOUND) +if(WITH_CUPS) target_link_libraries(printer ${CUPS_LIBRARIES}) endif() diff --git a/channels/rdpdr/printer/printer_main.c b/channels/rdpdr/printer/printer_main.c index 59cfbc548..d379102aa 100644 --- a/channels/rdpdr/printer/printer_main.c +++ b/channels/rdpdr/printer/printer_main.c @@ -30,7 +30,7 @@ #include "rdpdr_constants.h" #include "rdpdr_types.h" -#ifdef CUPS_FOUND +#ifdef WITH_CUPS #include "printer_cups.h" #endif @@ -300,7 +300,7 @@ int DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints) char* name; char* driver_name; -#ifdef CUPS_FOUND +#ifdef WITH_CUPS driver = printer_cups_get_driver(); #endif if (driver == NULL) diff --git a/channels/rdpsnd/CMakeLists.txt b/channels/rdpsnd/CMakeLists.txt index 79f5a36d5..3065ac63e 100644 --- a/channels/rdpsnd/CMakeLists.txt +++ b/channels/rdpsnd/CMakeLists.txt @@ -29,11 +29,11 @@ target_link_libraries(rdpsnd freerdp-utils) install(TARGETS rdpsnd DESTINATION ${FREERDP_PLUGIN_PATH}) -if(ALSA_FOUND) +if(WITH_ALSA) add_subdirectory(alsa) endif() -if(PULSEAUDIO_FOUND) +if(WITH_PULSEAUDIO) add_subdirectory(pulse) endif() diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt index df58fcd1c..00949d2e8 100644 --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -25,13 +25,13 @@ if(NOT WIN32) # Build X11 Client find_suggested_package(X11) - if(X11_FOUND) + if(WITH_X11) add_subdirectory(X11) endif() # Build DirectFB Client find_optional_package(DirectFB) - if(DIRECTFB_FOUND) + if(WITH_DIRECTFB) add_subdirectory(DirectFB) endif() else() diff --git a/client/X11/CMakeLists.txt b/client/X11/CMakeLists.txt index 5f51d77be..29f9ad813 100644 --- a/client/X11/CMakeLists.txt +++ b/client/X11/CMakeLists.txt @@ -58,28 +58,28 @@ if(WITH_MANPAGES) endif(WITH_MANPAGES) find_suggested_package(Xinerama) -if(XINERAMA_FOUND) +if(WITH_XINERAMA) add_definitions(-DWITH_XINERAMA -DWITH_XEXT) include_directories(${XINERAMA_INCLUDE_DIRS}) target_link_libraries(xfreerdp ${XINERAMA_LIBRARIES}) endif() find_suggested_package(Xext) -if(XEXT_FOUND) +if(WITH_XEXT) add_definitions(-DWITH_XEXT) include_directories(${XEXT_INCLUDE_DIRS}) target_link_libraries(xfreerdp ${XEXT_LIBRARIES}) endif() find_suggested_package(Xcursor) -if(XCURSOR_FOUND) +if(WITH_XCURSOR) add_definitions(-DWITH_XCURSOR) include_directories(${XCURSOR_INCLUDE_DIRS}) target_link_libraries(xfreerdp ${XCURSOR_LIBRARIES}) endif() find_suggested_package(Xv) -if(XV_FOUND) +if(WITH_XV) add_definitions(-DWITH_XV) include_directories(${XV_INCLUDE_DIRS}) target_link_libraries(xfreerdp ${XV_LIBRARIES}) diff --git a/config.h.in b/config.h.in index c43ca0cb0..804971331 100644 --- a/config.h.in +++ b/config.h.in @@ -18,9 +18,6 @@ #cmakedefine HAVE_STDBOOL_H #cmakedefine HAVE_INTTYPES_H -/* Found packages */ -#cmakedefine CUPS_FOUND - /* Endian */ #cmakedefine BIG_ENDIAN @@ -50,5 +47,4 @@ #cmakedefine WITH_DEBUG_REDIR #cmakedefine WITH_DEBUG_CLIPRDR #cmakedefine WITH_DEBUG_WND - #endif diff --git a/libfreerdp-kbd/CMakeLists.txt b/libfreerdp-kbd/CMakeLists.txt index 060846f55..e16fd78bb 100644 --- a/libfreerdp-kbd/CMakeLists.txt +++ b/libfreerdp-kbd/CMakeLists.txt @@ -30,16 +30,18 @@ set(FREERDP_KBD_SRCS add_library(freerdp-kbd ${FREERDP_KBD_SRCS}) find_suggested_package(X11) -if(X11_FOUND) +if(WITH_X11) target_link_libraries(freerdp-kbd ${X11_LIBRARIES}) endif() if(NOT APPLE) find_suggested_package(XKBFile) - if(XKBFILE_FOUND) - add_definitions(-DWITH_XKBFILE) - include_directories(${XKBFILE_INCLUDE_DIRS}) - target_link_libraries(freerdp-kbd ${XKBFILE_LIBRARIES}) + if(WITH_X11) + if(WITH_XKBFILE) + add_definitions(-DWITH_XKBFILE) + include_directories(${XKBFILE_INCLUDE_DIRS}) + target_link_libraries(freerdp-kbd ${XKBFILE_LIBRARIES}) + endif() endif() endif() diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt index 2b20d4ea6..b6d659652 100644 --- a/server/CMakeLists.txt +++ b/server/CMakeLists.txt @@ -26,7 +26,7 @@ if(NOT WIN32) # Build X11 Server find_suggested_package(X11) - if(X11_FOUND) + if(WITH_X11) add_subdirectory(X11) endif() diff --git a/server/X11/CMakeLists.txt b/server/X11/CMakeLists.txt index 9e9043b47..11a5cef5f 100644 --- a/server/X11/CMakeLists.txt +++ b/server/X11/CMakeLists.txt @@ -25,34 +25,34 @@ add_executable(xfreerdp-server xfreerdp.c) find_suggested_package(XShm) -if(XSHM_FOUND) +if(WITH_XSHM) add_definitions(-DWITH_XSHM) include_directories(${XSHM_INCLUDE_DIRS}) endif() find_suggested_package(Xext) -if(XEXT_FOUND) +if(WITH_XEXT) add_definitions(-DWITH_XEXT) include_directories(${XEXT_INCLUDE_DIRS}) target_link_libraries(xfreerdp-server ${XEXT_LIBRARIES}) endif() find_suggested_package(Xdamage) -if(XDAMAGE_FOUND) +if(WITH_XDAMAGE) add_definitions(-DWITH_XDAMAGE) include_directories(${XDAMAGE_INCLUDE_DIRS}) target_link_libraries(xfreerdp-server ${XDAMAGE_LIBRARIES}) endif() find_suggested_package(Xfixes) -if(XFIXES_FOUND) +if(WITH_XFIXES) add_definitions(-DWITH_XFIXES) include_directories(${XFIXES_INCLUDE_DIRS}) target_link_libraries(xfreerdp-server ${XFIXES_LIBRARIES}) endif() find_suggested_package(XTest) -if(XTEST_FOUND) +if(WITH_XTEST) add_definitions(-DWITH_XTEST) include_directories(${XTEST_INCLUDE_DIRS}) target_link_libraries(xfreerdp-server ${XTEST_LIBRARIES}) From 8e91faf13968b08b8d5ed4e8b66edbb00a754707 Mon Sep 17 00:00:00 2001 From: Pawel Jakub Dawidek Date: Mon, 23 Jan 2012 18:20:10 +0100 Subject: [PATCH 5/5] - Rename rdp_establish_keys() to rdp_client_establish_keys() as it is only responsible for establishing keys on the client side. - Simplify rdp_client_establish_keys() by using rdp_write_header() and rdp_write_security_header() function instead of reimplementing them and by using existing defines instead of magic values. --- libfreerdp-core/connection.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/libfreerdp-core/connection.c b/libfreerdp-core/connection.c index 3d4634e2b..5403db3c3 100644 --- a/libfreerdp-core/connection.c +++ b/libfreerdp-core/connection.c @@ -180,7 +180,7 @@ boolean rdp_client_redirect(rdpRdp* rdp) return rdp_client_connect(rdp); } -static boolean rdp_establish_keys(rdpRdp* rdp) +static boolean rdp_client_establish_keys(rdpRdp* rdp) { uint8 client_random[32]; uint8 crypt_client_random[256 + 8]; @@ -206,17 +206,10 @@ static boolean rdp_establish_keys(rdpRdp* rdp) crypto_rsa_public_encrypt(client_random, 32, key_len, mod, exp, crypt_client_random); /* send crypt client random to server */ - length = 7 + 8 + 4 + 4 + key_len + 8; + length = RDP_PACKET_HEADER_LENGTH + RDP_SECURITY_HEADER_LENGTH + 4 + key_len + 8; s = transport_send_stream_init(rdp->mcs->transport, length); - tpkt_write_header(s, length); - tpdu_write_header(s, 2, 0xf0); - per_write_choice(s, DomainMCSPDU_SendDataRequest << 2); - per_write_integer16(s, rdp->mcs->user_id, MCS_BASE_CHANNEL_ID); - per_write_integer16(s, MCS_GLOBAL_CHANNEL_ID, 0); - stream_write_uint8(s, 0x70); - length = (4 + 4 + key_len + 8) | 0x8000; - stream_write_uint16_be(s, length); - stream_write_uint32(s, 1); /* SEC_CLIENT_RANDOM */ + rdp_write_header(rdp, s, length, MCS_GLOBAL_CHANNEL_ID); + rdp_write_security_header(s, SEC_EXCHANGE_PKT); length = key_len + 8; stream_write_uint32(s, length); stream_write(s, crypt_client_random, length); @@ -335,7 +328,7 @@ boolean rdp_client_connect_mcs_channel_join_confirm(rdpRdp* rdp, STREAM* s) if (rdp->mcs->user_channel_joined && rdp->mcs->global_channel_joined && all_joined) { - if (!rdp_establish_keys(rdp)) + if (!rdp_client_establish_keys(rdp)) return false; if (!rdp_send_client_info(rdp)) return false;