Module: Demos Branch: cmake Commit: c5cd31b175e39e1ed1eb03bdc99f27601ba79068 URL: http://cgit.freedesktop.org/mesa/demos/commit/?id=c5cd31b175e39e1ed1eb03bdc99f27601ba79068
Author: José Fonseca <[email protected]> Date: Tue Nov 9 12:59:21 2010 +0000 cmake: MSVC portability fixes. --- CMakeLists.txt | 23 +++++++++++++++++++++++ 1 files changed, 23 insertions(+), 0 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 852a887..1426ce1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,7 +15,30 @@ find_path (GLEW_INCLUDE_DIR GL/glew.h ) if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") + # Nobody likes to include windows.h: + # - Microsoft's GL/gl.h header depends on windows.h but doesn't include it; + # - GLEW temporarily defines the necessary defines but undefines them later + # - certain GLUT distributions don't include it; + # - most of our programs are meant to be portable so don't include it. + # + # We could try to replicate the windows.h definitions required by + # GL/gl.h, but the build time savings don't compensate the constant + # headaches that brings, so instead we force windows.h to be included + # on every file. + if (MSVC) + add_definitions (-FIwindows.h) + else (MSVC) + add_definitions (--include windows.h) + endif (MSVC) + link_libraries (winmm) endif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") +if (MSVC) + # Silence several MSVC pedantic warnings + add_definitions (-D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -DCRT_NONSTDC_NO_WARNINGS) + add_definitions (-D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS) + add_definitions (-wd4244) # conversion' conversion from 'type1' to 'type2', possible loss of data +endif (MSVC) + add_subdirectory (src) _______________________________________________ mesa-commit mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/mesa-commit
