How to build abseil library with static runtime with cmake

288 Views Asked by At

I need to build abseil with static runtime (/MT and /MTd) rather than with the default dynamic runtime (/MD and /MDd).

I build the abseil library as follows

$git clone https://github.com/abseil/abseil-cpp.git

$cd abseil-cpp

$cmake -G "Visual Studio 17 2022" -A x64 -B "build64" -DCMAKE_INSTALL_PREFIX=./install/build64 .

$cmake --build build64 --config Release --target install

which generates all .lib files under abseil-cpp/install/build64/lib/ directory. The generated .libs have dynamic runtime (/MD). This can be confirmed by opening the Visual studio solution or via the command:

$dumpbin /directives absl_base.lib

My question is how can I build abseil with static runtime (/MT and MTd) instead of (/MD and /MDd)? Is there any cmake switch I can use to trigger that change?

0

There are 0 best solutions below