From a79e6919a702150e08bb57b405ac09e082ec17f8 Mon Sep 17 00:00:00 2001
From: Dilawar Singh <dilawars@ncbs.res.in>
Date: Tue, 27 Jun 2017 11:30:43 +0530
Subject: [PATCH] Force --install-layout=deb when on debian/ubuntu.

---
 moose-core/CMakeLists.txt | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/moose-core/CMakeLists.txt b/moose-core/CMakeLists.txt
index 12874339..13c902e1 100644
--- a/moose-core/CMakeLists.txt
+++ b/moose-core/CMakeLists.txt
@@ -418,13 +418,16 @@ install(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/scripts/moose
 # always override debian default installation directory. It will be installed in
 # site-packages instead of dist-packages. 
 # See https://bugs.launchpad.net/ubuntu/+source/python2.6/+bug/362570
-# HACK: Some trickery is involved. Don't pass --prefix if CMAKE_INSTALL_PREFIX is 
-# just /usr. This fixes debian builds.
+# HACK: Get platform information from python and use it to fix the layout.
+execute_process( 
+    COMMAND ${PYTHON_EXECUTABLE} -mplatform OUTPUT_VARIABLE _platform_desc 
+    )
+message( STATUS "Platform ${_platform_desc}" )
+
 if(WITH_PYTHON)
-    if( "${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr" )
-        set(EXTRA_ARGS "" )
-    else()
-        set(EXTRA_ARGS "--prefix ${CMAKE_INSTALL_PREFIX}")
+    set(EXTRA_ARGS "--prefix ${CMAKE_INSTALL_PREFIX}")
+    if( ${_platform_desc} MATCHES ".*(Ubuntu|Debian).*" )
+        list( APPEND EXTRA_ARGS "--install-layout=deb" )
     endif( )
 
     install(CODE 
-- 
GitLab