From 6a592b5720580421baae1c656582d4b3fc1a8057 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Moreau?= Date: Sat, 13 Oct 2012 20:55:28 -0400 Subject: [PATCH] cmake: add WITH_SAMPLE, fix inclusion of X11 code --- channels/sample/ChannelOptions.cmake | 8 ++++++- client/CMakeLists.txt | 31 ++++++++++++++-------------- cmake/ConfigOptions.cmake | 1 + libfreerdp/locale/CMakeLists.txt | 5 ++--- server/CMakeLists.txt | 7 +++---- server/Sample/CMakeLists.txt | 3 +++ 6 files changed, 32 insertions(+), 23 deletions(-) diff --git a/channels/sample/ChannelOptions.cmake b/channels/sample/ChannelOptions.cmake index 430a072ca..33e50673e 100644 --- a/channels/sample/ChannelOptions.cmake +++ b/channels/sample/ChannelOptions.cmake @@ -5,5 +5,11 @@ set(CHANNEL_LONG_NAME "Sample Virtual Channel Extension") set(CHANNEL_SPECIFICATIONS "") string(TOUPPER "WITH_${CHANNEL_SHORT_NAME}" CHANNEL_OPTION) -option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" OFF) + +if(WITH_SAMPLE) + option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" ON) +else() + option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" OFF) +endif() + diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt index 771b25474..d96b77afd 100644 --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -1,5 +1,5 @@ # FreeRDP: A Remote Desktop Protocol Implementation -# FreeRDP Client User Interfaces +# FreeRDP Clients # # Copyright 2012 Marc-Andre Moreau # @@ -15,28 +15,29 @@ # See the License for the specific language governing permissions and # limitations under the License. -# User Interfaces +# Clients -if(NOT WIN32) - # Build Sample Client - add_subdirectory(Sample) - - # Build X11 Client - if(WITH_X11) - find_suggested_package(X11) - add_subdirectory(X11) +if(WIN32) + add_subdirectory(Windows) +else() + if(WITH_SAMPLE) + add_subdirectory(Sample) endif() - # Build DirectFB Client + find_optional_package(DirectFB) if(WITH_DIRECTFB) - find_optional_package(DirectFB) add_subdirectory(DirectFB) endif() -else() - # Build Windows Client - add_subdirectory(Windows) +endif() + +if(NOT WIN32 AND (NOT ANDROID)) + find_suggested_package(X11) + if(WITH_X11) + add_subdirectory(X11) + endif() endif() if(APPLE) add_subdirectory(Mac) endif() + diff --git a/cmake/ConfigOptions.cmake b/cmake/ConfigOptions.cmake index fa258a4cc..e434bdc35 100644 --- a/cmake/ConfigOptions.cmake +++ b/cmake/ConfigOptions.cmake @@ -28,6 +28,7 @@ if(MSVC) endif() option(BUILD_TESTING "Build unit tests" OFF) +option(WITH_SAMPLE "Build sample code" OFF) if(${CMAKE_VERSION} VERSION_GREATER 2.8.8) option(MONOLITHIC_BUILD "Use monolithic build" OFF) diff --git a/libfreerdp/locale/CMakeLists.txt b/libfreerdp/locale/CMakeLists.txt index bb0490ef2..438baa296 100644 --- a/libfreerdp/locale/CMakeLists.txt +++ b/libfreerdp/locale/CMakeLists.txt @@ -48,10 +48,9 @@ if(CMAKE_SYSTEM_NAME MATCHES Solaris) set(WITH_SUN true) endif() -if(NOT WIN32) +if(NOT WIN32 AND (NOT ANDROID)) + find_suggested_package(X11) if(WITH_X11) - find_suggested_package(X11) - add_definitions(-DWITH_X11) include_directories(${X11_INCLUDE_DIRS}) set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} ${${MODULE_PREFIX}_X11_SRCS}) diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt index 3897b5f25..12a6733ce 100644 --- a/server/CMakeLists.txt +++ b/server/CMakeLists.txt @@ -18,11 +18,10 @@ # Servers if(NOT WIN32) + if(WITH_SAMPLE) + add_subdirectory(Sample) + endif() - # Build Test Server - add_subdirectory(Sample) - - # Build X11 Server find_suggested_package(X11) if(WITH_X11) add_subdirectory(X11) diff --git a/server/Sample/CMakeLists.txt b/server/Sample/CMakeLists.txt index 4c5cf6dd3..ae67fd621 100644 --- a/server/Sample/CMakeLists.txt +++ b/server/Sample/CMakeLists.txt @@ -40,5 +40,8 @@ set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS MODULE winpr MODULES winpr-crt) +target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS}) +install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR}) + set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Server/Sample")