diff options
author | José Fonseca <jfonseca@vmware.com> | 2010-11-09 12:59:21 +0000 |
---|---|---|
committer | José Fonseca <jfonseca@vmware.com> | 2010-11-09 12:59:21 +0000 |
commit | c5cd31b175e39e1ed1eb03bdc99f27601ba79068 (patch) | |
tree | 52e4f63fadddf61a8c37d10e63e3a561a3bc54a0 /CMakeLists.txt | |
parent | b8dda2e6edac09aaf86f2560c2ca72feb8d34733 (diff) |
cmake: MSVC portability fixes.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 852a8870..1426ce1c 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) |