Fix some issues when using MSVC.

There are still issues remaining, but this fixes some of them. The other
issues are still being investigated.
This commit is contained in:
Mark de Wever 2012-07-15 20:48:32 +00:00
parent a9732b47fb
commit 6f0ffcf9df
2 changed files with 16 additions and 0 deletions

View file

@ -178,6 +178,17 @@ endif(NOT DEFINED CXX_FLAGS_USER)
### Set default Wesnoth project compiler flags
if(MSVC AND NOT DEFINED CXX_FLAGS_MSVC)
# MSVC sets some initial compilation flags, these need to
# be preserved.
set(CXX_FLAGS_MSVC
"${CMAKE_CXX_FLAGS_INIT}"
CACHE
STRING
"The initial CXX flags for MSVC"
FORCE
)
endif(MSVC AND NOT DEFINED CXX_FLAGS_MSVC)
set(CXX_FLAGS_PROJECT)
check_compiler_has_flag(CXX_FLAGS_PROJECT "-std=c++98" HAS_COMPILER_FLAG_STD)
@ -271,6 +282,9 @@ check_compiler_has_flag(
### Set the final compiler flags.
set(COMPILER_FLAGS "${CXX_FLAGS_PROJECT}")
if(MSVC)
set(COMPILER_FLAGS "${CXX_FLAGS_MSVC} ${COMPILER_FLAGS}")
endif(MSVC)
if(ENABLE_STRICT_COMPILATION)
set(COMPILER_FLAGS "${COMPILER_FLAGS} ${CXX_FLAGS_STRICT_COMPILATION}")
endif(ENABLE_STRICT_COMPILATION)

View file

@ -285,6 +285,8 @@ CMAKE_CXX_FLAGS are used.
The CMAKE_CXX_FLAGS are controlled by CMake and should not be set by the user.
They are generated by the following parts:
- CXX_FLAGS_MSVC These flags are determined by CMake when using MSVC. They are
stored so the can be preserved.
- CXX_FLAGS_PROJECT The default flags for all programs in the Wesnoth. These
flags are determined by the Wesnoth developers.
- CXX_FLAGS_STRICT_COMPILATION The flags used for strict compilation. Whether