2016-11-18 23:02:01 +03:00
####
# microsoft-oms-auditd-plugin
#
# Copyright (c) Microsoft Corporation
#
# All rights reserved.
#
# MIT License
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ""Software""), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
####
2019-04-30 22:06:02 +03:00
cmake_minimum_required ( VERSION 2.8.12 )
2016-11-18 23:02:01 +03:00
project ( auoms )
2019-04-30 22:06:02 +03:00
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17" )
2016-11-18 23:02:01 +03:00
set ( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -ggdb" )
2019-04-30 22:06:02 +03:00
set ( CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -ggdb" )
set ( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -ggdb" )
set ( CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -ggdb" )
2016-11-18 23:02:01 +03:00
2019-07-26 00:16:49 +03:00
if ( DEFINED DO_STATIC_LINK )
# See https://gcc.gnu.org/onlinedocs/libstdc++/manual/license.html
# and https://www.gnu.org/licenses/gcc-exception-3.1-faq.en.html
# for why it is safe to use -static-libgcc -static-libstdc++
set ( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-z,relro -Wl,-z,now -static-libgcc -static-libstdc++ -Wl,--no-as-needed -lrt -Wl,--as-needed" )
endif ( )
2016-11-18 23:02:01 +03:00
include_directories ( BEFORE ${ CMAKE_BINARY_DIR } /../ext_include )
2019-08-07 17:20:30 +03:00
if ( NOT DEFINED ENV_CONFIG_PATH )
set ( ENV_CONFIG_PATH ${ CMAKE_SOURCE_DIR } /build/env_config.h )
endif ( )
2019-04-30 22:06:02 +03:00
add_custom_command (
O U T P U T $ { C M A K E _ S O U R C E _ D I R } / a u o m s _ v e r s i o n . h
C O M M A N D b a s h - c \ " g r e p A U O M S _ B U I L D V E R S I O N a u o m s . v e r s i o n | h e a d - n 4 | c u t - d ' = ' - f 2 | t r ' \ \ n ' ' . ' | s e d ' s / ^ \ \ \ ( [ 0 - 9 ] [ 0 - 9 ] * \ \ . [ 0 - 9 ] [ 0 - 9 ] * \ \ . [ 0 - 9 ] [ 0 - 9 ] * \ \ . [ 0 - 9 ] [ 0 - 9 ] * \ \ \ ) \ \ . * / \ #define AUOMS_VERSION \\"\\1\\"/' > auoms_version.h\"
M A I N _ D E P E N D E N C Y a u o m s . v e r s i o n
W O R K I N G _ D I R E C T O R Y $ { C M A K E _ S O U R C E _ D I R }
)
2019-08-07 17:20:30 +03:00
add_custom_command (
O U T P U T $ { C M A K E _ S O U R C E _ D I R } / e n v _ c o n f i g . h
C O M M A N D l n - f - s $ { E N V _ C O N F I G _ P A T H } $ { C M A K E _ S O U R C E _ D I R } / e n v _ c o n f i g . h
M A I N _ D E P E N D E N C Y $ { E N V _ C O N F I G _ P A T H }
W O R K I N G _ D I R E C T O R Y $ { C M A K E _ S O U R C E _ D I R }
)
2019-04-30 22:06:02 +03:00
add_executable ( auomscollect
2019-08-07 17:20:30 +03:00
e n v _ c o n f i g . h
2019-04-30 22:06:02 +03:00
a u o m s c o l l e c t . c p p
I O . c p p
E v e n t . c p p
S i g n a l s . c p p
Q u e u e . c p p
U n i x D o m a i n W r i t e r . c p p
L o g g e r . c p p
C o n f i g . c p p
U s e r D B . c p p
R u n B a s e . c p p
O u t p u t . c p p
S t r i n g U t i l s . c p p
R a w E v e n t R e c o r d . c p p
R a w E v e n t A c c u m u l a t o r . c p p
S t d i n R e a d e r . c p p
N e t l i n k . c p p
F i l e W a t c h e r . c p p
G a t e . h
D e f e r . h
T r a n s l a t e R e c o r d T y p e . c p p
F i l e U t i l s . c p p
R e t r y . h
2019-11-22 01:55:06 +03:00
M e t r i c s . c p p
P r o c M e t r i c s . c p p
C a c h e . h
2019-04-30 22:06:02 +03:00
)
# See https://gcc.gnu.org/onlinedocs/libstdc++/manual/license.html
# and https://www.gnu.org/licenses/gcc-exception-3.1-faq.en.html
# for why it is safe to use -static-libgcc -static-libstdc++
2019-07-26 00:16:49 +03:00
#set_target_properties(auomscollect PROPERTIES LINK_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-z,relro -Wl,-z,now -static-libgcc -static-libstdc++ -Wl,--no-as-needed -lrt -Wl,--as-needed")
2019-04-30 22:06:02 +03:00
target_link_libraries ( auomscollect
d l
p t h r e a d
r t
)
install ( TARGETS
a u o m s c o l l e c t
R U N T I M E D E S T I N A T I O N $ { C M A K E _ B I N A R Y _ D I R } / r e l e a s e / b i n
)
add_executable ( auoms
2019-08-07 17:20:30 +03:00
e n v _ c o n f i g . h
2019-04-30 22:06:02 +03:00
a u o m s . c p p
a u o m s _ v e r s i o n . h
2017-09-30 02:25:45 +03:00
I O . c p p
2016-11-18 23:02:01 +03:00
E v e n t . c p p
2019-10-07 17:58:47 +03:00
T e x t E v e n t W r i t e r C o n f i g . c p p
2017-05-22 14:13:32 +03:00
O M S E v e n t W r i t e r . c p p
J S O N E v e n t W r i t e r . c p p
M s g P a c k E v e n t W r i t e r . c p p
2019-10-07 17:58:47 +03:00
S y s l o g E v e n t W r i t e r . c p p
2017-09-30 02:25:45 +03:00
T e x t E v e n t W r i t e r . c p p
2019-04-30 22:06:02 +03:00
R a w E v e n t P r o c e s s o r . c p p
2016-11-18 23:02:01 +03:00
S i g n a l s . c p p
Q u e u e . c p p
U n i x D o m a i n W r i t e r . c p p
L o g g e r . c p p
C o n f i g . c p p
U s e r D B . c p p
2017-05-22 14:13:32 +03:00
R u n B a s e . c p p
2019-04-30 22:06:02 +03:00
I n p u t B u f f e r . h
I n p u t s . c p p
I n p u t . c p p
2017-05-22 14:13:32 +03:00
O u t p u t s . c p p
O u t p u t . c p p
2018-03-21 04:04:05 +03:00
P r o c e s s I n f o . c p p
P r o c F i l t e r . c p p
2019-10-07 17:58:47 +03:00
P r o c e s s T r e e . c p p
F i l t e r s E n g i n e . c p p
2019-11-22 01:55:06 +03:00
E v e n t F i l t e r . c p p
2018-03-24 05:31:41 +03:00
S t r i n g U t i l s . c p p
2019-04-30 22:06:02 +03:00
I n t e r p r e t . c p p
C o l l e c t i o n M o n i t o r . c p p
N e t l i n k . c p p
N e t l i n k A u d i t . c p p
T r a n s l a t e A r c h . c p p
T r a n s l a t e S y s c a l l . c p p
T r a n s l a t e R e c o r d T y p e . c p p
T r a n s l a t e F i e l d T y p e . c p p
T r a n s l a t e F i e l d . c p p
2019-05-09 23:34:17 +03:00
T r a n s l a t e E r r n o . c p p
2019-04-30 22:06:02 +03:00
A u d i t R u l e s . c p p
A u d i t R u l e s M o n i t o r . c p p
2020-03-03 23:46:54 +03:00
A u d i t S t a t u s . c p p A u d i t S t a t u s . h
2019-04-30 22:06:02 +03:00
K e r n e l I n f o . c p p
V e r s i o n . c p p
U n i x D o m a i n L i s t e n e r . c p p
O p e r a t i o n a l S t a t u s . c p p
F i l e U t i l s . c p p
E x e c U t i l . c p p
S t r i n g T a b l e . h
E x e c v e C o n v e r t e r . c p p
2019-11-22 01:55:06 +03:00
M e t r i c s . c p p
S y s c a l l M e t r i c s . c p p
P r o c M e t r i c s . c p p
S y s t e m M e t r i c s . c p p
2016-11-18 23:02:01 +03:00
)
# See https://gcc.gnu.org/onlinedocs/libstdc++/manual/license.html
# and https://www.gnu.org/licenses/gcc-exception-3.1-faq.en.html
# for why it is safe to use -static-libgcc -static-libstdc++
#set_target_properties(auoms PROPERTIES LINK_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-z,relro -Wl,-z,now -Wl,--wrap=memcpy -static-libgcc -static-libstdc++ -Wl,--no-as-needed -lrt -Wl,--as-needed")
2019-07-26 00:16:49 +03:00
#set_target_properties(auoms PROPERTIES LINK_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-z,relro -Wl,-z,now -static-libgcc -static-libstdc++ -Wl,--no-as-needed -lrt -Wl,--as-needed")
2016-11-18 23:02:01 +03:00
target_link_libraries ( auoms
d l
p t h r e a d
2018-03-24 05:31:41 +03:00
r t
2016-11-18 23:02:01 +03:00
)
install ( TARGETS
a u o m s
R U N T I M E D E S T I N A T I O N $ { C M A K E _ B I N A R Y _ D I R } / r e l e a s e / b i n
)
2019-04-30 22:06:02 +03:00
add_executable ( auomsctl
2019-08-07 17:20:30 +03:00
e n v _ c o n f i g . h
2019-04-30 22:06:02 +03:00
a u o m s c t l . c p p
a u o m s _ v e r s i o n . h
N e t l i n k . c p p
N e t l i n k A u d i t . c p p
2020-03-03 23:46:54 +03:00
A u d i t S t a t u s . c p p A u d i t S t a t u s . h
2019-04-30 22:06:02 +03:00
R u n B a s e . c p p
S i g n a l s . c p p
L o g g e r . c p p
T r a n s l a t e A r c h . c p p
T r a n s l a t e S y s c a l l . c p p
T r a n s l a t e R e c o r d T y p e . c p p
T r a n s l a t e F i e l d T y p e . c p p
T r a n s l a t e F i e l d . c p p
2019-05-09 23:34:17 +03:00
T r a n s l a t e E r r n o . c p p
2019-04-30 22:06:02 +03:00
A u d i t R u l e s . c p p
S t r i n g U t i l s . c p p
K e r n e l I n f o . c p p
V e r s i o n . c p p
I O . c p p
U n i x D o m a i n W r i t e r . c p p
E x e c U t i l . c p p
F i l e U t i l s . c p p
U n i x D o m a i n L i s t e n e r . c p p
E v e n t . c p p
2019-05-09 23:34:17 +03:00
U s e r D B . c p p
2019-04-30 22:06:02 +03:00
)
# See https://gcc.gnu.org/onlinedocs/libstdc++/manual/license.html
# and https://www.gnu.org/licenses/gcc-exception-3.1-faq.en.html
# for why it is safe to use -static-libgcc -static-libstdc++
#set_target_properties(auoms PROPERTIES LINK_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-z,relro -Wl,-z,now -Wl,--wrap=memcpy -static-libgcc -static-libstdc++ -Wl,--no-as-needed -lrt -Wl,--as-needed")
2019-07-26 00:16:49 +03:00
#set_target_properties(auomsctl PROPERTIES LINK_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-z,relro -Wl,-z,now -static-libgcc -static-libstdc++ -Wl,--no-as-needed -lrt -Wl,--as-needed")
2019-04-30 22:06:02 +03:00
target_link_libraries ( auomsctl
p t h r e a d
r t
)
install ( TARGETS
a u o m s c t l
R U N T I M E D E S T I N A T I O N $ { C M A K E _ B I N A R Y _ D I R } / r e l e a s e / b i n
)
add_executable ( testreceiver
t e s t r e c e i v e r . c p p
2017-09-30 02:25:45 +03:00
E v e n t . c p p
L o g g e r . c p p
2019-04-30 22:06:02 +03:00
U n i x D o m a i n L i s t e n e r . c p p
2016-11-18 23:02:01 +03:00
)
2019-07-26 00:16:49 +03:00
#set_target_properties(testreceiver PROPERTIES LINK_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-z,relro -Wl,-z,now -static-libgcc -static-libstdc++ -Wl,--no-as-needed -lrt -Wl,--as-needed")
2016-11-18 23:02:01 +03:00
install ( TARGETS
2019-04-30 22:06:02 +03:00
t e s t r e c e i v e r
2016-11-18 23:02:01 +03:00
R U N T I M E D E S T I N A T I O N $ { C M A K E _ B I N A R Y _ D I R } / r e l e a s e / b i n
2017-05-22 14:13:32 +03:00
)
add_executable ( fakeaudispd
f a k e a u d i s p d . c p p
)
2019-07-26 00:16:49 +03:00
#set_target_properties(fakeaudispd PROPERTIES LINK_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-z,relro -Wl,-z,now -static-libgcc -static-libstdc++ -Wl,--no-as-needed -lrt -Wl,--as-needed")
2017-05-22 14:13:32 +03:00
install ( TARGETS
f a k e a u d i s p d
R U N T I M E D E S T I N A T I O N $ { C M A K E _ B I N A R Y _ D I R } / r e l e a s e / b i n
)
2019-04-30 22:06:02 +03:00
add_executable ( file2sock
f i l e 2 s o c k . c p p
U n i x D o m a i n W r i t e r . c p p
I O . c p p
L o g g e r . c p p
E v e n t . c p p
2017-05-22 14:13:32 +03:00
)
2019-07-26 00:16:49 +03:00
#set_target_properties(file2sock PROPERTIES LINK_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-z,relro -Wl,-z,now -static-libgcc -static-libstdc++ -Wl,--no-as-needed -lrt -Wl,--as-needed")
2017-05-22 14:13:32 +03:00
install ( TARGETS
2019-04-30 22:06:02 +03:00
f i l e 2 s o c k
2017-05-22 14:13:32 +03:00
R U N T I M E D E S T I N A T I O N $ { C M A K E _ B I N A R Y _ D I R } / r e l e a s e / b i n
)
2016-11-18 23:02:01 +03:00
#Setup CMake to run tests
enable_testing ( )
#Prep ourselves for compiling boost
find_package ( Boost 1.48 COMPONENTS unit_test_framework REQUIRED )
include_directories ( ${ Boost_INCLUDE_DIRS } )
add_executable ( ConfigTests
T e m p F i l e . c p p
C o n f i g . c p p
C o n f i g T e s t s . c p p
)
target_link_libraries ( ConfigTests ${ Boost_LIBRARIES } )
add_test ( Config ${ CMAKE_BINARY_DIR } /ConfigTests --log_sink=ConfigTests.log --report_sink=ConfigTests.report )
add_executable ( EventTests
T e m p F i l e . c p p
L o g g e r . c p p
Q u e u e . c p p
E v e n t . c p p
E v e n t T e s t s . c p p
)
target_link_libraries ( EventTests ${ Boost_LIBRARIES } )
add_test ( Event ${ CMAKE_BINARY_DIR } /EventTests --log_sink=EventTests.log --report_sink=EventTests.report )
add_executable ( QueueTests
T e m p F i l e . c p p
L o g g e r . c p p
Q u e u e . c p p
Q u e u e T e s t s . c p p
)
target_link_libraries ( QueueTests ${ Boost_LIBRARIES } )
add_test ( Queue ${ CMAKE_BINARY_DIR } /QueueTests --log_sink=QueueTests.log --report_sink=QueueTests.report )
add_executable ( UserDBTests
T e m p D i r . c p p
L o g g e r . c p p
2019-04-30 22:06:02 +03:00
S i g n a l s . c p p
2016-11-18 23:02:01 +03:00
U s e r D B . c p p
U s e r D B T e s t s . c p p
)
target_link_libraries ( UserDBTests ${ Boost_LIBRARIES } pthread )
add_test ( UserDB ${ CMAKE_BINARY_DIR } /UserDBTests --log_sink=UserDBTests.log --report_sink=UserDBTests.report )
2018-03-24 05:31:41 +03:00
add_executable ( StringTests
S t r i n g U t i l s . c p p
S t r i n g T e s t s . c p p
)
target_link_libraries ( StringTests ${ Boost_LIBRARIES } )
add_test ( String ${ CMAKE_BINARY_DIR } /StringTests --log_sink=StringTests.log --report_sink=StringTests.report )
add_executable ( EventProcessorTests
2019-11-22 23:25:55 +03:00
a u o m s _ v e r s i o n . h
2018-03-24 05:31:41 +03:00
E v e n t P r o c e s s o r T e s t s . c p p
E v e n t . c p p
T e x t E v e n t W r i t e r . c p p
2019-04-30 22:06:02 +03:00
R a w E v e n t P r o c e s s o r . c p p
R a w E v e n t A c c u m u l a t o r . c p p
R a w E v e n t R e c o r d . c p p
2018-03-24 05:31:41 +03:00
S i g n a l s . c p p
L o g g e r . c p p
C o n f i g . c p p
U s e r D B . c p p
R u n B a s e . c p p
P r o c e s s I n f o . c p p
P r o c F i l t e r . c p p
2019-10-07 17:58:47 +03:00
P r o c e s s T r e e . c p p
F i l t e r s E n g i n e . c p p
2018-03-24 05:31:41 +03:00
S t r i n g U t i l s . c p p
T e m p D i r . c p p
T e s t E v e n t D a t a . c p p
2019-04-30 22:06:02 +03:00
T r a n s l a t e R e c o r d T y p e . c p p
T r a n s l a t e S y s c a l l . c p p
T r a n s l a t e F i e l d T y p e . c p p
T r a n s l a t e F i e l d . c p p
T r a n s l a t e A r c h . c p p
I n t e r p r e t . c p p
E x e c v e C o n v e r t e r . c p p
2019-11-22 01:55:06 +03:00
M e t r i c s . c p p
C a c h e . h
2018-03-24 05:31:41 +03:00
)
target_link_libraries ( EventProcessorTests ${ Boost_LIBRARIES }
a u d i t
a u p a r s e
d l
p t h r e a d
r t
)
add_test ( EventProcessor ${ CMAKE_BINARY_DIR } /EventProcessorTests --log_sink=EventProcessorTests.log --report_sink=EventProcessorTests.report )
2019-04-30 22:06:02 +03:00
add_executable ( ExecveConverterTests
E x e c v e C o n v e r t e r T e s t s . c p p
E x e c v e C o n v e r t e r . c p p
E v e n t . c p p
R a w E v e n t A c c u m u l a t o r . c p p
R a w E v e n t R e c o r d . c p p
L o g g e r . c p p
S t r i n g U t i l s . c p p
T r a n s l a t e R e c o r d T y p e . c p p
2019-11-22 01:55:06 +03:00
R u n B a s e . c p p
M e t r i c s . c p p
2019-04-30 22:06:02 +03:00
)
target_link_libraries ( ExecveConverterTests ${ Boost_LIBRARIES }
a u d i t
a u p a r s e
d l
p t h r e a d
r t
)
add_test ( ExecveConverter ${ CMAKE_BINARY_DIR } /ExecveConverterTests --log_sink=ExecveConverterTests.log --report_sink=ExecveConverterTests.report )
2018-03-24 05:31:41 +03:00
add_executable ( OMSEventWriterTests
O M S E v e n t W r i t e r T e s t s . c p p
O M S E v e n t W r i t e r . c p p
2019-10-07 17:58:47 +03:00
T e x t E v e n t W r i t e r C o n f i g . c p p
2018-03-24 05:31:41 +03:00
E v e n t . c p p
T e x t E v e n t W r i t e r . c p p
L o g g e r . c p p
C o n f i g . c p p
S t r i n g U t i l s . c p p
T e s t E v e n t D a t a . c p p
2019-10-07 17:58:47 +03:00
P r o c F i l t e r . c p p
S i g n a l s . c p p
U s e r D B . c p p
R u n B a s e . c p p
2019-11-22 01:55:06 +03:00
E x e c v e C o n v e r t e r . c p p
2018-03-24 05:31:41 +03:00
)
2019-10-07 17:58:47 +03:00
target_link_libraries ( OMSEventWriterTests ${ Boost_LIBRARIES }
p t h r e a d
)
2018-03-24 05:31:41 +03:00
add_test ( OMSEventWriter ${ CMAKE_BINARY_DIR } /OMSEventWriterTests --log_sink=OMSEventWriterTests.log --report_sink=OMSEventWriterTests.report )