libcef_dll_wrapper.lib(command_line_ctocpp.obj) : error LNK2038: Mismatched 'RuntimeLibrary' detected: 'MT_StaticRelease' value does not match 'MD_DynamicRelease' value (located in main.obj)
I try to set and clean, it still warn.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MD")
# or
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MT")
The CEF project file semi-hardcodes MSVC runtime flag in CEF_RUNTIME_LIBRARY_FLAG cache variable (in ./cmake/cef_variables.cmake), so you might want to patch that. Or provide desired value with -D on configuration.
add_executable(test ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp )
target_link_libraries(test PUBLIC ${CEF_LIBRARIES})
libcpmt.lib(StlLCMapStringA.obj) : error LNK2038: Mismatched 'RuntimeLibrary' detected: 'MT_StaticRelease' value does not match 'MD_DynamicRelease' value (located in base_client_handler.cc.obj)
Building library tests\cefclient\cefclient.lib and object tests\cefclient\cefclient.exp
LINK : warning LNK4098
do you know why it use MD_DynamicRelease?
I alreay check the cef lib build with /MT
So it would seem that your project is using MD_DynamicRelease, wouldn’t it? Then you either set the same value on configuring CEF or set the CEF value on your project configuration. But what I would do is delete that entire block from CEF project file, as one rarely needs to hardcode MSVC runtime linking type, especially given that one’s project might be used in other people projects.
If I build cef lib with /MT and link it to my project that build with vs2022.
Follow this message, the linker setting in your Visual Studio project are set to dynamically link (meaning the link will occur during runtime, usually with a .dll file).
But I create my project with cmake project, so I don’t have the IDE to set the Runtime Library.
Do you have the recommend cmake command to set the Runtime Library to static on my project ?