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.
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 is the doc I’m referring to.
ben.boeckel
(Ben Boeckel (Kitware))
January 6, 2021, 1:03am
2
I think that probably wants to be lib/cmake/MathFunctions
rather than just lib/cmake
.
Cc: @betsy.mcphail
1 Like
ben.boeckel
(Ben Boeckel (Kitware))
January 7, 2021, 5:22pm
3
1 Like
ClausKlein
(Claus Klein)
February 27, 2021, 2:42pm
4
@ben.boeckel I found a Problem too within this Importing and Exporting Guide :
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$
ben.boeckel
(Ben Boeckel (Kitware))
March 1, 2021, 3:31pm
5
Thanks. Do you want to file the MR or should I?
@ben.boeckel If you can do it, that would be nice.
Thank you
ben.boeckel
(Ben Boeckel (Kitware))
March 1, 2021, 8:57pm
7
1 Like
leha-bot
(Alex)
March 18, 2021, 8:41am
8
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.
ben.boeckel
(Ben Boeckel (Kitware))
March 18, 2021, 1:19pm
9
That sounds like a useful addition as well. I’ll make an MR today. https://gitlab.kitware.com/cmake/cmake/-/merge_requests/5923
1 Like