]> git.saurik.com Git - apt.git/commitdiff
CMake: Cache CURRENT_VENDOR and make it configurable
authorJulian Andres Klode <jak@debian.org>
Sun, 7 Aug 2016 01:33:11 +0000 (03:33 +0200)
committerJulian Andres Klode <jak@debian.org>
Wed, 10 Aug 2016 14:10:48 +0000 (16:10 +0200)
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

vendor/CMakeLists.txt

index 72aad49e120d1fcd61b3fe3f8c14ba30bcbd98fd..8246c725a8b93f3129ad598d52e0fd0a3d86b49f 100644 (file)
@@ -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