[waffle] [PATCH 1/2] cmake: Install FindWaffle.cmake under system configured path

Jordan Justen jordan.l.justen at intel.com
Fri Dec 26 12:11:20 PST 2014


By default cmake modules will be under a versioned path such as
$PREFIX/share/cmake-3.0/Modules. Although, in the case of gentoo (at
least), the $PREFIX/share/cmake/Modules path is used.

This change should be compatible with both styles since it uses
${CMAKE_ROOT}.

Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
Cc: Dylan Baker <baker.dylan.c at gmail.com>
---
Dylan, does this work on gentoo?

I guess we can do the same thing with WaffleConfig*, right?

 CMakeLists.txt | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index bde8096..aa0ee2f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -139,9 +139,11 @@ install(
     COMPONENT pkgconfig
     )
 
+get_filename_component(CMAKE_ROOT_LAST_DIR "${CMAKE_ROOT}" NAME)
+
 install(
     FILES cmake/Modules/FindWaffle.cmake
-    DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/cmake/Modules"
+    DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/${CMAKE_ROOT_LAST_DIR}/Modules"
     COMPONENT cmakefind
     )
 
-- 
2.1.3



More information about the waffle mailing list