@@ -103,26 +103,6 @@ if(${CMAKE_VERSION} GREATER "3.12")
103103 cmake_policy (SET CMP0077 NEW)
104104endif ()
105105
106- if (OS_WINDOWS)
107- add_link_options (/DEBUG)
108-
109- if (USE_SANDBOX)
110- # cef_sandbox.lib is MT already, must keep the same with it
111- set (CEF_RUNTIME_LIBRARY_FLAG "/MT" CACHE STRING "Use static runtime" )
112- add_compile_options ("/MT$<$<CONFIG:Debug>:d>" )
113- else ()
114- # either MT or MD is supported
115- set (CEF_RUNTIME_LIBRARY_FLAG "/M$<IF:$<BOOL:${STATIC_CRT} >,T,D>" CACHE STRING "Use static runtime" FORCE)
116- add_compile_options ("/M$<IF:$<BOOL:${STATIC_CRT} >,T,D>$<$<CONFIG:Debug>:d>" )
117- endif ()
118- else ()
119- add_compile_options (
120- "-g"
121- "$<$<CONFIG:DEBUG>:-O0>"
122- "$<$<CONFIG:RELEASE>:-O3>"
123- )
124- endif ()
125-
126106# Append CEF root dir to CMAKE_MODULE_PATH
127107set (CEF_ROOT "${CEF_SDK_DIR} " )
128108list (APPEND CMAKE_MODULE_PATH "${CEF_ROOT} /cmake" )
@@ -131,14 +111,6 @@ find_package(CEF REQUIRED)
131111# Add libcef dll wrapper
132112add_subdirectory (${CEF_LIBCEF_DLL_WRAPPER_PATH} libcef_dll_wrapper)
133113
134- if (USE_SANDBOX AND (OS_WINDOWS OR OS_MACOS))
135- add_definitions (-DCEF_USE_SANDBOX)
136-
137- # message(STATUS "cef_sandbox_lib path:" "${CEF_SANDBOX_LIB_DEBUG}," "${CEF_SANDBOX_LIB_RELEASE}" )
138- # Logical target used to link the cef_sandbox library.
139- ADD_LOGICAL_TARGET("cef_sandbox_lib" "${CEF_SANDBOX_LIB_DEBUG} " "${CEF_SANDBOX_LIB_RELEASE} " )
140- endif ()
141-
142114PRINT_CEF_CONFIG()
143115
144116# #################################################################################
@@ -189,3 +161,34 @@ if(${Need_Config_CefVersion_File})
189161else ()
190162 message (STATUS "No need to configure CefVersion.h file" )
191163endif ()
164+
165+ # config CEF sandbox
166+ if (OS_MACOS OR OS_WINDOWS)
167+ if (CEF_VERSION_MAJOR LESS 138)
168+ if (USE_SANDBOX)
169+ add_definitions (-DCEF_USE_SANDBOX)
170+ message (STATUS "cef_sandbox_lib path:" "${CEF_SANDBOX_LIB_DEBUG} ," "${CEF_SANDBOX_LIB_RELEASE} " )
171+ ADD_LOGICAL_TARGET("cef_sandbox_lib" "${CEF_SANDBOX_LIB_DEBUG} " "${CEF_SANDBOX_LIB_RELEASE} " )
172+ endif ()
173+ endif ()
174+ endif ()
175+
176+ if (OS_WINDOWS)
177+ add_link_options (/DEBUG)
178+
179+ if (USE_SANDBOX AND (CEF_VERSION_MAJOR LESS 138))
180+ # cef_sandbox.lib is MT already, must keep the same with it
181+ set (CEF_RUNTIME_LIBRARY_FLAG "/MT" CACHE STRING "Use static runtime" )
182+ add_compile_options ("/MT$<$<CONFIG:Debug>:d>" )
183+ else ()
184+ # either MT or MD is supported
185+ set (CEF_RUNTIME_LIBRARY_FLAG "/M$<IF:$<BOOL:${STATIC_CRT} >,T,D>" CACHE STRING "Use static runtime" FORCE)
186+ add_compile_options ("/M$<IF:$<BOOL:${STATIC_CRT} >,T,D>$<$<CONFIG:Debug>:d>" )
187+ endif ()
188+ else ()
189+ add_compile_options (
190+ "-g"
191+ "$<$<CONFIG:DEBUG>:-O0>"
192+ "$<$<CONFIG:RELEASE>:-O3>"
193+ )
194+ endif ()
0 commit comments