mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
CMake configuration improvements (issue #2120)
- Windows: Fix excessive Ninja build warnings. - Windows: Fix ATL detection for different VC toolchain paths. - Windows: Fix Ninja Debug build when official build sandbox is enabled. - Update build tool version recommendations.
This commit is contained 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()
|
||||
|
Reference in New Issue
Block a user