-# Require at least version 2.8.12 of CMake
-cmake_minimum_required(VERSION 2.8.12)
+# Require at least version 3.5.1 of CMake
+cmake_minimum_required(VERSION 3.5.1)
-if (CMAKE_CONFIGURATION_TYPES) # multi-configuration generator?
- set(CMAKE_CONFIGURATION_TYPES "Debug;Checked;Release;RelWithDebInfo" CACHE STRING "" FORCE)
-endif (CMAKE_CONFIGURATION_TYPES)
-set(CMAKE_C_FLAGS_CHECKED "")
-set(CMAKE_CXX_FLAGS_CHECKED "")
-set(CMAKE_EXE_LINKER_FLAGS_CHECKED "")
-set(CMAKE_SHARED_LINKER_FLAGS_CHECKED "")
+cmake_policy(SET CMP0042 NEW)
set(INC_PLATFORM_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src/Common/Platform)
if (WIN32)
- add_definitions(-DWINDOWS=1)
-
- if (DEFINED ENV{__ToolsetDir})
- # Hack for private Tool Set
- # CMAKE_CXX_COMPILER will default to the compiler installed with
- # Visual studio. Overwrite it to the compiler on the path.
-
- find_program(PATH_CXX_COMPILER cl)
- set(CMAKE_CXX_COMPILER ${PATH_CXX_COMPILER})
-
- message("Overwriting the CMAKE_CXX_COMPILER.")
- message("CMAKE_CXX_COMPILER found:${CMAKE_CXX_COMPILER}")
-
- # Temporary until cmake has VS generators for hacky toolsets [arm64]
- set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /machine:${CLR_CMAKE_TARGET_ARCH}")
- set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} /machine:${CLR_CMAKE_TARGET_ARCH}")
- set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /machine:${CLR_CMAKE_TARGET_ARCH}")
- endif()
+ add_definitions(-DWINDOWS)
endif()
+# Verify that LTCG/LTO is available
+include(${CMAKE_CURRENT_SOURCE_DIR}/../configure.cmake)
+# Include global configure settings
+include(${CMAKE_CURRENT_SOURCE_DIR}/../configurecompiler.cmake)
# Compile options
if (WIN32)
- add_compile_options(-wd4100 -wd4514 -wd4668 -wd4710 -wd4711 -wd4820)
+ # 4100 - unreferenced formal parameter
+ # 4514 - unreferenced inline function has been removed
+ # 4625 - copy constructor was implicitly defined as deleted because a base class copy constructor is inaccessible or deleted
+ # 4626 - assignment operator was implicitly defined as deleted because a base class assignment operator is inaccessible or deleted
+ # 4668 - 'symbol' is not defined as a preprocessor macro, replacing with '0' for 'directives'
+ # 4710 - function not inlined
+ # 4711 - 'function' selected for inline expansion
+ # 4774 - format string expected in argument number is not a string literal
+ # 4820 - bytes padding added after construct 'member_name'
+ # 5025 - move assignment operator was implicitly defined as deleted
+ # 5026 - move constructor was implicitly defined as deleted
+ # 5027 - move assignment operator was implicitly defined as deleted
+ # 5039 - pointer or reference to potentially throwing function passed to extern C function under -EHc. Undefined behavior may occur if this function throws an exception.
+ add_compile_options(-wd4100 -wd4514 -wd4625 -wd4626 -wd4668 -wd4710 -wd4711 -wd4774 -wd4820 -wd5025 -wd5026 -wd5027 -wd5039)
+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc")
endif()
if(CLR_CMAKE_PLATFORM_UNIX)