# 'cmake --install'/'make install'/'ninja install' doesn't install dependencies

**URL:** <https://discourse.cmake.org/t/cmake-install-make-install-ninja-install-doesnt-install-dependencies/13079>\
**Category:** Code\
**Tags:** os:linux, gen:makefiles, gen:ninja\
**Created:** [November 27, 2024, 5:35pm UTC](https://discourse.cmake.org/t/cmake-install-make-install-ninja-install-doesnt-install-dependencies/13079 "2024-11-27T17:35:44Z")\
**Posts on this page:** 3\
**Page:** 2

<div class="post-metadata">

**Author:** ![DKLind](https://discourse.cmake.org/user_avatar/discourse.cmake.org/dklind/32/526_2.png) [@DKLind](https://discourse.cmake.org/u/DKLind)\
**Post date:** [December 12, 2024, 10:14pm UTC](https://discourse.cmake.org/t/cmake-install-make-install-ninja-install-doesnt-install-dependencies/13079/21 "2024-12-12T22:14:33Z")

</div>

@Fabian188 I posted the CMakeLists.txt files above so you can see what I’m doing.  
The External\_Project\_Add() simply downloads, patches, configures, builds, and installs what is built to a intermediate location. Then, the install() function is what is referenced when performing a `ninja install` or `cmake --install .`, which copies files from the intermediate location to the desired system location. With `ninja package`, CPack copies files from the intermediate location to the `_CPack_Packages/Linux/.../<target>` directory and the package is created as specified by the install() function. It’s the install() function that CMake uses to generate the `<target>/cmake_install.cmake` file. The `install_manifest_<target>.txt` file is created when a install is performed, either by `ninja install`, `cmake --install .` or `ninja package`.

The add\_dependencies(${PROJECT\_NAME} zlib), in the openssl CMakeLists.txt, adds a build time dependency on zlib. But this build time dependency doesn’t perform an install from the intermediate location to the system location with `ninja install` or `cmake --install .`.

---

<div class="post-metadata">

**Author:** ![Fabian188](https://discourse.cmake.org/user_avatar/discourse.cmake.org/fabian188/32/2934_2.png) [@Fabian188](https://discourse.cmake.org/u/Fabian188)\
**Post date:** [December 12, 2024, 10:25pm UTC](https://discourse.cmake.org/t/cmake-install-make-install-ninja-install-doesnt-install-dependencies/13079/22 "2024-12-12T22:25:24Z")

</div>

I might get to understand your problem and what actually happens.

I did not understand that there is actually an install to the project directory already…

It is like Craig wrote: you need to do it yourself.

You could do it, as I wrote, by installing the dependency to the system and building your main project from the then-system files (I would not do it).

Or you require a double install. The first is from the external project itself and for the second you do manually add the files to be installed to the main project via install(). Otherwise the main project ninja install does not know about these files. Or you make use of the manifest\_install.txt from the dependency build directory.

The second step (calling install() with the artefacts) you can do as an post-install-step for the dependency.

```auto
ExternalProject_Add_Step(${PACKAGE_NAME} post_install
      COMMAND ${CMAKE_COMMAND} -P "${POSTINSTALL_SCRIPT}"
      # COMMAND ${CMAKE_COMMAND} -E echo post_install ${POSTINSTALL_SCRIPT}
      DEPENDEES install )

```

---

<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:** [December 15, 2024, 11:34pm UTC](https://discourse.cmake.org/t/cmake-install-make-install-ninja-install-doesnt-install-dependencies/13079/23 "2024-12-15T23:34:03Z")

</div>

### I would use a `toolchain` for `cross compiling`.

An for the `unix host build`, it would be really simple like here in my example:

> <https://github.com/ClausKlein/openssl-cmake/blob/master/CMakeLists.txt>

#### small problems are caused by cmake:

- [What controls the use of lib64 as CMAKE\_INSTALL\_LIBDIR?](https://discourse.cmake.org/t/what-controls-the-use-of-lib64-as-cmake-install-libdir/13212)

### others caused Good Good by MSVC:

- [How to control the MSVC CRT with cmake?](https://discourse.cmake.org/t/how-to-control-the-msvc-crt-with-cmake/13195)

## But there are real problems with openssl itself:

- [Error: Imported target "OpenSSL::Crypto" includes non-existent path · Issue #26185 · openssl/openssl · GitHub](https://github.com/openssl/openssl/issues/26185)
- [The exported cmake config package should contain a OpenSSLConfig-targets-release.cmake file · Issue #26179 · openssl/openssl · GitHub](https://github.com/openssl/openssl/issues/26179)

[Previous page](https://discourse.cmake.org/t/cmake-install-make-install-ninja-install-doesnt-install-dependencies/13079.md?page=1)
