• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2016 The Chromium Embedded Framework Authors. All rights
2# reserved. Use of this source code is governed by a BSD-style license that
3# can be found in the LICENSE file.
4
5# Must be loaded via FindCEF.cmake.
6if(NOT DEFINED _CEF_ROOT_EXPLICIT)
7  message(FATAL_ERROR "Use find_package(CEF) to load this file.")
8endif()
9
10
11#
12# Shared configuration.
13#
14
15# Determine the platform.
16if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
17  set(OS_MAC 1)
18  set(OS_MACOSX 1)  # For backwards compatibility.
19  set(OS_POSIX 1)
20elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
21  set(OS_LINUX 1)
22  set(OS_POSIX 1)
23elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
24  set(OS_WINDOWS 1)
25endif()
26
27# Determine the project architecture.
28if(NOT DEFINED PROJECT_ARCH)
29  if(OS_WINDOWS AND "${CMAKE_GENERATOR_PLATFORM}" STREQUAL "arm64")
30    set(PROJECT_ARCH "arm64")
31  elseif(CMAKE_SIZEOF_VOID_P MATCHES 8)
32    set(PROJECT_ARCH "x86_64")
33  else()
34    set(PROJECT_ARCH "x86")
35  endif()
36
37  if(OS_MAC)
38    # PROJECT_ARCH should be specified on Mac OS X.
39    message(WARNING "No PROJECT_ARCH value specified, using ${PROJECT_ARCH}")
40  endif()
41endif()
42
43if(${CMAKE_GENERATOR} STREQUAL "Ninja")
44  set(GEN_NINJA 1)
45elseif(${CMAKE_GENERATOR} STREQUAL "Unix Makefiles")
46  set(GEN_MAKEFILES 1)
47endif()
48
49# Determine the build type.
50if(NOT CMAKE_BUILD_TYPE AND (GEN_NINJA OR GEN_MAKEFILES))
51  # CMAKE_BUILD_TYPE should be specified when using Ninja or Unix Makefiles.
52  set(CMAKE_BUILD_TYPE Release)
53  message(WARNING "No CMAKE_BUILD_TYPE value selected, using ${CMAKE_BUILD_TYPE}")
54endif()
55
56
57# Path to the include directory.
58set(CEF_INCLUDE_PATH "${_CEF_ROOT}")
59
60# Path to the libcef_dll_wrapper target.
61set(CEF_LIBCEF_DLL_WRAPPER_PATH "${_CEF_ROOT}/libcef_dll")
62
63
64# Shared compiler/linker flags.
65list(APPEND CEF_COMPILER_DEFINES
66  # Allow C++ programs to use stdint.h macros specified in the C99 standard that aren't
67  # in the C++ standard (e.g. UINT8_MAX, INT64_MIN, etc)
68  __STDC_CONSTANT_MACROS __STDC_FORMAT_MACROS
69  )
70
71
72# Configure use of the sandbox.
73option(USE_SANDBOX "Enable or disable use of the sandbox." ON)
74
75
76#
77# Linux configuration.
78#
79
80if(OS_LINUX)
81  # Platform-specific compiler/linker flags.
82  set(CEF_LIBTYPE SHARED)
83  list(APPEND CEF_COMPILER_FLAGS
84    -fno-strict-aliasing            # Avoid assumptions regarding non-aliasing of objects of different types
85    -fPIC                           # Generate position-independent code for shared libraries
86    -fstack-protector               # Protect some vulnerable functions from stack-smashing (security feature)
87    -funwind-tables                 # Support stack unwinding for backtrace()
88    -fvisibility=hidden             # Give hidden visibility to declarations that are not explicitly marked as visible
89    --param=ssp-buffer-size=4       # Set the minimum buffer size protected by SSP (security feature, related to stack-protector)
90    -pipe                           # Use pipes rather than temporary files for communication between build stages
91    -pthread                        # Use the pthread library
92    -Wall                           # Enable all warnings
93    -Werror                         # Treat warnings as errors
94    -Wno-missing-field-initializers # Don't warn about missing field initializers
95    -Wno-unused-parameter           # Don't warn about unused parameters
96    -Wno-error=comment              # Don't warn about code in comments
97    -Wno-comment                    # Don't warn about code in comments
98    -Wno-deprecated-declarations    # Don't warn about using deprecated methods
99    )
100  list(APPEND CEF_C_COMPILER_FLAGS
101    -std=c99                        # Use the C99 language standard
102    )
103  list(APPEND CEF_CXX_COMPILER_FLAGS
104    -fno-exceptions                 # Disable exceptions
105    -fno-rtti                       # Disable real-time type information
106    -fno-threadsafe-statics         # Don't generate thread-safe statics
107    -fvisibility-inlines-hidden     # Give hidden visibility to inlined class member functions
108    -std=gnu++11                    # Use the C++11 language standard including GNU extensions
109    -Wsign-compare                  # Warn about mixed signed/unsigned type comparisons
110    )
111  list(APPEND CEF_COMPILER_FLAGS_DEBUG
112    -O0                             # Disable optimizations
113    -g                              # Generate debug information
114    )
115  list(APPEND CEF_COMPILER_FLAGS_RELEASE
116    -O2                             # Optimize for maximum speed
117    -fdata-sections                 # Enable linker optimizations to improve locality of reference for data sections
118    -ffunction-sections             # Enable linker optimizations to improve locality of reference for function sections
119    -fno-ident                      # Ignore the #ident directive
120    -U_FORTIFY_SOURCE               # Undefine _FORTIFY_SOURCE in case it was previously defined
121    -D_FORTIFY_SOURCE=2             # Add memory and string function protection (security feature, related to stack-protector)
122    )
123  list(APPEND CEF_LINKER_FLAGS
124    -fPIC                           # Generate position-independent code for shared libraries
125    -pthread                        # Use the pthread library
126    -Wl,--disable-new-dtags         # Don't generate new-style dynamic tags in ELF
127    -Wl,--fatal-warnings            # Treat warnings as errors
128    -Wl,-rpath,.                    # Set rpath so that libraries can be placed next to the executable
129    -Wl,-z,noexecstack              # Mark the stack as non-executable (security feature)
130    -Wl,-z,now                      # Resolve symbols on program start instead of on first use (security feature)
131    -Wl,-z,relro                    # Mark relocation sections as read-only (security feature)
132    )
133  list(APPEND CEF_LINKER_FLAGS_RELEASE
134    -Wl,-O1                         # Enable linker optimizations
135    -Wl,--as-needed                 # Only link libraries that export symbols used by the binary
136    -Wl,--gc-sections               # Remove unused code resulting from -fdata-sections and -function-sections
137    )
138  list(APPEND CEF_COMPILER_DEFINES
139    _FILE_OFFSET_BITS=64            # Allow the Large File Support (LFS) interface to replace the old interface
140    )
141  list(APPEND CEF_COMPILER_DEFINES_RELEASE
142    NDEBUG                          # Not a debug build
143    )
144
145  include(CheckCCompilerFlag)
146  include(CheckCXXCompilerFlag)
147
148  CHECK_CXX_COMPILER_FLAG(-Wno-undefined-var-template COMPILER_SUPPORTS_NO_UNDEFINED_VAR_TEMPLATE)
149  if(COMPILER_SUPPORTS_NO_UNDEFINED_VAR_TEMPLATE)
150    list(APPEND CEF_CXX_COMPILER_FLAGS
151      -Wno-undefined-var-template   # Don't warn about potentially uninstantiated static members
152      )
153  endif()
154
155  CHECK_C_COMPILER_FLAG(-Wno-unused-local-typedefs COMPILER_SUPPORTS_NO_UNUSED_LOCAL_TYPEDEFS)
156  if(COMPILER_SUPPORTS_NO_UNUSED_LOCAL_TYPEDEFS)
157    list(APPEND CEF_C_COMPILER_FLAGS
158      -Wno-unused-local-typedefs  # Don't warn about unused local typedefs
159      )
160  endif()
161
162  CHECK_CXX_COMPILER_FLAG(-Wno-literal-suffix COMPILER_SUPPORTS_NO_LITERAL_SUFFIX)
163  if(COMPILER_SUPPORTS_NO_LITERAL_SUFFIX)
164    list(APPEND CEF_CXX_COMPILER_FLAGS
165      -Wno-literal-suffix         # Don't warn about invalid suffixes on literals
166      )
167  endif()
168
169  CHECK_CXX_COMPILER_FLAG(-Wno-narrowing COMPILER_SUPPORTS_NO_NARROWING)
170  if(COMPILER_SUPPORTS_NO_NARROWING)
171    list(APPEND CEF_CXX_COMPILER_FLAGS
172      -Wno-narrowing              # Don't warn about type narrowing
173      )
174  endif()
175
176  if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
177    list(APPEND CEF_CXX_COMPILER_FLAGS
178      -Wno-attributes             # The cfi-icall attribute is not supported by the GNU C++ compiler
179      )
180  endif()
181
182  if(PROJECT_ARCH STREQUAL "x86_64")
183    # 64-bit architecture.
184    list(APPEND CEF_COMPILER_FLAGS
185      -m64
186      -march=x86-64
187      )
188    list(APPEND CEF_LINKER_FLAGS
189      -m64
190      )
191  elseif(PROJECT_ARCH STREQUAL "x86")
192    # 32-bit architecture.
193    list(APPEND CEF_COMPILER_FLAGS
194      -msse2
195      -mfpmath=sse
196      -mmmx
197      -m32
198      )
199    list(APPEND CEF_LINKER_FLAGS
200      -m32
201      )
202  endif()
203
204  # Standard libraries.
205  set(CEF_STANDARD_LIBS
206    X11
207    )
208
209  # CEF directory paths.
210  set(CEF_RESOURCE_DIR        "${_CEF_ROOT}/Resources")
211  set(CEF_BINARY_DIR          "${_CEF_ROOT}/${CMAKE_BUILD_TYPE}")
212  set(CEF_BINARY_DIR_DEBUG    "${_CEF_ROOT}/Debug")
213  set(CEF_BINARY_DIR_RELEASE  "${_CEF_ROOT}/Release")
214
215  # CEF library paths.
216  set(CEF_LIB_DEBUG   "${CEF_BINARY_DIR_DEBUG}/libcef.so")
217  set(CEF_LIB_RELEASE "${CEF_BINARY_DIR_RELEASE}/libcef.so")
218
219  # List of CEF binary files.
220  set(CEF_BINARY_FILES
221    chrome-sandbox
222    libcef.so
223    libEGL.so
224    libGLESv2.so
225    snapshot_blob.bin
226    v8_context_snapshot.bin
227    swiftshader
228    )
229
230  # List of CEF resource files.
231  set(CEF_RESOURCE_FILES
232    chrome_100_percent.pak
233    chrome_200_percent.pak
234    resources.pak
235    icudtl.dat
236    locales
237    )
238
239  if(USE_SANDBOX)
240    list(APPEND CEF_COMPILER_DEFINES
241      CEF_USE_SANDBOX   # Used by apps to test if the sandbox is enabled
242      )
243  endif()
244endif()
245
246
247#
248# Mac OS X configuration.
249#
250
251if(OS_MAC)
252  # Platform-specific compiler/linker flags.
253  # See also Xcode target properties in cef_macros.cmake.
254  set(CEF_LIBTYPE SHARED)
255  list(APPEND CEF_COMPILER_FLAGS
256    -fno-strict-aliasing            # Avoid assumptions regarding non-aliasing of objects of different types
257    -fstack-protector               # Protect some vulnerable functions from stack-smashing (security feature)
258    -funwind-tables                 # Support stack unwinding for backtrace()
259    -fvisibility=hidden             # Give hidden visibility to declarations that are not explicitly marked as visible
260    -Wall                           # Enable all warnings
261    -Werror                         # Treat warnings as errors
262    -Wextra                         # Enable additional warnings
263    -Wendif-labels                  # Warn whenever an #else or an #endif is followed by text
264    -Wnewline-eof                   # Warn about no newline at end of file
265    -Wno-missing-field-initializers # Don't warn about missing field initializers
266    -Wno-unused-parameter           # Don't warn about unused parameters
267    )
268  list(APPEND CEF_C_COMPILER_FLAGS
269    -std=c99                        # Use the C99 language standard
270    )
271  list(APPEND CEF_CXX_COMPILER_FLAGS
272    -fno-exceptions                 # Disable exceptions
273    -fno-rtti                       # Disable real-time type information
274    -fno-threadsafe-statics         # Don't generate thread-safe statics
275    -fobjc-call-cxx-cdtors          # Call the constructor/destructor of C++ instance variables in ObjC objects
276    -fvisibility-inlines-hidden     # Give hidden visibility to inlined class member functions
277    -std=gnu++11                    # Use the C++11 language standard including GNU extensions
278    -Wno-narrowing                  # Don't warn about type narrowing
279    -Wsign-compare                  # Warn about mixed signed/unsigned type comparisons
280    )
281  list(APPEND CEF_COMPILER_FLAGS_DEBUG
282    -O0                             # Disable optimizations
283    -g                              # Generate debug information
284    )
285  list(APPEND CEF_COMPILER_FLAGS_RELEASE
286    -O3                             # Optimize for maximum speed plus a few extras
287    )
288  list(APPEND CEF_LINKER_FLAGS
289    -Wl,-search_paths_first         # Search for static or shared library versions in the same pass
290    -Wl,-ObjC                       # Support creation of ObjC static libraries
291    -Wl,-pie                        # Generate position-independent code suitable for executables only
292    )
293  list(APPEND CEF_LINKER_FLAGS_RELEASE
294    -Wl,-dead_strip                 # Strip dead code
295    )
296
297  include(CheckCXXCompilerFlag)
298
299  CHECK_CXX_COMPILER_FLAG(-Wno-undefined-var-template COMPILER_SUPPORTS_NO_UNDEFINED_VAR_TEMPLATE)
300  if(COMPILER_SUPPORTS_NO_UNDEFINED_VAR_TEMPLATE)
301    list(APPEND CEF_CXX_COMPILER_FLAGS
302      -Wno-undefined-var-template   # Don't warn about potentially uninstantiated static members
303      )
304  endif()
305
306  # Standard libraries.
307  set(CEF_STANDARD_LIBS
308    -lpthread
309    "-framework Cocoa"
310    "-framework AppKit"
311    )
312
313  # Find the newest available base SDK.
314  execute_process(COMMAND xcode-select --print-path OUTPUT_VARIABLE XCODE_PATH OUTPUT_STRIP_TRAILING_WHITESPACE)
315  foreach(OS_VERSION 10.15 10.14 10.13 10.12 10.11)
316    set(SDK "${XCODE_PATH}/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${OS_VERSION}.sdk")
317    if(NOT "${CMAKE_OSX_SYSROOT}" AND EXISTS "${SDK}" AND IS_DIRECTORY "${SDK}")
318      set(CMAKE_OSX_SYSROOT ${SDK})
319    endif()
320  endforeach()
321
322  # Target SDK.
323  set(CEF_TARGET_SDK               "10.11")
324  list(APPEND CEF_COMPILER_FLAGS
325    -mmacosx-version-min=${CEF_TARGET_SDK}
326  )
327  set(CMAKE_OSX_DEPLOYMENT_TARGET  ${CEF_TARGET_SDK})
328
329  # Target architecture.
330  if(PROJECT_ARCH STREQUAL "x86_64")
331    set(CMAKE_OSX_ARCHITECTURES "x86_64")
332  elseif(PROJECT_ARCH STREQUAL "arm64")
333    set(CMAKE_OSX_ARCHITECTURES "arm64")
334  else()
335    set(CMAKE_OSX_ARCHITECTURES "i386")
336  endif()
337
338  # Prevent Xcode 11 from doing automatic codesigning.
339  set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "")
340
341  # CEF directory paths.
342  set(CEF_BINARY_DIR          "${_CEF_ROOT}/$<CONFIGURATION>")
343  set(CEF_BINARY_DIR_DEBUG    "${_CEF_ROOT}/Debug")
344  set(CEF_BINARY_DIR_RELEASE  "${_CEF_ROOT}/Release")
345
346  if(USE_SANDBOX)
347    list(APPEND CEF_COMPILER_DEFINES
348      CEF_USE_SANDBOX   # Used by apps to test if the sandbox is enabled
349      )
350
351    # CEF sandbox library paths.
352    set(CEF_SANDBOX_LIB_DEBUG "${CEF_BINARY_DIR_DEBUG}/cef_sandbox.a")
353    set(CEF_SANDBOX_LIB_RELEASE "${CEF_BINARY_DIR_RELEASE}/cef_sandbox.a")
354  endif()
355
356  # CEF Helper app suffixes.
357  # Format is "<name suffix>:<target suffix>:<plist suffix>".
358  set(CEF_HELPER_APP_SUFFIXES
359    "::"
360    " (GPU):_gpu:.gpu"
361    " (Plugin):_plugin:.plugin"
362    " (Renderer):_renderer:.renderer"
363    )
364endif()
365
366
367#
368# Windows configuration.
369#
370
371if(OS_WINDOWS)
372  if (GEN_NINJA)
373    # When using the Ninja generator clear the CMake defaults to avoid excessive
374    # console warnings (see issue #2120).
375    set(CMAKE_CXX_FLAGS "")
376    set(CMAKE_CXX_FLAGS_DEBUG "")
377    set(CMAKE_CXX_FLAGS_RELEASE "")
378  endif()
379
380  if(USE_SANDBOX)
381    # Check if the current MSVC version is compatible with the cef_sandbox.lib
382    # static library. We require VS2015 or newer.
383    if(MSVC_VERSION LESS 1900)
384      message(WARNING "CEF sandbox is not compatible with the current MSVC version (${MSVC_VERSION})")
385      set(USE_SANDBOX OFF)
386    endif()
387  endif()
388
389  # Consumers who run into LNK4099 warnings can pass /Z7 instead (see issue #385).
390  set(CEF_DEBUG_INFO_FLAG "/Zi" CACHE STRING "Optional flag specifying specific /Z flag to use")
391
392  # Consumers using different runtime types may want to pass different flags
393  set(CEF_RUNTIME_LIBRARY_FLAG "/MT" CACHE STRING "Optional flag specifying which runtime to use")
394  if (CEF_RUNTIME_LIBRARY_FLAG)
395    list(APPEND CEF_COMPILER_FLAGS_DEBUG ${CEF_RUNTIME_LIBRARY_FLAG}d)
396    list(APPEND CEF_COMPILER_FLAGS_RELEASE ${CEF_RUNTIME_LIBRARY_FLAG})
397  endif()
398
399  # Platform-specific compiler/linker flags.
400  set(CEF_LIBTYPE STATIC)
401  list(APPEND CEF_COMPILER_FLAGS
402    /MP           # Multiprocess compilation
403    /Gy           # Enable function-level linking
404    /GR-          # Disable run-time type information
405    /W4           # Warning level 4
406    /WX           # Treat warnings as errors
407    /wd4100       # Ignore "unreferenced formal parameter" warning
408    /wd4127       # Ignore "conditional expression is constant" warning
409    /wd4244       # Ignore "conversion possible loss of data" warning
410    /wd4481       # Ignore "nonstandard extension used: override" warning
411    /wd4512       # Ignore "assignment operator could not be generated" warning
412    /wd4701       # Ignore "potentially uninitialized local variable" warning
413    /wd4702       # Ignore "unreachable code" warning
414    /wd4996       # Ignore "function or variable may be unsafe" warning
415    ${CEF_DEBUG_INFO_FLAG}
416    )
417  list(APPEND CEF_COMPILER_FLAGS_DEBUG
418    /RTC1         # Disable optimizations
419    /Od           # Enable basic run-time checks
420    )
421  list(APPEND CEF_COMPILER_FLAGS_RELEASE
422    /O2           # Optimize for maximum speed
423    /Ob2          # Inline any suitable function
424    /GF           # Enable string pooling
425    )
426  list(APPEND CEF_LINKER_FLAGS_DEBUG
427    /DEBUG        # Generate debug information
428    )
429  list(APPEND CEF_EXE_LINKER_FLAGS
430    /MANIFEST:NO        # No default manifest (see ADD_WINDOWS_MANIFEST macro usage)
431    /LARGEADDRESSAWARE  # Allow 32-bit processes to access 3GB of RAM
432    )
433  list(APPEND CEF_COMPILER_DEFINES
434    WIN32 _WIN32 _WINDOWS             # Windows platform
435    UNICODE _UNICODE                  # Unicode build
436    WINVER=0x0601 _WIN32_WINNT=0x601  # Targeting Windows 7
437    NOMINMAX                          # Use the standard's templated min/max
438    WIN32_LEAN_AND_MEAN               # Exclude less common API declarations
439    _HAS_EXCEPTIONS=0                 # Disable exceptions
440    )
441  list(APPEND CEF_COMPILER_DEFINES_RELEASE
442    NDEBUG _NDEBUG                    # Not a debug build
443    )
444
445  # Standard libraries.
446  set(CEF_STANDARD_LIBS
447    comctl32.lib
448    rpcrt4.lib
449    shlwapi.lib
450    ws2_32.lib
451    )
452
453  # CEF directory paths.
454  set(CEF_RESOURCE_DIR        "${_CEF_ROOT}/Resources")
455  set(CEF_BINARY_DIR          "${_CEF_ROOT}/$<CONFIGURATION>")
456  set(CEF_BINARY_DIR_DEBUG    "${_CEF_ROOT}/Debug")
457  set(CEF_BINARY_DIR_RELEASE  "${_CEF_ROOT}/Release")
458
459  # CEF library paths.
460  set(CEF_LIB_DEBUG   "${CEF_BINARY_DIR_DEBUG}/libcef.lib")
461  set(CEF_LIB_RELEASE "${CEF_BINARY_DIR_RELEASE}/libcef.lib")
462
463  # List of CEF binary files.
464  set(CEF_BINARY_FILES
465    chrome_elf.dll
466    libcef.dll
467    libEGL.dll
468    libGLESv2.dll
469    snapshot_blob.bin
470    v8_context_snapshot.bin
471    swiftshader
472    )
473
474  if(NOT PROJECT_ARCH STREQUAL "arm64")
475    list(APPEND CEF_BINARY_FILES
476      d3dcompiler_47.dll
477      )
478  endif()
479
480  # List of CEF resource files.
481  set(CEF_RESOURCE_FILES
482    chrome_100_percent.pak
483    chrome_200_percent.pak
484    resources.pak
485    icudtl.dat
486    locales
487    )
488
489  if(USE_SANDBOX)
490    list(APPEND CEF_COMPILER_DEFINES
491      PSAPI_VERSION=1   # Required by cef_sandbox.lib
492      CEF_USE_SANDBOX   # Used by apps to test if the sandbox is enabled
493      )
494    list(APPEND CEF_COMPILER_DEFINES_DEBUG
495      _HAS_ITERATOR_DEBUGGING=0   # Disable iterator debugging
496      )
497
498    # Libraries required by cef_sandbox.lib.
499    set(CEF_SANDBOX_STANDARD_LIBS
500      Advapi32.lib
501      dbghelp.lib
502      Delayimp.lib
503      OleAut32.lib
504      PowrProf.lib
505      Propsys.lib
506      psapi.lib
507      SetupAPI.lib
508      Shell32.lib
509      version.lib
510      wbemuuid.lib
511      winmm.lib
512      )
513
514    # CEF sandbox library paths.
515    set(CEF_SANDBOX_LIB_DEBUG "${CEF_BINARY_DIR_DEBUG}/cef_sandbox.lib")
516    set(CEF_SANDBOX_LIB_RELEASE "${CEF_BINARY_DIR_RELEASE}/cef_sandbox.lib")
517  endif()
518
519  # Configure use of ATL.
520  option(USE_ATL "Enable or disable use of ATL." ON)
521  if(USE_ATL)
522    # Locate the atlmfc directory if it exists. It may be at any depth inside
523    # the VC directory. The cl.exe path returned by CMAKE_CXX_COMPILER may also
524    # be at different depths depending on the toolchain version
525    # (e.g. "VC/bin/cl.exe", "VC/bin/amd64_x86/cl.exe",
526    # "VC/Tools/MSVC/14.10.25017/bin/HostX86/x86/cl.exe", etc).
527    set(HAS_ATLMFC 0)
528    get_filename_component(VC_DIR ${CMAKE_CXX_COMPILER} DIRECTORY)
529    get_filename_component(VC_DIR_NAME ${VC_DIR} NAME)
530    while(NOT ${VC_DIR_NAME} STREQUAL "VC")
531      get_filename_component(VC_DIR ${VC_DIR} DIRECTORY)
532      if(IS_DIRECTORY "${VC_DIR}/atlmfc")
533        set(HAS_ATLMFC 1)
534        break()
535      endif()
536      get_filename_component(VC_DIR_NAME ${VC_DIR} NAME)
537    endwhile()
538
539    # Determine if the Visual Studio install supports ATL.
540    if(NOT HAS_ATLMFC)
541      message(WARNING "ATL is not supported by your VC installation.")
542      set(USE_ATL OFF)
543    endif()
544  endif()
545
546  if(USE_ATL)
547    list(APPEND CEF_COMPILER_DEFINES
548      CEF_USE_ATL   # Used by apps to test if ATL support is enabled
549      )
550  endif()
551endif()
552