server/shadow: Integrate comment from @hardening: use switch to handle different...
[platform/upstream/freerdp.git] / server / CMakeLists.txt
1 # FreeRDP: A Remote Desktop Protocol Implementation
2 # FreeRDP Servers
3 #
4 # Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
5 #
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
9 #
10 #     http://www.apache.org/licenses/LICENSE-2.0
11 #
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17
18 # Servers
19
20 add_subdirectory(common)
21 add_subdirectory(shadow)
22
23 if(FREERDP_VENDOR)
24         if(WITH_SAMPLE)
25                 add_subdirectory(Sample)
26         endif()
27
28         if(NOT WIN32)
29                 if(APPLE AND (NOT IOS))
30                         #add_subdirectory(Mac)
31                 endif()
32         else()
33                 #add_subdirectory(Windows)
34         endif()
35
36         if(NOT DEFINED WITH_FREERDS)
37                 set(WITH_FREERDS 1)
38         endif()
39
40         if(WITH_FREERDS AND (IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/FreeRDS"))
41                 add_subdirectory("FreeRDS")
42         endif()
43 endif()
44
45 # Pick up other servers
46
47 set(FILENAME "ModuleOptions.cmake")
48 file(GLOB FILEPATHS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*/${FILENAME}")
49
50 foreach(FILEPATH ${FILEPATHS})
51         if(${FILEPATH} MATCHES "^([^/]*)/+${FILENAME}")
52                 string(REGEX REPLACE "^([^/]*)/+${FILENAME}" "\\1" FREERDP_SERVER ${FILEPATH})
53                 set(FREERDP_SERVER_ENABLED 0)
54                 include(${FILEPATH})
55                 if(FREERDP_SERVER_ENABLED)
56                         if(NOT (${FREERDP_SERVER_VENDOR} MATCHES "FreeRDP"))
57                                 list(APPEND FREERDP_EXTRA_SERVERS ${FREERDP_SERVER})
58                         endif()
59                 endif()
60         endif()
61 endforeach()
62
63 foreach(FREERDP_SERVER ${FREERDP_EXTRA_SERVERS})
64         add_subdirectory(${FREERDP_SERVER})
65 endforeach()
66