I am trying to install boost using cmake for my project. From a little study I found that one of the recommended ways to install boost libraries is to use the cmake command find_package (How do you add Boost libraries in CMakeLists.txt?). Below is the command I added in my cmake file
find_package(Boost 1.78 REQUIRED COMPONENTS filesystem nowide)
However, when cmake generates the cache file, it downloads and builds way more boost libraries(if not all) than that are listed above. See the outputs from the commandline below:
1> [CMake] * boost-algorithm[core]:x64-windows -> 1.78.0 -- C:\tools\vcpkg\buildtrees\versioning_\versions\boost-algorithm\eca5eb57117afd2c43e7f00ed6908dabb254b46e
1> [CMake] * boost-align[core]:x64-windows -> 1.78.0 -- C:\tools\vcpkg\buildtrees\versioning_\versions\boost-align\1733cf10f4a598f29af7380a6b8226abdeeb3f75
1> [CMake] * boost-array[core]:x64-windows -> 1.78.0 -- C:\tools\vcpkg\buildtrees\versioning_\versions\boost-array\8278959d326c44d846d660462556ab48361054f9
1> [CMake] * boost-asio[core]:x64-windows -> 1.78.0 -- C:\tools\vcpkg\buildtrees\versioning_\versions\boost-asio\2fcf35cb168a6a2aa56208a83fb71bfdf88672b6
1> [CMake] * boost-assert[core]:x64-windows -> 1.78.0 -- C:\tools\vcpkg\buildtrees\versioning_\versions\boost-assert\81b29f057d38140b3d812094999772d2d5263d4e
1> [CMake] * boost-atomic[core]:x64-windows -> 1.78.0 -- C:\tools\vcpkg\buildtrees\versioning_\versions\boost-atomic\f516c90064f41a11fe7627ab6a8ac281455f55cc
1> [CMake] * boost-bind[core]:x64-windows -> 1.78.0 -- C:\tools\vcpkg\buildtrees\versioning_\versions\boost-bind\165c77e05b1d413a600f66135276ba7e727ebc35
1> [CMake] * boost-build[core]:x64-windows -> 1.78.0#1 -- C:\tools\vcpkg\buildtrees\versioning_\versions\boost-build\cf970c17a4bf6d59deff7ce7e7eb98cec74b544a
1> [CMake] * boost-chrono[core]:x64-windows -> 1.78.0 -- C:\tools\vcpkg\buildtrees\versioning_\versions\boost-chrono\d08ea7bd6fb471393e10507f0b6d27d045868f3e
1> [CMake] * boost-concept-check[core]:x64-windows -> 1.78.0 -- C:\tools\vcpkg\buildtrees\versioning_\versions\boost-concept-check\d92ec4f75e3ca2046f7cc6bd42e394aa642dea7b
1> [CMake] * boost-config[core]:x64-windows -> 1.78.0 -- C:\tools\vcpkg\buildtrees\versioning_\versions\boost-config\b4958f142255c3aa14f1f39d04edcc12b6262745
1> [CMake] * boost-container[core]:x64-windows -> 1.78.0 -- C:\tools\vcpkg\buildtrees\versioning_\versions\boost-container\cba0ae7cefffcca3cc1a0aec45ec07a66f6cc413
1> [CMake] * boost-container-hash[core]:x64-windows -> 1.78.0 -- C:\tools\vcpkg\buildtrees\versioning_\versions\boost-container-hash\5c9a0efa908886517e39510cffaebe78df8bac17
1> [CMake] * boost-context[core]:x64-windows -> 1.78.0 -- C:\tools\vcpkg\buildtrees\versioning_\versions\boost-context\c279fc4862dbbc9b4c685d16d1abee7200f9dff4
1> [CMake] * boost-conversion[core]:x64-windows -> 1.78.0 -- C:\tools\vcpkg\buildtrees\versioning_\versions\boost-conversion\ed01d578d9964b2be3619cd7e96c6f65dc206275
1> [CMake] * boost-core[core]:x64-windows -> 1.78.0 -- C:\tools\vcpkg\buildtrees\versioning_\versions\boost-core\b6d811257b985253c87570f25a75957689b2b895
1> [CMake] * boost-coroutine[core]:x64-windows -> 1.78.0 -- C:\tools\vcpkg\buildtrees\versioning_\versions\boost-coroutine\d462e16750c6769375391d1e1c084999000cb324
1> [CMake] * boost-date-time[core]:x64-windows -> 1.78.0 -- C:\tools\vcpkg\buildtrees\versioning_\versions\boost-date-time\76bf565e940322a7d3110edf1b18fb4bfd8a1ab0
1> [CMake] * boost-detail[core]:x64-windows -> 1.78.0 -- C:\tools\vcpkg\buildtrees\versioning_\versions\boost-detail\61c65e46d0bf619e44cf343d734dda6987f53005
1> [CMake] * boost-exception[core]:x64-windows -> 1.78.0 -- C:\tools\vcpkg\buildtrees\versioning_\versions\boost-exception\02b0e67c7d9b5e26b1bccef1fba3152fe7ead595
1> [CMake] boost-filesystem[core]:x64-windows -> 1.78.0 -- C:\tools\vcpkg\buildtrees\versioning_\versions\boost-filesystem\f7f7b3bf671f25f6234f81de59fb5dc169ea2480
1> [CMake] * boost-function[core]:x64-windows -> 1.78.0 -- C:\tools\vcpkg\buildtrees\versioning_\versions\boost-function\74d9b1e1e9951fe6f6f4eeccddf8c83ff1280462
1> [CMake] * boost-function-types[core]:x64-windows -> 1.78.0 -- C:\tools\vcpkg\buildtrees\versioning_\versions\boost-function-types\94d4dd365c29ad1be2d148f3c4cf7857e3ac1edd
1> [CMake] * boost-fusion[core]:x64-windows -> 1.78.0 -- C:\tools\vcpkg\buildtrees\versioning_\versions\boost-fusion\a7c7b4de2e38c3436c0781ccf4b56567b8c2ae61
1> [CMake] * boost-integer[core]:x64-windows -> 1.78.0 -- C:\tools\vcpkg\buildtrees\versioning_\versions\boost-integer\18f2f923e2a8d4f026787eb8626def460dd2ab6a
1> [CMake] * boost-intrusive[core]:x64-windows -> 1.78.0 -- C:\tools\vcpkg\buildtrees\versioning_\versions\boost-intrusive\351ad9aa5db5bf50ab87a390a69d5df1d2b41ab7
1> [CMake] * boost-io[core]:x64-windows -> 1.78.0 -- C:\tools\vcpkg\buildtrees\versioning_\versions\boost-io\33cc953c79a65bcdfdd7b55a757bf3f4ac4be4bf
1> [CMake] * boost-iterator[core]:x64-windows -> 1.78.0 -- C:\tools\vcpkg\buildtrees\versioning_\versions\boost-iterator\474aefb2b63e5ea3e6794631eab47aa3d6921573
1> [CMake] * boost-lexical-cast[core]:x64-windows -> 1.78.0 -- C:\tools\vcpkg\buildtrees\versioning_\versions\boost-lexical-cast\984ca6d42fd857c08fa915edc02bfcecb02cc343
1> [CMake] * boost-modular-build-helper[core]:x64-windows -> 1.78.0#2 -- C:\tools\vcpkg\buildtrees\versioning_\versions\boost-modular-build-helper\9400b3bfdc93a165b3b509a76c59107c020113a6
1> [CMake] * boost-move[core]:x64-windows -> 1.78.0 -- C:\tools\vcpkg\buildtrees\versioning_\versions\boost-move\a2b516a6391277e0c72147caf8c6677c92bff2a8
1> [CMake] * boost-mp11[core]:x64-windows -> 1.78.0 -- C:\tools\vcpkg\buildtrees\versioning_\versions\boost-mp11\06e8d1438943e47b1b4282964a0d290461ba3387
1> [CMake] * boost-mpl[core]:x64-windows -> 1.78.0 -- C:\tools\vcpkg\buildtrees\versioning_\versions\boost-mpl\a8b09063ef7fce74a9bfc52625ea7bf285cf4a82
1> [CMake] boost-nowide[core]:x64-windows -> 1.78.0 -- C:\tools\vcpkg\buildtrees\versioning_\versions\boost-nowide\c38c862892bc328c743481ee48b3abf50e66a51f
1> [CMake] * boost-numeric-conversion[core]:x64-windows -> 1.78.0 -- C:\tools\vcpkg\buildtrees\versioning_\versions\boost-numeric-conversion\11dcb5d23dd6b1db7138ffe608d76134ce1e4ec5
1> [CMake] * boost-optional[core]:x64-windows -> 1.78.0 -- C:\tools\vcpkg\buildtrees\versioning_\versions\boost-optional\4171d6f66bb828d51bee3de777da9384232b6068
1> [CMake] * boost-pool[core]:x64-windows -> 1.78.0 -- C:\tools\vcpkg\buildtrees\versioning_\versions\boost-pool\8c0061ca841cab5b588ebae9bd1387882eec3435
1> [CMake] * boost-predef[core]:x64-windows -> 1.78.0 -- C:\tools\vcpkg\buildtrees\versioning_\versions\boost-predef\1865984507efa465dea0f7d597528cfedcef0b7e
1> [CMake] * boost-preprocessor[core]:x64-windows -> 1.78.0 -- C:\tools\vcpkg\buildtrees\versioning_\versions\boost-preprocessor\e69da51c3ec0a8086ab18dbf75da11649aed5157
1> [CMake] boost-process[core]:x64-windows -> 1.78.0 -- C:\tools\vcpkg\buildtrees\versioning_\versions\boost-process\669ff76873e507b50238609e17bb0208559cd224
1> [CMake] * boost-range[core]:x64-windows -> 1.78.0 -- C:\tools\vcpkg\buildtrees\versioning_\versions\boost-range\1ec82281ed52b6d4ae225abe93a18392c846cbc9
1> [CMake] * boost-ratio[core]:x64-windows -> 1.78.0 -- C:\tools\vcpkg\buildtrees\versioning_\versions\boost-ratio\a5e0af272c7df2d7994c6d98ad1d76df6b5330f7
1> [CMake] * boost-rational[core]:x64-windows -> 1.78.0 -- C:\tools\vcpkg\buildtrees\versioning_\versions\boost-rational\2a2877b20057e313af02d1307832d90f764b2dc1
1> [CMake] * boost-regex[core]:x64-windows -> 1.78.0 -- C:\tools\vcpkg\buildtrees\versioning_\versions\boost-regex\f04cda8dcb436a4cfaa008331d05ef2d0974b698
1> [CMake] * boost-smart-ptr[core]:x64-windows -> 1.78.0 -- C:\tools\vcpkg\buildtrees\versioning_\versions\boost-smart-ptr\18806e0372da7b7f8b2d6a8ff4bd7bf074a690cd
1> [CMake] * boost-static-assert[core]:x64-windows -> 1.78.0 -- C:\tools\vcpkg\buildtrees\versioning_\versions\boost-static-assert\0d1e3a21f0be997c400b7c60dc2ec1b1beccbe3c
1> [CMake] * boost-system[core]:x64-windows -> 1.78.0 -- C:\tools\vcpkg\buildtrees\versioning_\versions\boost-system\eaab2373181b829bf4cb4ee298dfc9c80e98f01f
1> [CMake] * boost-throw-exception[core]:x64-windows -> 1.78.0 -- C:\tools\vcpkg\buildtrees\versioning_\versions\boost-throw-exception\2ab1c68ab2a41696a5f36841a66178256b8d229e
1> [CMake] * boost-tokenizer[core]:x64-windows -> 1.78.0 -- C:\tools\vcpkg\buildtrees\versioning_\versions\boost-tokenizer\24c6aef67afefb01d20749d7b43790efcb1dfc66
1> [CMake] * boost-tuple[core]:x64-windows -> 1.78.0 -- C:\tools\vcpkg\buildtrees\versioning_\versions\boost-tuple\da0a88c5630fa116b473e02aae6651199529649e
1> [CMake] * boost-type-index[core]:x64-windows -> 1.78.0 -- C:\tools\vcpkg\buildtrees\versioning_\versions\boost-type-index\fac6a10bb329da6cd19cfde9534ef11b3edb8623
1> [CMake] * boost-type-traits[core]:x64-windows -> 1.78.0 -- C:\tools\vcpkg\buildtrees\versioning_\versions\boost-type-traits\8ce0cad0c57f4acd5da2369894a0db64b918ac41
1> [CMake] * boost-typeof[core]:x64-windows -> 1.78.0 -- C:\tools\vcpkg\buildtrees\versioning_\versions\boost-typeof\478fadf37863e72ec547e1a7620da6a28cc85c7d
1> [CMake] * boost-uninstall[core]:x64-windows -> 1.78.0 -- C:\tools\vcpkg\buildtrees\versioning_\versions\boost-uninstall\996078abceb6009fb2841dd97edc5246e8bd38aa
1> [CMake] * boost-unordered[core]:x64-windows -> 1.78.0 -- C:\tools\vcpkg\buildtrees\versioning_\versions\boost-unordered\c55ee280fedefd69dba819a4d768d5a5e132f9b9
1> [CMake] * boost-utility[core]:x64-windows -> 1.78.0 -- C:\tools\vcpkg\buildtrees\versioning_\versions\boost-utility\4e39c1737260328064c10b743aba90788efc467a
1> [CMake] * boost-variant2[core]:x64-windows -> 1.78.0 -- C:\tools\vcpkg\buildtrees\versioning_\versions\boost-variant2\30915b5f5005d9b166f4349f493b4f7314d84c17
1> [CMake] * boost-vcpkg-helpers[core]:x64-windows -> 1.78.0#1 -- C:\tools\vcpkg\buildtrees\versioning_\versions\boost-vcpkg-helpers\2b601d13ad505473bac3d555d9e543d981c46565
1> [CMake] * boost-winapi[core]:x64-windows -> 1.78.0 -- C:\tools\vcpkg\buildtrees\versioning_\versions\boost-winapi\8492201c09a250964609eea910b3d37c9895d411
Is there a way to only build the listed boost libraries in my find_package command?
With vcpkg you definitely can install specific Boost modules (
filesystem
andnowide
in your case). From https://vcpkg.io/en/packages.html:.\vcpkg install boost-filesystem
.\vcpkg install boost-nowide
With
find_package
you're linking already compiled and installed package (e.g. SMFL or any other lib) to your project, not actually compiling it. See this link if you'd like to know how others tried to integrate CMake system to build Boost.