diff options
author | adrido <robots_only_adrido@gmx.com> | 2017-06-27 11:54:40 +0200 |
---|---|---|
committer | Loïc Blot <nerzhul@users.noreply.github.com> | 2017-06-27 11:54:40 +0200 |
commit | d7343b6c930d22857f858929ea684acbbeefe482 (patch) | |
tree | a4611d3bc6546af879e8cf433cf49ce8df41ab55 /src/CMakeLists.txt | |
parent | 48cd217e3b6f53af32802c1897ddd1914d215078 (diff) | |
download | minetest-d7343b6c930d22857f858929ea684acbbeefe482.tar.gz minetest-d7343b6c930d22857f858929ea684acbbeefe482.tar.bz2 minetest-d7343b6c930d22857f858929ea684acbbeefe482.zip |
Fix msvc annoyances (#5963)
* MSVC: Fix '/std:c++11' is not a valid compiler option
* MSVC/MINGW: Define 'WIN32_LEAN_AND_MEAN' for the whole project
In some obscure cases 'Windows.h" got includet before that definition, which leaded to compilation warnings+errors
* MSVC: '/arch:SSE' is only available for x86
* MSVC: Fix float conversation
* MSVC/MINGW: use winthreads on Windows
* MSVC: 'USE_CMAKE_CONFIG' might be already definied by CMake build system
* MSVC: Use all available cpu cores for compiling
* Add missing include ctime and use std::time_t
Diffstat (limited to 'src/CMakeLists.txt')
-rw-r--r-- | src/CMakeLists.txt | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 04f4635d1..e03f3f397 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -703,9 +703,12 @@ include(CheckCXXCompilerFlag) if(MSVC) # Visual Studio - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++11") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D WIN32_LEAN_AND_MEAN /MP") # EHa enables SEH exceptions (used for catching segfaults) - set(CMAKE_CXX_FLAGS_RELEASE "/EHa /Ox /GL /FD /MT /GS- /Zi /arch:SSE /fp:fast /D NDEBUG /D _HAS_ITERATOR_DEBUGGING=0 /TP") + set(CMAKE_CXX_FLAGS_RELEASE "/EHa /Ox /GL /FD /MT /GS- /Zi /fp:fast /D NDEBUG /D _HAS_ITERATOR_DEBUGGING=0 /TP") + if(CMAKE_SIZEOF_VOID_P EQUAL 4) + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /arch:SSE") + endif() #set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/LTCG /NODEFAULTLIB:\"libcmtd.lib\" /NODEFAULTLIB:\"libcmt.lib\"") set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/LTCG /INCREMENTAL:NO /DEBUG /OPT:REF /OPT:ICF") @@ -748,6 +751,7 @@ else() if(MINGW) set(OTHER_FLAGS "${OTHER_FLAGS} -mthreads -fexceptions") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DWIN32_LEAN_AND_MEAN") endif() set(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG ${RELEASE_WARNING_FLAGS} ${WARNING_FLAGS} ${OTHER_FLAGS} -Wall -pipe -funroll-loops") |