g3log/example/Example.cmake

47 lines
1.8 KiB
CMake
Raw Permalink Normal View History

# g3log is a KjellKod Logger
# 2015 @author Kjell Hedström, hedstrom@kjellkod.cc
# ==================================================================
# 2015 by KjellKod.cc. This is PUBLIC DOMAIN to use at your own
# risk and comes with no warranties.
#
# This code is yours to share, use and modify with no strings attached
# and no restrictions or obligations.
# ===================================================================
# ==============================================================
2014-10-03 08:56:13 +02:00
# -DUSE_SIMPLE_EXAMPLE=OFF : to turn off the fatal examples
#
#
# Leaving it to ON will create
# g3log-FATAL-sigsegv
# g3log-FATAL-contract
#
# ==============================================================
Gimesketvirtadien's time requested changes (#104) * Added "removeSink" method and related functionality to LogWorker API * Added a new API for plugging in custom Timestamp generator. * Revert "Added "removeSink" method and related functionality to LogWorker API" This reverts commit c9cee5d9a077ce1e7e68f07cc30d03e4bed19c7b. * Dropping shared_ptr<Timestamp> in log messages and using regular vars * Moving to standard timespec struct from custom Timestamp * Wiring timespec timestamps with formating routine * Falling back to clock_gettime * Reverting g3 API changes * Optimizing format string generation * Removed _microseconds from LogMessage * Implemented sec fractional format key * Optimization of format string generation * Adjusting comments * Refining localtime_formatted by introducing two helper functions * refactored and simplified code * fixed up some commented away unit tests * refactoring message specifics tests to it's own test * Use gcc 4.9 * C++14 for Linux * Update .travis.yml * Update buildAndRunTests.sh * lower case in `-std=c++14` * -lrt flag for gcc * Added support for high precision clock on Linux/gcc (already there now for OSX). Windows is still missing * intermediate comments * Clarified for some code readers the mysterious use of assert in an expression that is always true * refactored + renamed functions and constants. Added unit test for retrieving fractional type * committing changes previously fixed - finished unit testing for g3::internal::time::GetFractional(..) * added unit test for fractional to string * added missing unit tests for localtime_formatted * fixed? nano / microsec functionality to timer * test
2016-08-11 08:27:52 +02:00
IF (MSVC OR MINGW)
set(EXAMPLE_PLATFORM_LINK_LIBRIES dbghelp)
ENDIF()
2014-10-03 08:56:13 +02:00
set(DIR_EXAMPLE ${g3log_SOURCE_DIR}/example)
option (ADD_FATAL_EXAMPLE "Fatal (fatal-crashes/contract) examples " ON)
2014-10-03 08:56:13 +02:00
IF (ADD_FATAL_EXAMPLE)
message( STATUS "-DADD_FATAL_EXAMPLE=ON" )
message( STATUS "\t\t[contract][sigsegv][fatal choice] are examples of when g3log comes in handy\n" )
2014-10-03 08:56:13 +02:00
include_directories (${DIR_EXAMPLE})
add_executable(g3log-FATAL-contract ${DIR_EXAMPLE}/main_contract.cpp)
add_executable(g3log-FATAL-sigsegv ${DIR_EXAMPLE}/main_sigsegv.cpp)
add_executable(g3log-FATAL-choice ${DIR_EXAMPLE}/main_fatal_choice.cpp)
Gimesketvirtadien's time requested changes (#104) * Added "removeSink" method and related functionality to LogWorker API * Added a new API for plugging in custom Timestamp generator. * Revert "Added "removeSink" method and related functionality to LogWorker API" This reverts commit c9cee5d9a077ce1e7e68f07cc30d03e4bed19c7b. * Dropping shared_ptr<Timestamp> in log messages and using regular vars * Moving to standard timespec struct from custom Timestamp * Wiring timespec timestamps with formating routine * Falling back to clock_gettime * Reverting g3 API changes * Optimizing format string generation * Removed _microseconds from LogMessage * Implemented sec fractional format key * Optimization of format string generation * Adjusting comments * Refining localtime_formatted by introducing two helper functions * refactored and simplified code * fixed up some commented away unit tests * refactoring message specifics tests to it's own test * Use gcc 4.9 * C++14 for Linux * Update .travis.yml * Update buildAndRunTests.sh * lower case in `-std=c++14` * -lrt flag for gcc * Added support for high precision clock on Linux/gcc (already there now for OSX). Windows is still missing * intermediate comments * Clarified for some code readers the mysterious use of assert in an expression that is always true * refactored + renamed functions and constants. Added unit test for retrieving fractional type * committing changes previously fixed - finished unit testing for g3::internal::time::GetFractional(..) * added unit test for fractional to string * added missing unit tests for localtime_formatted * fixed? nano / microsec functionality to timer * test
2016-08-11 08:27:52 +02:00
target_link_libraries(g3log-FATAL-contract ${G3LOG_LIBRARY} ${EXAMPLE_PLATFORM_LINK_LIBRIES})
target_link_libraries(g3log-FATAL-sigsegv ${G3LOG_LIBRARY} ${EXAMPLE_PLATFORM_LINK_LIBRIES})
target_link_libraries(g3log-FATAL-choice ${G3LOG_LIBRARY} ${EXAMPLE_PLATFORM_LINK_LIBRIES})
2014-10-03 08:56:13 +02:00
ELSE()
message( STATUS "-DADD_SIMPLE_EXAMPLE=OFF" )
ENDIF (ADD_FATAL_EXAMPLE)