diff --git a/CMakeLists.txt.in b/CMakeLists.txt.in index 79df12b53..3b2a784f7 100644 --- a/CMakeLists.txt.in +++ b/CMakeLists.txt.in @@ -48,13 +48,13 @@ # libgtkglext1-dev (required by the cefclient target only) # # - Mac OS X requirements: -# Xcode 5 or newer building on Mac OS X 10.9 (Mavericks) or newer. Xcode 7.2 -# and OS X 10.11 are recommended. The Xcode command-line tools must also be +# Xcode 5 or newer building on Mac OS X 10.9 (Mavericks) or newer. Xcode 8.3 +# and OS X 10.12 are recommended. The Xcode command-line tools must also be # installed. Only 64-bit builds are supported on OS X. # # - Windows requirements: # Visual Studio 2010 or newer building on Windows 7 or newer. Visual Studio -# 2015 Update 2 and Windows 10 64-bit are recommended. +# 2015 Update 3 and Windows 10 64-bit are recommended. # # BUILD EXAMPLES # diff --git a/cmake/cef_macros.cmake.in b/cmake/cef_macros.cmake.in index 6daa9fbef..26e2fc187 100644 --- a/cmake/cef_macros.cmake.in +++ b/cmake/cef_macros.cmake.in @@ -19,7 +19,7 @@ macro(PRINT_CEF_CONFIG) message(STATUS "Platform: ${CMAKE_SYSTEM_NAME}") message(STATUS "Project architecture: ${PROJECT_ARCH}") - if(${CMAKE_GENERATOR} STREQUAL "Ninja" OR ${CMAKE_GENERATOR} STREQUAL "Unix Makefiles") + if(GEN_NINJA OR GEN_MAKEFILES) message(STATUS "Build type: ${CMAKE_BUILD_TYPE}") endif() @@ -81,8 +81,7 @@ endmacro() # Determine the target output directory based on platform and generator. macro(SET_CEF_TARGET_OUT_DIR) - if(${CMAKE_GENERATOR} STREQUAL "Ninja" OR - ${CMAKE_GENERATOR} STREQUAL "Unix Makefiles") + if(GEN_NINJA OR GEN_MAKEFILES) # By default Ninja and Make builds don't create a subdirectory named after # the configuration. set(CEF_TARGET_OUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}") diff --git a/cmake/cef_variables.cmake.in b/cmake/cef_variables.cmake.in index 94b4b875c..39d501622 100644 --- a/cmake/cef_variables.cmake.in +++ b/cmake/cef_variables.cmake.in @@ -37,9 +37,14 @@ if(NOT DEFINED PROJECT_ARCH) endif() endif() +if(${CMAKE_GENERATOR} STREQUAL "Ninja") + set(GEN_NINJA 1) +elseif(${CMAKE_GENERATOR} STREQUAL "Unix Makefiles") + set(GEN_MAKEFILES 1) +endif() + # Determine the build type. -if(NOT CMAKE_BUILD_TYPE AND - (${CMAKE_GENERATOR} STREQUAL "Ninja" OR ${CMAKE_GENERATOR} STREQUAL "Unix Makefiles")) +if(NOT CMAKE_BUILD_TYPE AND (GEN_NINJA OR GEN_MAKEFILES)) # CMAKE_BUILD_TYPE should be specified when using Ninja or Unix Makefiles. set(CMAKE_BUILD_TYPE Release) message(WARNING "No CMAKE_BUILD_TYPE value selected, using ${CMAKE_BUILD_TYPE}") @@ -314,6 +319,14 @@ endif() # if(OS_WINDOWS) + if (GEN_NINJA) + # When using the Ninja generator clear the CMake defaults to avoid excessive + # console warnings (see issue #2120). + set(CMAKE_CXX_FLAGS "") + set(CMAKE_CXX_FLAGS_DEBUG "") + set(CMAKE_CXX_FLAGS_RELEASE "") + endif() + # Configure use of the sandbox. option(USE_SANDBOX "Enable or disable use of the sandbox." ON) if(USE_SANDBOX AND NOT MSVC_VERSION EQUAL 1900) @@ -359,8 +372,13 @@ if(OS_WINDOWS) # defaults here. set(CMAKE_CXX_FLAGS_DEBUG "") + # These flags are required to successfully link and run applications using + # the sandbox library. list(APPEND CEF_COMPILER_FLAGS_DEBUG /MT # Multithreaded release runtime + /O2 # Maximize speed optimization + /Zc:inline # Remove unreferenced functions or data + /Oy- # Disable frame-pointer omission ) else() list(APPEND CEF_COMPILER_FLAGS_DEBUG @@ -463,10 +481,19 @@ if(OS_WINDOWS) # Configure use of ATL. option(USE_ATL "Enable or disable use of ATL." ON) if(USE_ATL) + # Locate the VC directory. The cl.exe path returned by CMAKE_CXX_COMPILER + # may be at different directory depths depending on the toolchain version + # (e.g. "VC/bin/cl.exe", "VC/bin/amd64_x86/cl.exe", etc). + get_filename_component(VC_DIR ${CMAKE_CXX_COMPILER} DIRECTORY) + get_filename_component(VC_DIR_NAME ${VC_DIR} NAME) + while(NOT ${VC_DIR_NAME} STREQUAL "VC") + get_filename_component(VC_DIR ${VC_DIR} DIRECTORY) + get_filename_component(VC_DIR_NAME ${VC_DIR} NAME) + endwhile() + # Determine if the Visual Studio install supports ATL. - get_filename_component(VC_BIN_DIR ${CMAKE_CXX_COMPILER} DIRECTORY) - get_filename_component(VC_DIR ${VC_BIN_DIR} DIRECTORY) if(NOT IS_DIRECTORY "${VC_DIR}/atlmfc") + message(WARNING "ATL is not supported by your VC installation.") set(USE_ATL OFF) endif() endif()