Skip to content

Commit b73776f

Browse files
committed
cmake: Fix MSVC warnings
1 parent e87f5a6 commit b73776f

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@ OPTION(ENABLE_CXX11 "Enable C++11 support" OFF)
2727
OPTION(ENABLE_OPENCL "Enable OpenCL support" ON)
2828
OPTION(ENABLE_OPENGL "Enable OpenGL support" ON)
2929

30+
IF(MSVC)
31+
# suppress several "possible loss of data" warnings, and
32+
# "zero-length array in struct" from libusb.h
33+
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4267 /wd4244 /wd4200 /wd4305 /wd4146")
34+
ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS) # no warning for getenv()
35+
ENDIF()
36+
3037
IF(ENABLE_CXX11)
3138
INCLUDE(CheckCXXCompilerFlag)
3239
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)

include/internal/libfreenect2/logging.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ std::string getShortName(const char *func);
6666

6767
} /* namespace libfreenect2 */
6868

69-
#if defined(__GNUC__) or defined(__clang__)
69+
#if defined(__GNUC__) || defined(__clang__)
7070
#define LOG_SOURCE ::libfreenect2::getShortName(__PRETTY_FUNCTION__)
7171
#elif defined(_MSC_VER)
7272
#define LOG_SOURCE ::libfreenect2::getShortName(__FUNCSIG__)

src/opengl_depth_packet_processor.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,8 +387,9 @@ struct Texture : public WithOpenGLBindings
387387
}
388388
};
389389

390-
struct OpenGLDepthPacketProcessorImpl : public WithOpenGLBindings, public WithPerfLogging
390+
class OpenGLDepthPacketProcessorImpl : public WithOpenGLBindings, public WithPerfLogging
391391
{
392+
public:
392393
GLFWwindow *opengl_context_ptr;
393394
libfreenect2::DepthPacketProcessor::Config config;
394395

0 commit comments

Comments
 (0)