Просмотр исходного кода

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
Родитель
Сommit
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
-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
 add_vendor_file(OUTPUT sources.list