]> git.stg.codes - stg.git/blob - libs/CMakeLists.txt
Use std::lock_guard instead of STG_LOCKER.
[stg.git] / libs / CMakeLists.txt
1 set ( CMAKE_POSITION_INDEPENDENT_CODE ON )
2
3 if ( BUILD_LIB_COMMON )
4     find_package ( Iconv REQUIRED )
5     add_library ( common STATIC common/blockio.cpp common/common.cpp common/strptime.cpp )
6     target_include_directories ( common PUBLIC common/include )
7     target_link_libraries ( common Iconv::Iconv )
8
9     if ( CLANG_TIDY_EXE )
10         set_target_properties ( common PROPERTIES CXX_CLANG_TIDY "${DO_CLANG_TIDY}" )
11     endif ()
12     if ( INCLUDE_WHAT_YOU_USE_EXE )
13         set_target_properties ( common PROPERTIES CXX_INCLUDE_WHAT_YOU_USE "${DO_INCLUDE_WHAT_YOU_USE}" )
14     endif ()
15 endif ( BUILD_LIB_COMMON )
16
17 if ( BUILD_LIB_CONFFILES )
18     add_library ( conffiles STATIC conffiles/conffiles.cpp )
19     target_include_directories ( conffiles PUBLIC conffiles/include )
20
21     if ( CLANG_TIDY_EXE )
22         set_target_properties ( conffiles PROPERTIES CXX_CLANG_TIDY "${DO_CLANG_TIDY}" )
23     endif ()
24     if ( INCLUDE_WHAT_YOU_USE_EXE )
25         set_target_properties ( conffiles PROPERTIES CXX_INCLUDE_WHAT_YOU_USE "${DO_INCLUDE_WHAT_YOU_USE}" )
26     endif ()
27 endif ( BUILD_LIB_CONFFILES )
28
29 if ( BUILD_LIB_CRYPTO )
30     add_library ( crypto STATIC crypto/ag_md5.c crypto/bfstream.cpp crypto/blowfish.c )
31     target_include_directories ( crypto PUBLIC crypto/include )
32
33     if ( CLANG_TIDY_EXE )
34         set_target_properties ( crypto PROPERTIES CXX_CLANG_TIDY "${DO_CLANG_TIDY}" )
35     endif ()
36     if ( INCLUDE_WHAT_YOU_USE_EXE )
37         set_target_properties ( crypto PROPERTIES CXX_INCLUDE_WHAT_YOU_USE "${DO_INCLUDE_WHAT_YOU_USE}" )
38     endif ()
39 endif ( BUILD_LIB_CRYPTO )
40
41 if ( BUILD_LIB_DOTCONFPP )
42     add_library ( dotconfpp STATIC dotconfpp/dotconfpp.cpp dotconfpp/mempool.cpp )
43     target_include_directories ( dotconfpp PUBLIC dotconfpp/include )
44
45     if ( CLANG_TIDY_EXE )
46         set_target_properties ( dotconfpp PROPERTIES CXX_CLANG_TIDY "${DO_CLANG_TIDY}" )
47     endif ()
48     if ( INCLUDE_WHAT_YOU_USE_EXE )
49         set_target_properties ( dotconfpp PROPERTIES CXX_INCLUDE_WHAT_YOU_USE "${DO_INCLUDE_WHAT_YOU_USE}" )
50     endif ()
51 endif ( BUILD_LIB_DOTCONFPP )
52
53 if ( BUILD_LIB_IA )
54     add_library ( ia STATIC ia/ia.cpp )
55     target_include_directories ( ia PUBLIC ia/include )
56     target_link_libraries ( ia crypto common )
57
58     if ( CLANG_TIDY_EXE )
59         set_target_properties ( ia PROPERTIES CXX_CLANG_TIDY "${DO_CLANG_TIDY}" )
60     endif ()
61     if ( INCLUDE_WHAT_YOU_USE_EXE )
62         set_target_properties ( ia PROPERTIES CXX_INCLUDE_WHAT_YOU_USE "${DO_INCLUDE_WHAT_YOU_USE}" )
63     endif ()
64 endif ( BUILD_LIB_IA )
65
66 if ( BUILD_LIB_IBPP )
67     add_library ( ibpp STATIC ibpp/all_in_one.cpp )
68     target_include_directories ( ibpp PUBLIC ibpp/include )
69     target_compile_options ( ibpp PRIVATE -Wno-old-style-cast $<$<CXX_COMPILER_ID:GNU>:-Wno-useless-cast> )
70
71     if ( CLANG_TIDY_EXE )
72         set_target_properties ( ibpp PROPERTIES CXX_CLANG_TIDY "${DO_CLANG_TIDY}" )
73     endif ()
74     if ( INCLUDE_WHAT_YOU_USE_EXE )
75         set_target_properties ( ibpp PROPERTIES CXX_INCLUDE_WHAT_YOU_USE "${DO_INCLUDE_WHAT_YOU_USE}" )
76     endif ()
77 endif ( BUILD_LIB_IBPP )
78
79 if ( BUILD_LIB_LOGGER )
80     add_library ( logger STATIC logger/logger.cpp )
81     target_include_directories ( logger PUBLIC logger/include )
82
83     if ( CLANG_TIDY_EXE )
84         set_target_properties ( logger PROPERTIES CXX_CLANG_TIDY "${DO_CLANG_TIDY}" )
85     endif ()
86     if ( INCLUDE_WHAT_YOU_USE_EXE )
87         set_target_properties ( logger PROPERTIES CXX_INCLUDE_WHAT_YOU_USE "${DO_INCLUDE_WHAT_YOU_USE}" )
88     endif ()
89 endif ( BUILD_LIB_LOGGER )
90
91 if ( BUILD_LIB_PINGER )
92     add_library ( pinger STATIC pinger/pinger.cpp )
93     target_include_directories ( pinger PUBLIC pinger/include )
94     target_link_libraries ( pinger common )
95
96     if ( CLANG_TIDY_EXE )
97         set_target_properties ( pinger PROPERTIES CXX_CLANG_TIDY "${DO_CLANG_TIDY}" )
98     endif ()
99     if ( INCLUDE_WHAT_YOU_USE_EXE )
100         set_target_properties ( pinger PROPERTIES CXX_INCLUDE_WHAT_YOU_USE "${DO_INCLUDE_WHAT_YOU_USE}" )
101     endif ()
102 endif ( BUILD_LIB_PINGER )
103
104 if ( BUILD_LIB_SCRIPTEXECUTER )
105     add_library ( scriptexecuter STATIC scriptexecuter/scriptexecuter.c )
106     target_include_directories ( scriptexecuter PUBLIC scriptexecuter/include )
107
108     if ( CLANG_TIDY_EXE )
109         set_target_properties ( scriptexecuter PROPERTIES CXX_CLANG_TIDY "${DO_CLANG_TIDY}" )
110     endif ()
111     if ( INCLUDE_WHAT_YOU_USE_EXE )
112         set_target_properties ( scriptexecuter PROPERTIES CXX_INCLUDE_WHAT_YOU_USE "${DO_INCLUDE_WHAT_YOU_USE}" )
113     endif ()
114 endif ( BUILD_LIB_SCRIPTEXECUTER )
115
116 if ( BUILD_LIB_SMUX )
117     file ( GLOB SMUX_C_FILES smux/*.c )
118     add_library ( smux STATIC ${SMUX_C_FILES} )
119     target_include_directories ( smux PUBLIC smux/include smux/include/stg )
120     target_compile_options ( smux PRIVATE -Wno-cpp )
121
122     if ( CLANG_TIDY_EXE )
123         set_target_properties ( smux PROPERTIES CXX_CLANG_TIDY "${DO_CLANG_TIDY}" )
124     endif ()
125     if ( INCLUDE_WHAT_YOU_USE_EXE )
126         set_target_properties ( smux PROPERTIES CXX_INCLUDE_WHAT_YOU_USE "${DO_INCLUDE_WHAT_YOU_USE}" )
127     endif ()
128 endif ( BUILD_LIB_SMUX )
129
130 if ( BUILD_LIB_SRVCONF )
131     find_package ( EXPAT REQUIRED )
132     file ( GLOB PARSERS srvconf/parsers/*.cpp )
133     add_library ( srvconf STATIC srvconf/servconf.cpp srvconf/netunit.cpp ${PARSERS} )
134     target_include_directories ( srvconf PUBLIC srvconf/include )
135     target_link_libraries ( srvconf crypto common EXPAT::EXPAT )
136
137     if ( CLANG_TIDY_EXE )
138         set_target_properties ( srvconf PROPERTIES CXX_CLANG_TIDY "${DO_CLANG_TIDY}" )
139     endif ()
140     if ( INCLUDE_WHAT_YOU_USE_EXE )
141         set_target_properties ( srvconf PROPERTIES CXX_INCLUDE_WHAT_YOU_USE "${DO_INCLUDE_WHAT_YOU_USE}" )
142     endif ()
143 endif ( BUILD_LIB_SRVCONF )