From de17f93679c7ddb4b873c1873e4f6b911d894f04 Mon Sep 17 00:00:00 2001 From: Ivan Pelipenko Date: Tue, 12 May 2020 22:39:16 +0300 Subject: [PATCH] linux deploy --- cmake/DeployMacros.cmake | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/cmake/DeployMacros.cmake b/cmake/DeployMacros.cmake index 1756286a..8ddd72f5 100644 --- a/cmake/DeployMacros.cmake +++ b/cmake/DeployMacros.cmake @@ -600,34 +600,35 @@ macro(deploy_target _T) if ("x${CMAKE_SYSTEM_NAME}" STREQUAL "xLinux") set(_os_id "") set(_os_ver "") + set(_paths "/usr/lib" "/etc") if (CMAKE_CROSSCOMPILING) - find_file(_release_file NAMES os-release lsb-release PATHS "${CMAKE_PREFIX_PATH}/lib" "${CMAKE_PREFIX_PATH}/../etc" NO_DEFAULT_PATH) - if (NOT "x${_release_file}" STREQUAL "x") - file(STRINGS "${_release_file}" _lines) - foreach(_l ${_lines}) - if ("${_l}" MATCHES "VERSION_ID=.*") - string(SUBSTRING "${_l}" 11 -1 _os_ver) - string(REPLACE "\"" "" _os_ver "${_os_ver}") - #message("VERSION_ID ${_os_ver}") - elseif ("${_l}" MATCHES "ID=.*") - string(SUBSTRING "${_l}" 3 -1 _os_id) - string(REPLACE "\"" "" _os_id "${_os_id}") - #message("ID ${_os_id}") - endif() - endforeach() - endif() - else() - execute_process(COMMAND "lsb_release -si" OUTPUT_VARIABLE _os_id) - execute_process(COMMAND "lsb_release -sr" OUTPUT_VARIABLE _os_ver) + set(_paths "${CMAKE_PREFIX_PATH}/lib" "${CMAKE_PREFIX_PATH}/../etc") endif() + find_file(_release_file NAMES os-release lsb-release PATHS ${_paths} NO_DEFAULT_PATH) + if (NOT "x${_release_file}" STREQUAL "x") + file(STRINGS "${_release_file}" _lines) + foreach(_l ${_lines}) + if ("${_l}" MATCHES "VERSION_ID=.*") + string(SUBSTRING "${_l}" 11 -1 _os_ver) + string(REPLACE "\"" "" _os_ver "${_os_ver}") + #message("VERSION_ID ${_os_ver}") + elseif ("${_l}" MATCHES "ID=.*") + string(SUBSTRING "${_l}" 3 -1 _os_id) + string(REPLACE "\"" "" _os_id "${_os_id}") + #message("ID ${_os_id}") + endif() + endforeach() + endif() + #execute_process(COMMAND "lsb_release -si" OUTPUT_VARIABLE _os_id) + #execute_process(COMMAND "lsb_release -sr" OUTPUT_VARIABLE _os_ver) set(_build "${${_T}_VERSION_BUILD}") if (NOT "x${_build}" STREQUAL "x") set(_build "-${_build}") endif() + string(TOLOWER "${_os_id}${_os_ver}" _TARGET_OS) if ("x${_TARGET_OS}" STREQUAL "x") set(_TARGET_OS "linux") endif() - string(TOLOWER "${_os_id}${_os_ver}" _TARGET_OS) string(REPLACE "_" "-" _DEBNAME "${_T}") string(REPLACE "_" "-" _DEBVERSION "${${_T}_VERSION}${_build}+${_TARGET_OS}") set(_DEB_ARCH)