Open lishaojiang opened 10 months ago
well done , I find one solution! Just use bleow code in Google BenchMark every CMakeLists.txt file! I find 4 cmakelists.txt file in my pc!
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
add_compile_options(/MT)
endif()
The original method didn't work, anyone know why
if (MSVC)
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MT")
endif
Describe the bug A clear and concise description of what the bug is.
I have download and compile and test Google BenchMark success on My Linux, My Mac. but On My Windows PC , I get an error when other project link the benchmark!
I know this is because the benchmark project is a lib generated by MD, but the test project regards it as MT, so the link is wrong.
I am forced to manually modify the benchmark attribute to MT then build and then manually copy it to the installation directory . it can work well.
I have tried the code below adding to CMakeLists.txt, it don't work!
or adding MT to the build script, but it has no effect!
cmake -E chdir "build" cmake -DCMAKE_CXX_FLAGS_RELEASE=/MT -DCMAKE_CXX_FLAGS=/MT -DBENCHMARK_DOWNLOAD_DEPENDENCIES=on -DCMAKE_BUILD_TYPE=Release ../
System Which OS, compiler, and compiler version are you using:
To reproduce Steps to reproduce the behavior: install.bat
then other project use the google bench
CMakeLists.txt
Expected behavior A clear and concise description of what you expected to happen. How Can fix the google benchmark MD to MT auto
Screenshots If applicable, add screenshots to help explain your problem.
Additional context Add any other context about the problem here.