cmake: organize solution folders
[platform/upstream/freerdp.git] / libfreerdp / utils / CMakeLists.txt
1 # FreeRDP: A Remote Desktop Protocol Client
2 # libfreerdp-utils cmake build script
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 set(MODULE_NAME "freerdp-utils")
19 set(MODULE_PREFIX "FREERDP_UTILS")
20
21 set(CMAKE_THREAD_PREFER_PTHREAD)
22 find_required_package(Threads)
23
24 set(${MODULE_PREFIX}_SRCS
25         args.c
26         dsp.c
27         event.c
28         bitmap.c
29         hexdump.c
30         list.c
31         file.c
32         load_plugin.c
33         memory.c
34         passphrase.c
35         pcap.c
36         profiler.c
37         rail.c
38         signal.c
39         sleep.c
40         stopwatch.c
41         stream.c
42         string.c
43         svc_plugin.c
44         tcp.c
45         thread.c
46         time.c
47         uds.c
48         unicode.c
49         wait_obj.c)
50
51 if(NOT WIN32)
52         set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} msusb.c)
53 endif()
54
55 if(WITH_MONOLITHIC_BUILD)
56         add_library(${MODULE_NAME} OBJECT ${${MODULE_PREFIX}_SRCS})
57 else()
58         add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS})
59 endif()
60
61 set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${FREERDP_VERSION_FULL} SOVERSION ${FREERDP_VERSION} PREFIX "lib")
62
63 set(${MODULE_PREFIX}_LIBS
64         ${CMAKE_THREAD_LIBS_INIT}
65         ${CMAKE_DL_LIBS})
66
67 if(WIN32)
68         set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} ws2_32)
69 endif()
70
71 if(${CMAKE_SYSTEM_NAME} MATCHES SunOS)
72         set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} rt)
73 endif()
74
75 if(WITH_MONOLITHIC_BUILD)
76         set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} winpr)
77         set(FREERDP_LIBS ${FREERDP_LIBS} ${${MODULE_PREFIX}_LIBS} PARENT_SCOPE)
78 else()
79         if(NOT WIN32)
80                 set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} winpr-crt)
81         endif()
82
83         set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} winpr-synch)
84
85         target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS})
86         install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR})
87 endif()
88
89 set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "FreeRDP/libfreerdp")