diff --git a/.travis.yml b/.travis.yml index c039373..5476be0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,7 +25,9 @@ before_install: sudo apt-get install python-software-properties; sudo apt-get update; sudo apt-get install gcc-5 g++-5; - sudo add-apt-repository --yes ppa:kalakris/cmake; + sudo apt-get install software-properties-common; + sudo add-apt-repository -y ppa:george-edison55/cmake-3.x; + sudo apt-get update; sudo apt-get update -qq; sudo apt-get install cmake; fi diff --git a/CMakeLists.txt b/CMakeLists.txt index 11298f5..47eb352 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -46,7 +46,7 @@ # # ============================================================================ -cmake_minimum_required (VERSION 2.8) +cmake_minimum_required (VERSION 3.1) ENABLE_LANGUAGE(CXX) set(CMAKE_BUILD_TYPE Release) diff --git a/example/main_contract.cpp b/example/main_contract.cpp index e20bf39..fa6441b 100644 --- a/example/main_contract.cpp +++ b/example/main_contract.cpp @@ -30,6 +30,11 @@ namespace example_fatal } } // example fatal +#ifdef CHANGE_G3LOG_DEBUG_TO_DBUG +#undef DEBUG +#define DEBUG DBUG +#endif + int main(int argc, char **argv) { double pi_d = 3.1415926535897932384626433832795; diff --git a/example/main_fatal_choice.cpp b/example/main_fatal_choice.cpp index d0101f0..7cf591b 100644 --- a/example/main_fatal_choice.cpp +++ b/example/main_fatal_choice.cpp @@ -24,6 +24,11 @@ #define NOEXCEPT throw() #endif +#ifdef CHANGE_G3LOG_DEBUG_TO_DBUG +#undef DEBUG +#define DEBUG DBUG +#endif + namespace { #if (defined(WIN32) || defined(_WIN32) || defined(__WIN32__)) diff --git a/example/main_sigsegv.cpp b/example/main_sigsegv.cpp index 7b6cf30..5316624 100644 --- a/example/main_sigsegv.cpp +++ b/example/main_sigsegv.cpp @@ -22,6 +22,11 @@ namespace #endif } +#ifdef CHANGE_G3LOG_DEBUG_TO_DBUG +#undef DEBUG +#define DEBUG DBUG +#endif + namespace example_fatal { // on Ubunti this caused get a compiler warning with gcc4.6 diff --git a/src/g3log/logcapture.hpp b/src/g3log/logcapture.hpp index 4787a09..a9e7b49 100644 --- a/src/g3log/logcapture.hpp +++ b/src/g3log/logcapture.hpp @@ -16,6 +16,9 @@ #include #include #include +#ifdef _MSC_VER +# include +#endif /** * Simple struct for capturing log/fatal entries. At destruction the captured message is @@ -49,8 +52,17 @@ struct LogCapture { // Ref: http://www.unixwiz.net/techtips/gnu-c-attributes.html #ifndef __GNUC__ #define __attribute__(x) // Disable 'attributes' if compiler does not support 'em +#endif +#ifdef _MSC_VER +# if _MSC_VER >= 1400 +# define G3LOG_FORMAT_STRING _Printf_format_string_ +# else +# define G3LOG_FORMAT_STRING __format_string +# endif +#else +# define G3LOG_FORMAT_STRING #endif - void capturef(const char *printf_like_message, ...) __attribute__((format(printf, 2, 3))); // 2,3 ref: http://www.codemaestro.com/reviews/18 + void capturef(G3LOG_FORMAT_STRING const char *printf_like_message, ...) __attribute__((format(printf, 2, 3))); // 2,3 ref: http://www.codemaestro.com/reviews/18 /// prettifying API for this completely open struct diff --git a/test_unit/testing_helpers.h b/test_unit/testing_helpers.h index be7e764..839f6d0 100644 --- a/test_unit/testing_helpers.h +++ b/test_unit/testing_helpers.h @@ -135,6 +135,9 @@ private: }; } // testing_helpers - +#ifdef CHANGE_G3LOG_DEBUG_TO_DBUG +#undef DEBUG +#define DEBUG DBUG +#endif