# install(TARGETS ... CXX\_MODULES\_BMI ...) does not always install a file?

**URL:** https://discourse.cmake.org/t/install-targets-cxx-modules-bmi-does-not-always-install-a-file/15574
**Category:** Development
**Tags:** gen:ninja
**Created:** [March 24, 2026, 8:29am UTC](https://discourse.cmake.org/t/install-targets-cxx-modules-bmi-does-not-always-install-a-file/15574 "2026-03-24T08:29:15Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![ClausKlein](https://discourse.cmake.org/user_avatar/discourse.cmake.org/clausklein/32/352_2.png) [@ClausKlein](https://discourse.cmake.org/u/ClausKlein)
#### Post date: [March 24, 2026, 8:29am UTC](https://discourse.cmake.org/t/install-targets-cxx-modules-bmi-does-not-always-install-a-file/15574/1 "2026-03-24T08:29:15Z")

</div>

I struggle over the `CXX_MODULES` install **BMI**. Sometimes this has no effect or some BMI files are missing?

see to [Why are the build and installed BMI files not used?](https://discourse.cmake.org/t/why-are-the-build-and-installed-bmi-files-not-used/15367)

I use always this `cmake install` function call:

```cmake
            install(
                TARGETS "${_tgt}"
                EXPORT ${BOOST_EXPORT_NAME}
                ARCHIVE
                    ${_lib_install_dir}
                    COMPONENT "${install_component_name}_Development"
                LIBRARY
                    ${_lib_install_dir}
                    COMPONENT "${install_component_name}_Runtime"
                    NAMELINK_COMPONENT "${install_component_name}_Development"
                RUNTIME
                    ${_bin_install_dir}
                    COMPONENT "${install_component_name}_Runtime"
                ${_install_header_set_args}
                FILE_SET ${_module_sets}
                    DESTINATION "${BOOST_DESTINATION}"
                    COMPONENT "${install_component_name}_Development"
                # NOTE: There's currently no convention for this location! CK
                CXX_MODULES_BMI
                    DESTINATION
                        ${_config_install_dir}/bmi-${CMAKE_CXX_COMPILER_ID}_$<CONFIG>
                    COMPONENT "${install_component_name}_Development"
            )

```

```auto
/Users/clausklein/.local/lib/cmake/modules_triangle/
├── cxx-modules
│ ├── cxx-modules-modules_triangle-targets-Release.cmake
│ ├── cxx-modules-modules_triangle-targets.cmake
│ ├── target-library__a-Release.cmake
│ └── target-library__c-Release.cmake
├── modules
│ ├── library_a.cppm
│ └── library_c.cppm
├── modules_triangle-config-version.cmake
├── modules_triangle-config.cmake
├── modules_triangle-targets-release.cmake
└── modules_triangle-targets.cmake

3 directories, 10 files
iMac:modules-triangle clausklein$ 

```

or i.e. 2 CXX\_MODULES, but only 1 **BMI**?

```auto
bash-5.3$ tree /Users/clausklein/.local/lib/cmake/modules_playground
/Users/clausklein/.local/lib/cmake/modules_playground
├── bmi-Clang_Release
│ └── mylib.pcm
├── cxx-modules
│ ├── cxx-modules-modules_playground-targets-Release.cmake
│ ├── cxx-modules-modules_playground-targets.cmake
│ ├── target-play__hello-Release.cmake
│ └── target-play__mylib-Release.cmake
├── modules
│ ├── M.cppm
│ ├── interface_part.cppm
│ └── mylib.cppm
├── modules_playground-config-version.cmake
├── modules_playground-config.cmake
├── modules_playground-targets-release.cmake
└── modules_playground-targets.cmake

4 directories, 12 files
bash-5.3$ 

```

---

<div class="post-metadata">

### Author: ![ClausKlein](https://discourse.cmake.org/user_avatar/discourse.cmake.org/clausklein/32/352_2.png) [@ClausKlein](https://discourse.cmake.org/u/ClausKlein)
#### Post date: [March 26, 2026, 8:36am UTC](https://discourse.cmake.org/t/install-targets-cxx-modules-bmi-does-not-always-install-a-file/15574/2 "2026-03-26T08:36:52Z")

</div>

@vito.gamberini is it intended that **NOT** always the `BMI` files are installed?

---

<div class="post-metadata">

### Author: ![vito.gamberini](https://discourse.cmake.org/user_avatar/discourse.cmake.org/vito.gamberini/32/4376_2.png) [@vito.gamberini](https://discourse.cmake.org/u/vito.gamberini)
#### Post date: [March 26, 2026, 9:17am UTC](https://discourse.cmake.org/t/install-targets-cxx-modules-bmi-does-not-always-install-a-file/15574/3 "2026-03-26T09:17:46Z")

</div>

You can install them, there is no purpose in doing so.

Neither CMake nor any other build system will ever use installed BMI files. In the future, CMake may use these as a minor optimization but it’s mostly pointless.

---

<div class="post-metadata">

### Author: ![ClausKlein](https://discourse.cmake.org/user_avatar/discourse.cmake.org/clausklein/32/352_2.png) [@ClausKlein](https://discourse.cmake.org/u/ClausKlein)
#### Post date: [March 26, 2026, 10:01am UTC](https://discourse.cmake.org/t/install-targets-cxx-modules-bmi-does-not-always-install-a-file/15574/4 "2026-03-26T10:01:34Z")

</div>

> [@ClausKlein](#):
>
> Sometimes this has no effect or some BMI files are missing?

I know it is optional, but why this different behaviour?

---

<div class="post-metadata">

### Author: ![vito.gamberini](https://discourse.cmake.org/user_avatar/discourse.cmake.org/vito.gamberini/32/4376_2.png) [@vito.gamberini](https://discourse.cmake.org/u/vito.gamberini)
#### Post date: [March 26, 2026, 10:07am UTC](https://discourse.cmake.org/t/install-targets-cxx-modules-bmi-does-not-always-install-a-file/15574/5 "2026-03-26T10:07:47Z")

</div>

No idea, this isn’t an minimum reproducible example it just the `tree` of some install folders.

But the point is if it has bugs I wouldn’t be surprised. They cannot be used for anything under any circumstances. This is tested in CMake, under `RunCMake/CXXModules` are a bunch of BMI tests @ben.boeckel wrote but I have no idea how complete their coverage or how they diverge from what you’re trying to do.

In any case, trying to make sense of BMI installation without any consumers is a lost cause. CPS will never support BMI installation, so this will forever be an obscure CMake-ism.

---

<div class="post-metadata">

### Author: ![ClausKlein](https://discourse.cmake.org/user_avatar/discourse.cmake.org/clausklein/32/352_2.png) [@ClausKlein](https://discourse.cmake.org/u/ClausKlein)
#### Post date: [March 26, 2026, 10:24am UTC](https://discourse.cmake.org/t/install-targets-cxx-modules-bmi-does-not-always-install-a-file/15574/6 "2026-03-26T10:24:27Z")

</div>

> <https://github.com/ClausKlein/modules-playground/pull/1>
>
> \`Modernise CMake\` files and add a \`round trip test\` to check the usability of ex…ported CMake package
