瀏覽代碼

CMake: Cache CURRENT_VENDOR and make it configurable

Cache the current vendor, so we do not have to rerun getinfo when
reconfiguring stuff. This also has the nice effect of making the
vendor configurable, so you can manually specify it on a platform
that might not have dpkg (not that building without dpkg works
yet).

Gbp-Dch: ignore
Julian Andres Klode 10 年之前
父節點
當前提交
0fead28404
共有 1 個文件被更改,包括 8 次插入 和 4 次删除
  1. 8 4
      vendor/CMakeLists.txt

+ 8 - 4
vendor/CMakeLists.txt

@@ -1,9 +1,13 @@
 # Determine the current vendor, export to CURRENT_VENDOR
 # Determine the current vendor, export to CURRENT_VENDOR
-execute_process(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/getinfo current
-                OUTPUT_VARIABLE CURRENT_VENDOR OUTPUT_STRIP_TRAILING_WHITESPACE)
-set(CURRENT_VENDOR ${CURRENT_VENDOR} PARENT_SCOPE)
+if (NOT DEFINED CURRENT_VENDOR)
+    execute_process(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/getinfo current
+                    OUTPUT_VARIABLE CURRENT_VENDOR_OUT OUTPUT_STRIP_TRAILING_WHITESPACE)
 
 
-message(STATUS "Detected vendor: ${CURRENT_VENDOR}")
+    set(CURRENT_VENDOR "${CURRENT_VENDOR_OUT}" CACHE STRING "Select the system vendor")
+    message(STATUS "Detected vendor: ${CURRENT_VENDOR_OUT}")
+else()
+    message(STATUS "Detected vendor: ${CURRENT_VENDOR} (cached)")
+endif()
 
 
 # Handle sources.list example
 # Handle sources.list example
 add_vendor_file(OUTPUT sources.list
 add_vendor_file(OUTPUT sources.list