]> git.stg.codes - stg.git/blobdiff - libs/CMakeLists.txt
RawPacket-related changes.
[stg.git] / libs / CMakeLists.txt
index af3d944fe88fa0b110ab3bc52e056b381357929e..f413010e1a4ac6f10d556fa9252a4133d8d08128 100644 (file)
@@ -1,49 +1,72 @@
 set ( CMAKE_POSITION_INDEPENDENT_CODE ON )
 
 if ( BUILD_LIB_COMMON )
-    add_subdirectory (common)
+    find_package ( Iconv REQUIRED )
+    add_library ( common STATIC common/blockio.cpp common/common.cpp common/strptime.cpp )
+    target_include_directories ( common PUBLIC common/include )
+    target_link_libraries ( common Iconv::Iconv )
 endif ( BUILD_LIB_COMMON )
 
 if ( BUILD_LIB_CONFFILES )
-    add_subdirectory (conffiles)
+    add_library ( conffiles STATIC conffiles/conffiles.cpp )
+    target_include_directories ( conffiles PUBLIC conffiles/include )
 endif ( BUILD_LIB_CONFFILES )
 
 if ( BUILD_LIB_CRYPTO )
-    add_subdirectory (crypto)
+    add_library ( crypto STATIC crypto/ag_md5.c crypto/bfstream.cpp crypto/blowfish.c )
+    target_include_directories ( crypto PUBLIC crypto/include )
 endif ( BUILD_LIB_CRYPTO )
 
 if ( BUILD_LIB_DOTCONFPP )
-    add_subdirectory (dotconfpp)
+    add_library ( dotconfpp STATIC dotconfpp/dotconfpp.cpp dotconfpp/mempool.cpp )
+    target_include_directories ( dotconfpp PUBLIC dotconfpp/include )
 endif ( BUILD_LIB_DOTCONFPP )
 
 if ( BUILD_LIB_IA )
-    add_subdirectory (ia)
+    add_library ( ia STATIC ia/ia.cpp )
+    target_include_directories ( ia PUBLIC ia/include )
+    target_link_libraries ( ia crypto common )
 endif ( BUILD_LIB_IA )
 
 if ( BUILD_LIB_IBPP )
-    add_subdirectory (ibpp)
+    add_library ( ibpp STATIC ibpp/all_in_one.cpp )
+    target_include_directories ( ibpp PUBLIC ibpp/include )
+    target_compile_options ( ibpp PRIVATE -Wno-old-style-cast $<$<CXX_COMPILER_ID:GNU>:-Wno-useless-cast> )
 endif ( BUILD_LIB_IBPP )
 
 if ( BUILD_LIB_JSON )
-    add_subdirectory (json)
+    find_package ( YAJL REQUIRED )
+    add_library ( json STATIC json/generator.cpp json/parser.cpp )
+    target_include_directories ( json PUBLIC json/include )
+    target_link_libraries ( json common YAJL::YAJL )
 endif ( BUILD_LIB_JSON )
 
 if ( BUILD_LIB_LOGGER )
-    add_subdirectory (logger)
+    add_library ( logger STATIC logger/logger.cpp )
+    target_include_directories ( logger PUBLIC logger/include )
 endif ( BUILD_LIB_LOGGER )
 
 if ( BUILD_LIB_PINGER )
-    add_subdirectory (pinger)
+    add_library ( pinger STATIC pinger/pinger.cpp )
+    target_include_directories ( pinger PUBLIC pinger/include )
+    target_link_libraries ( pinger common )
 endif ( BUILD_LIB_PINGER )
 
 if ( BUILD_LIB_SCRIPTEXECUTER )
-    add_subdirectory (scriptexecuter)
+    add_library ( scriptexecuter STATIC scriptexecuter/scriptexecuter.c )
+    target_include_directories ( scriptexecuter PUBLIC scriptexecuter/include )
 endif ( BUILD_LIB_SCRIPTEXECUTER )
 
 if ( BUILD_LIB_SMUX )
-    add_subdirectory (smux)
+    file ( GLOB SMUX_C_FILES smux/*.c )
+    add_library ( smux STATIC ${SMUX_C_FILES} )
+    target_include_directories ( smux PUBLIC smux/include smux/include/stg )
 endif ( BUILD_LIB_SMUX )
 
 if ( BUILD_LIB_SRVCONF )
-    add_subdirectory (srvconf)
+    find_package ( EXPAT REQUIRED )
+    file ( GLOB PARSERS srvconf/parsers/*.cpp )
+    add_library ( srvconf STATIC srvconf/servconf.cpp srvconf/netunit.cpp ${PARSERS} )
+    target_include_directories ( srvconf PUBLIC srvconf/include )
+    target_link_libraries ( srvconf crypto common EXPAT::EXPAT )
 endif ( BUILD_LIB_SRVCONF )