FindBoost fails to find static debug libraries
When building boost as static library with debug flags your libraries will be compiled with name e.g.: libboost_filesystem-vc140-mt-sgd-x64-1_71.lib
Note in particular the -sgd-
in the name.
When running FindBoost with Boost_DEBUG enabled you get the following output:
Searching for FILESYSTEM_LIBRARY_DEBUG: libboost_filesystem-vc140-mt-gd-x64-1_71;libboost_filesystem-vc140-mt-gd-x64;libboost_filesystem-vc140-mt-gd;libboost_filesystem-mt-gd-x64-1_71;libboost_filesystem-mt-gd-x64;libboost_filesystem-mt-gd;libboost_filesystem-mt;libboost_filesystem;libboost_filesystem-vc140-mt-s-gd-x64-1_71;libboost_filesystem-vc140-mt-s-gd-x64;libboost_filesystem-vc140-mt-s-gd;libboost_filesystem-mt-s-gd-x64-1_71;libboost_filesystem-mt-s-gd-x64;libboost_filesystem-mt-s-gd
In particular note the libboost_filesystem-vc140-mt-s-gd-x64-1_71
which is correct except for the dash between s-gd
.
If I specify Boost_USE_STATIC_RUNTIME
everything works and the -sgd-
version is found (and listed in the Searching ... output).
If this parameter is not set the workaround in line 2111 is used. Since _boost_DEBUG_ABI_TAG
contains a -
already this goes bad so instead of
set(_boost_DEBUG_STATIC_ABI_TAG "-s${_boost_DEBUG_ABI_TAG}")
we should have something like
string(SUBSTRING ${_boost_DEBUG_ABI_TAG} 1 -1 _boost_DEBUG_ABI_TAG_NO_DASH)
set(_boost_DEBUG_STATIC_ABI_TAG "-s${_boost_DEBUG_ABI_TAG_NO_DASH}")
Note, this is untested and might need a guard against zero length _boost_DEBUG_ABI_TAG
.
Cheers, Arno