# Problem with the "Importing and Exporting Guide"

**URL:** https://discourse.cmake.org/t/problem-with-the-importing-and-exporting-guide/2484
**Category:** Development
**Created:** [January 6, 2021, 12:13am UTC](https://discourse.cmake.org/t/problem-with-the-importing-and-exporting-guide/2484 "2021-01-06T00:13:50Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![big\_temp](https://discourse.cmake.org/user_avatar/discourse.cmake.org/big_temp/32/855_2.png) [@big\_temp](https://discourse.cmake.org/u/big_temp)
#### Post date: [January 6, 2021, 12:13am UTC](https://discourse.cmake.org/t/problem-with-the-importing-and-exporting-guide/2484/1 "2021-01-06T00:13:50Z")

</div>

I’ve spent the past three days trying to figure out what’s wrong with me since I was unable to find my installed project using the `find_package()` command but ultimately I think I was misled by tutorial in the official documentation.

 ![export](https://discourse.cmake.org/uploads/default/original/2X/d/dffc36c5516278f5d9492afc731712393b6a0a0d.png)

Unless I’m missing something, installing the config file to `${CMAKE_INSTALL_PREFIX}/lib/cmake` makes it impossible for the aforementioned command to find the config file, at least on Windows. Changing `DESTINATION` and `INSTALL_DESTINATION` to `cmake` solves the issue.

[This](https://cmake.org/cmake/help/latest/guide/importing-exporting/index.html#creating-a-package-configuration-file) is the doc I’m referring to.

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [January 6, 2021, 1:03am UTC](https://discourse.cmake.org/t/problem-with-the-importing-and-exporting-guide/2484/2 "2021-01-06T01:03:47Z")

</div>

I think that probably wants to be `lib/cmake/MathFunctions` rather than just `lib/cmake`.

Cc: @betsy.mcphail

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [January 7, 2021, 5:22pm UTC](https://discourse.cmake.org/t/problem-with-the-importing-and-exporting-guide/2484/3 "2021-01-07T17:22:24Z")

</div>

MR filed here: [https://gitlab.kitware.com/cmake/cmake/-/merge\_requests/5674](https://gitlab.kitware.com/cmake/cmake/-/merge_requests/5674)

---

<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: [February 27, 2021, 2:42pm UTC](https://discourse.cmake.org/t/problem-with-the-importing-and-exporting-guide/2484/4 "2021-02-27T14:42:59Z")

</div>

@ben.boeckel I found a Problem too within this [Importing and Exporting Guide](https://cmake.org/cmake/help/latest/guide/importing-exporting/index.html?highlight=components#adding-components):

```diff
Claus-iMac:MathFunctionsComponents$ git diff
diff --git a/Help/guide/importing-exporting/MathFunctionsComponents/Addition/CMakeLists.txt b/Help/guide/importing-exporting/MathFunctionsComponents/Addition/CMakeLists.txt
index e3cf711f7e..17ad95210b 100644
--- a/Help/guide/importing-exporting/MathFunctionsComponents/Addition/CMakeLists.txt
+++ b/Help/guide/importing-exporting/MathFunctionsComponents/Addition/CMakeLists.txt
@@ -26,5 +26,5 @@ install(FILES Addition.h DESTINATION include)
 install(EXPORT AdditionTargets
         FILE MathFunctionsAdditionTargets.cmake
         NAMESPACE MathFunctions::
- DESTINATION lib/cmake
+ DESTINATION lib/cmake/MathFunctions
 )
diff --git a/Help/guide/importing-exporting/MathFunctionsComponents/CMakeLists.txt b/Help/guide/importing-exporting/MathFunctionsComponents/CMakeLists.txt
index 4e3496dcca..5a98603eca 100644
--- a/Help/guide/importing-exporting/MathFunctionsComponents/CMakeLists.txt
+++ b/Help/guide/importing-exporting/MathFunctionsComponents/CMakeLists.txt
@@ -32,5 +32,5 @@ configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/Config.cmake.in
 install(FILES
           "${CMAKE_CURRENT_BINARY_DIR}/MathFunctionsConfig.cmake"
           "${CMAKE_CURRENT_BINARY_DIR}/MathFunctionsConfigVersion.cmake"
- DESTINATION lib/cmake
+ DESTINATION lib/cmake/MathFunctions
 )
diff --git a/Help/guide/importing-exporting/MathFunctionsComponents/SquareRoot/CMakeLists.txt b/Help/guide/importing-exporting/MathFunctionsComponents/SquareRoot/CMakeLists.txt
index ffa1e3def3..be5ae65d1c 100644
--- a/Help/guide/importing-exporting/MathFunctionsComponents/SquareRoot/CMakeLists.txt
+++ b/Help/guide/importing-exporting/MathFunctionsComponents/SquareRoot/CMakeLists.txt
@@ -26,5 +26,5 @@ install(FILES SquareRoot.h DESTINATION include)
 install(EXPORT SquareRootTargets
         FILE MathFunctionsSquareRootTargets.cmake
         NAMESPACE MathFunctions::
- DESTINATION lib/cmake
+ DESTINATION lib/cmake/MathFunctions
 )
Claus-iMac:MathFunctionsComponents$ 

```

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [March 1, 2021, 3:31pm UTC](https://discourse.cmake.org/t/problem-with-the-importing-and-exporting-guide/2484/5 "2021-03-01T15:31:06Z")

</div>

Thanks. Do you want to file the MR or should I?

---

<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 1, 2021, 3:49pm UTC](https://discourse.cmake.org/t/problem-with-the-importing-and-exporting-guide/2484/6 "2021-03-01T15:49:53Z")

</div>

@ben.boeckel If you can do it, that would be nice.

Thank you

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [March 1, 2021, 8:57pm UTC](https://discourse.cmake.org/t/problem-with-the-importing-and-exporting-guide/2484/7 "2021-03-01T20:57:04Z")

</div>

[https://gitlab.kitware.com/cmake/cmake/-/merge\_requests/5870](https://gitlab.kitware.com/cmake/cmake/-/merge_requests/5870)

---

<div class="post-metadata">

### Author: ![leha-bot](https://discourse.cmake.org/user_avatar/discourse.cmake.org/leha-bot/32/921_2.png) [@leha-bot](https://discourse.cmake.org/u/leha-bot)
#### Post date: [March 18, 2021, 8:41am UTC](https://discourse.cmake.org/t/problem-with-the-importing-and-exporting-guide/2484/8 "2021-03-18T08:41:14Z")

</div>

Hello, Ben, I think that the addition of `GNUInstallDirs` in `install()` instead of old `lib` will guide better new CMake users, as it could be installed on systems which has another `LIBNAME` directory (e.g. `lib64`), thanks for attention.

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [March 18, 2021, 1:19pm UTC](https://discourse.cmake.org/t/problem-with-the-importing-and-exporting-guide/2484/9 "2021-03-18T13:19:35Z")

</div>

That sounds like a useful addition as well. I’ll make an MR today. [https://gitlab.kitware.com/cmake/cmake/-/merge\_requests/5923](https://gitlab.kitware.com/cmake/cmake/-/merge_requests/5923)
