Prechádzať zdrojové kódy

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 rokov pred
rodič
commit
0fead28404
1 zmenil súbory, kde vykonal 8 pridanie a 4 odobranie
  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