I'm using Visual Studio
to compile a C++
project using CMake
as the build system.
Furthermore I'm linking against the Boost
library. The output executable however will not run if the following Boost
DLL
s are not found in the PATH
environment variable: boost_filesystem-vc141-mt-x64-1_69.dll
and boost_iostreams-vc141-mt-x64-1_69.dll
.
According to the documentation, I tried using the /MT
("Causes the application to use the multithread, static version of the run-time library") and also the /MD
("Causes the application to use the multithread-specific and DLL-specific version of the run-time library") compilation flag but besides affecting the file size, the DLL
dependence on Boost
did not change.
I also specified the following CMake
variables:
set(BOOST_USE_STATIC_LIBS ON)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)
This did not force static linking against the Boost
libraries either. I want to generate an executable which does not dynamically depend on Boost
but only on the core C++
runtime libraries so any other machine can run it without shipping Boost
or any Boost
DLL
s. It is totally fine if the file size increases quite a bit.
Adding the following preprocessor define to main.cpp
does not work either:
#define BOOST_ALL_NO_LIB 1
How can I really build the standalone executable?