CPACK_RPM_<component>_PACKAGE_ARCHITECTURE variable allows
the same project to support packages of different architectures
including noarch, native and foreign architectures.
---
 Modules/CPackRPM.cmake | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake
index 5135893..485c586 100644
--- a/Modules/CPackRPM.cmake
+++ b/Modules/CPackRPM.cmake
@@ -51,6 +51,7 @@
 #  * Default   : CPACK_PACKAGE_VERSION
 #
 # .. variable:: CPACK_RPM_PACKAGE_ARCHITECTURE
+#               CPACK_RPM_<component>_PACKAGE_ARCHITECTURE
 #
 #  The RPM package architecture.
 #
@@ -629,6 +630,16 @@ else()
     message("CPackRPM:Debug: using user-specified build arch = 
${CPACK_RPM_PACKAGE_ARCHITECTURE}")
   endif()
 endif()
+#prefer component architecture
+unset(CPACK_RPM_PACKAGE_ARCHITECTURE_)
+if(CPACK_RPM_PACKAGE_COMPONENT)
+  if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_ARCHITECTURE)
+    set(CPACK_RPM_PACKAGE_ARCHITECTURE_ 
${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_ARCHITECTURE})
+    if(CPACK_RPM_PACKAGE_DEBUG)
+      message("CPackRPM:Debug: using component build arch = 
${CPACK_RPM_PACKAGE_ARCHITECTURE}")
+    endif()
+  endif()
+endif()
 if (NOT CPACK_RPM_PACKAGE_ARCHITECTURE_)
   set(CPACK_RPM_PACKAGE_ARCHITECTURE_ ${CPACK_RPM_PACKAGE_ARCHITECTURE})
 endif()
-- 
2.2.2

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

Reply via email to