From 0fead28404498f42324dd86b4246d35af8905ed3 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sun, 7 Aug 2016 03:33:11 +0200 Subject: 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 --- vendor/CMakeLists.txt | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'vendor') diff --git a/vendor/CMakeLists.txt b/vendor/CMakeLists.txt index 72aad49e1..8246c725a 100644 --- a/vendor/CMakeLists.txt +++ b/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 -- cgit v1.2.3-70-g09d2