Update ConfigureWindows to latest version (supports MSVC_RUNTIME_LIBRARY)
Remove old policy 0048. Is not used since CMake 3.1
MODIFY
CMakeLists.txt
CMakeLists.txt
cmake_minimum_required(VERSION 3.7)
-cmake_policy(SET CMP0048 NEW)
+cmake_policy(SET CMP0091 NEW) # Support MSVC_RUNTIME_LIBRARY
project(liblcf VERSION 0.6.2 LANGUAGES CXX)

MODIFY
builds/cmake/Modules/ConfigureWindows.cmake
builds/cmake/Modules/ConfigureWindows.cmake
if(WIN32)
+ # Target Unicode API
+ add_definitions(-D_UNICODE)
+ add_definitions(-DUNICODE)
+
+ # Disable API deprecation warnings
+ add_definitions(-D_CRT_SECURE_NO_WARNINGS)
+
+ # Prevent some Windows.h global namespace pollution
+ add_definitions(-DNOMINMAX)
+ add_definitions(-DWIN32_LEAN_AND_MEAN)
+endif()
+
+if(MSVC)
+ if(${CMAKE_VERSION} VERSION_LESS "3.15.0")
+ message(WARNING "Your CMake version is older than 3.15")
+ message(WARNING "For proper MSVC runtime library support upgrade to a newer version")
+
option(SHARED_RUNTIME "Windows: Build using the shared runtime library (/MD), disable for static runtime (/MT)" ON)
# Set compiler options.
@@ -27,22 +44,16 @@ if(WIN32)
endif()
endforeach()
endif()
-
- # Target Unicode API
- add_definitions(-D_UNICODE)
- add_definitions(-DUNICODE)
-
- # Disable API deprecation warnings
- add_definitions(-D_CRT_SECURE_NO_WARNINGS)
-
- # Prevent some Windows.h global namespace pollution
- add_definitions(-DNOMINMAX)
- add_definitions(-DWIN32_LEAN_AND_MEAN)
+ else()
+ # Depends on vcpkg but we don't support anything else
+ set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>$<$<STREQUAL:${VCPKG_CRT_LINKAGE},dynamic>:DLL>" CACHE STRING "")
endif()
-if(MSVC)
option(MSVC_MULTICORE "MSVC: Build using multiple cores (/MP)" ON)
if (MSVC_MULTICORE)
- add_compile_options(/MP)
+ add_compile_options("/MP")
endif()
+
+ # Interpret character literals as UTF-8
+ add_compile_options("/utf-8")
endif()

Update ConfigureWindows to latest version (supports MSVC_RUNTIME_LIBRARY)

Remove old policy 0048. Is not used since CMake 3.1