mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-22 21:36:11 +01:00
Merge branch 'windows-header-defines' of https://github.com/horenmar/Catch
This commit is contained in:
commit
2e87f8e328
@ -69,6 +69,13 @@ You may also suppress any of these features by using the `_NO_` form, e.g. `CATC
|
|||||||
|
|
||||||
All C++11 support can be disabled with `CATCH_CONFIG_NO_CPP11`
|
All C++11 support can be disabled with `CATCH_CONFIG_NO_CPP11`
|
||||||
|
|
||||||
|
# Windows header clutter
|
||||||
|
|
||||||
|
On Windows Catch includes `windows.h`. To minimize global namespace clutter in the implementation file, it defines `NOMINMAX` and `WIN32_LEAN_AND_MEAN` before including it. You can control this behaviour via two macros:
|
||||||
|
|
||||||
|
CATCH_CONFIG_NO_NOMINMAX // Stops Catch from using NOMINMAX macro
|
||||||
|
CATCH_CONFIG_NO_WIN32_LEAN_AND_MEAN // Stops Catch from using WIN32_LEAN_AND_MEAN macro
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
[Home](Readme.md)
|
[Home](Readme.md)
|
@ -41,15 +41,7 @@ namespace Catch {
|
|||||||
|
|
||||||
#if defined ( CATCH_CONFIG_COLOUR_WINDOWS ) /////////////////////////////////////////
|
#if defined ( CATCH_CONFIG_COLOUR_WINDOWS ) /////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef NOMINMAX
|
#include "catch_windows_h_proxy.h"
|
||||||
#define NOMINMAX
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __AFXDLL
|
|
||||||
#include <AfxWin.h>
|
|
||||||
#else
|
|
||||||
#include <windows.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace Catch {
|
namespace Catch {
|
||||||
namespace {
|
namespace {
|
||||||
|
@ -13,10 +13,16 @@
|
|||||||
# define CATCH_PLATFORM_MAC
|
# define CATCH_PLATFORM_MAC
|
||||||
#elif defined(__IPHONE_OS_VERSION_MIN_REQUIRED)
|
#elif defined(__IPHONE_OS_VERSION_MIN_REQUIRED)
|
||||||
# define CATCH_PLATFORM_IPHONE
|
# define CATCH_PLATFORM_IPHONE
|
||||||
#elif defined(WIN32) || defined(__WIN32__) || defined(_WIN32) || defined(_MSC_VER)
|
|
||||||
#define CATCH_PLATFORM_WINDOWS
|
|
||||||
#elif defined(linux) || defined(__linux) || defined(__linux__)
|
#elif defined(linux) || defined(__linux) || defined(__linux__)
|
||||||
# define CATCH_PLATFORM_LINUX
|
# define CATCH_PLATFORM_LINUX
|
||||||
|
#elif defined(WIN32) || defined(__WIN32__) || defined(_WIN32) || defined(_MSC_VER)
|
||||||
|
# define CATCH_PLATFORM_WINDOWS
|
||||||
|
# if !defined(NOMINMAX) && !defined(CATCH_CONFIG_NO_NOMINMAX)
|
||||||
|
# define CATCH_DEFINES_NOMINMAX
|
||||||
|
# endif
|
||||||
|
# if !defined(WIN32_LEAN_AND_MEAN) && !defined(CATCH_CONFIG_NO_WIN32_LEAN_AND_MEAN)
|
||||||
|
# define CATCH_DEFINES_WIN32_LEAN_AND_MEAN
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // TWOBLUECUBES_CATCH_PLATFORM_H_INCLUDED
|
#endif // TWOBLUECUBES_CATCH_PLATFORM_H_INCLUDED
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CATCH_PLATFORM_WINDOWS
|
#ifdef CATCH_PLATFORM_WINDOWS
|
||||||
#include <windows.h>
|
#include "catch_windows_h_proxy.h"
|
||||||
#else
|
#else
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#endif
|
#endif
|
||||||
|
32
include/internal/catch_windows_h_proxy.h
Normal file
32
include/internal/catch_windows_h_proxy.h
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
/*
|
||||||
|
* Created by Martin on 16/01/2017.
|
||||||
|
*
|
||||||
|
* Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||||
|
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef TWOBLUECUBES_CATCH_WINDOWS_H_PROXY_H_INCLUDED
|
||||||
|
#define TWOBLUECUBES_CATCH_WINDOWS_H_PROXY_H_INCLUDED
|
||||||
|
|
||||||
|
#ifdef CATCH_DEFINES_NOMINMAX
|
||||||
|
# define NOMINMAX
|
||||||
|
#endif
|
||||||
|
#ifdef CATCH_DEFINES_WIN32_LEAN_AND_MEAN
|
||||||
|
# define WIN32_LEAN_AND_MEAN
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __AFXDLL
|
||||||
|
#include <AfxWin.h>
|
||||||
|
#else
|
||||||
|
#include <windows.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CATCH_DEFINES_NOMINMAX
|
||||||
|
# undef NOMINMAX
|
||||||
|
#endif
|
||||||
|
#ifdef CATCH_DEFINES_WIN32_LEAN_AND_MEAN
|
||||||
|
# undef WIN32_LEAN_AND_MEAN
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#endif // TWOBLUECUBES_CATCH_WINDOWS_H_PROXY_H_INCLUDED
|
Loading…
Reference in New Issue
Block a user