Thomas Heller wrote:
One way to go here is to have one Config.cmake for each build type. For example structured like this:
lib/cmake/boost-vc141-mt-1_65-dynamic/boost_system-config.cmake lib/cmake/boost-vc141-mt-1_65-static/boost_system-config.cmake lib/cmake/boost-vc141-mt-gd-1_65-dynamic/boost_system-config.cmake lib/cmake/boost-vc141-mt-gd-1_65-static/boost_system-config.cmake lib/cmake/boost-vc141-mt-s-1_65-dynamic/boost_system-config.cmake lib/cmake/boost-vc141-mt-s-1_65-static/boost_system-config.cmake lib/cmake/boost-vc141-mt-sgd-1_65-dynamic/boost_system-config.cmake lib/cmake/boost-vc141-mt-sgd-1_65-static/boost_system-config.cmake
I was thinking of something similar; since CMake will ignore suffix, one could install lib/cmake/boost_system-config-vc141-mt-dyn-1_65.cmake and so on. Inside, each config would only define its target if the properties match, and define nothing otherwise. But I'm not sure if CMake works this way, or it just picks up the first one it finds. Or, the same conditional game could be played in the -version file instead. For the actual selection, we probably need to define variables such as BOOST_BUILD_VARIANT, BOOST_RUNTIME_LINK, BOOST_RUNTIME_DEBUGGING, BOOST_TOOLSET_ID and do some heroic autodetection when these aren't set depending on the current CMake environment. Having the logic repeated in each config file won't be pretty though. Ideally, we'll be able to get it into CMake itself one day, else, we need to install a file containing it and include it from the config/version ones.