From f163819116b3b4d3cfe0c0143ab7d44f1fa80d77 Mon Sep 17 00:00:00 2001 From: Andrey Astafyev Date: Tue, 25 Jan 2022 13:21:05 +0300 Subject: [PATCH] =?UTF-8?q?=D0=92=D0=B5=D1=80=D1=81=D0=B8=D1=8F=200.4.8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 2 +- MyxCMake/modules/MyxCMakeCompiler.cmake | 29 +++++++------------ .../modules/MyxCMakeDebugOutputOptions.cmake | 12 ++------ .../modules/MyxCMakeGlobalFunctions.cmake | 8 ++--- .../modules/MyxCMakeGlobalVariables.cmake | 10 ++----- MyxCMake/modules/MyxCMakeLSBInfo.cmake | 2 +- .../modules/MyxCMakePrecompiledHeaders.cmake | 8 ++--- 7 files changed, 25 insertions(+), 46 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c0a58c3..b3155c0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.0) -project(myx-cmake VERSION 0.4.7 LANGUAGES) +project(myx-cmake VERSION 0.4.8 LANGUAGES) include(GNUInstallDirs) file(WRITE ${CMAKE_SOURCE_DIR}/MyxCMake/MyxCMakeConfigVersion.cmake diff --git a/MyxCMake/modules/MyxCMakeCompiler.cmake b/MyxCMake/modules/MyxCMakeCompiler.cmake index 514efac..a0171d1 100644 --- a/MyxCMake/modules/MyxCMakeCompiler.cmake +++ b/MyxCMake/modules/MyxCMakeCompiler.cmake @@ -1,8 +1,8 @@ # C compiler name if(CMAKE_C_COMPILER_ID STREQUAL "Intel") set(CMAKE_C_COMPILER_IS_INTEL ON) -elseif(CMAKE_C_COMPILER_ID STREQUAL "Clang" OR CMAKE_C_COMPILER_ID STREQUAL - "AppleClang") +elseif(CMAKE_C_COMPILER_ID STREQUAL "Clang" OR + CMAKE_C_COMPILER_ID STREQUAL "AppleClang") set(CMAKE_C_COMPILER_IS_CLANG ON) elseif(CMAKE_C_COMPILER_ID STREQUAL "GNU") set(CMAKE_C_COMPILER_IS_GCC ON) @@ -13,8 +13,8 @@ endif() # C++ compiler name if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") set(CMAKE_CXX_COMPILER_IS_INTEL ON) -elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL - "AppleClang") +elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR + CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") set(CMAKE_CXX_COMPILER_IS_CLANG ON) elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") set(CMAKE_CXX_COMPILER_IS_GCC ON) @@ -25,13 +25,12 @@ endif() # Предпочтительные пути к утилитам для компоновки if(CMAKE_CXX_COMPILER_IS_GCC) # Astra Linux Smolensk 1.5 - if(MYX_CMAKE_LSB_DISTRIBUTOR_ID STREQUAL "AstraLinuxSE" - AND MYX_CMAKE_LSB_CODENAME STREQUAL "smolensk" - AND MYX_CMAKE_LSB_RELEASE STREQUAL "1.5") + if(MYX_CMAKE_LSB_DISTRIBUTOR_ID STREQUAL "AstraLinuxSE" AND + MYX_CMAKE_LSB_CODENAME STREQUAL "smolensk" AND + MYX_CMAKE_LSB_RELEASE STREQUAL "1.5") find_program(CMAKE_GCC_AR NAMES "/usr/bin/x86_64-linux-gnu-gcc-ar-4.7") find_program(CMAKE_GCC_NM NAMES "/usr/bin/x86_64-linux-gnu-gcc-nm-4.7") - find_program(CMAKE_GCC_RANLIB - NAMES "/usr/bin/x86_64-linux-gnu-gcc-ranlib-4.7") + find_program(CMAKE_GCC_RANLIB NAMES "/usr/bin/x86_64-linux-gnu-gcc-ranlib-4.7") # Elbrus E2K elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "e2k") find_program(CMAKE_GCC_AR @@ -47,18 +46,12 @@ if(CMAKE_CXX_COMPILER_IS_GCC) endif() if(CMAKE_GCC_AR) - set(CMAKE_AR - ${CMAKE_GCC_AR} - CACHE STRING "" FORCE) + set(CMAKE_AR ${CMAKE_GCC_AR} CACHE STRING "" FORCE) endif() if(CMAKE_GCC_NM) - set(CMAKE_NM - ${CMAKE_GCC_NM} - CACHE STRING "" FORCE) + set(CMAKE_NM ${CMAKE_GCC_NM} CACHE STRING "" FORCE) endif() if(CMAKE_GCC_RANLIB) - set(CMAKE_RANLIB - ${CMAKE_GCC_RANLIB} - CACHE STRING "" FORCE) + set(CMAKE_RANLIB ${CMAKE_GCC_RANLIB} CACHE STRING "" FORCE) endif() endif() diff --git a/MyxCMake/modules/MyxCMakeDebugOutputOptions.cmake b/MyxCMake/modules/MyxCMakeDebugOutputOptions.cmake index 19aeb8e..675c92d 100644 --- a/MyxCMake/modules/MyxCMakeDebugOutputOptions.cmake +++ b/MyxCMake/modules/MyxCMakeDebugOutputOptions.cmake @@ -6,13 +6,7 @@ option(MYX_CMAKE_WARNING_OUTPUT "Enable warning output" OFF) # Если сборка производится в режиме для отладки, то включаются флаги для # разрешения отладочной печати if(CMAKE_BUILD_TYPE STREQUAL Debug) - set(MYX_CMAKE_DEBUG_OUTPUT - ON - CACHE BOOL "" FORCE) - set(MYX_CMAKE_INFO_OUTPUT - ON - CACHE BOOL "" FORCE) - set(MYX_CMAKE_WARNING_OUTPUT - ON - CACHE BOOL "" FORCE) + set(MYX_CMAKE_DEBUG_OUTPUT ON CACHE BOOL "" FORCE) + set(MYX_CMAKE_INFO_OUTPUT ON CACHE BOOL "" FORCE) + set(MYX_CMAKE_WARNING_OUTPUT ON CACHE BOOL "" FORCE) endif() diff --git a/MyxCMake/modules/MyxCMakeGlobalFunctions.cmake b/MyxCMake/modules/MyxCMakeGlobalFunctions.cmake index 5d31aec..7bf8611 100644 --- a/MyxCMake/modules/MyxCMakeGlobalFunctions.cmake +++ b/MyxCMake/modules/MyxCMakeGlobalFunctions.cmake @@ -2,9 +2,7 @@ function(myx_cmake_canonical_string in_string out_string) string(TOUPPER ${in_string} _arg_uppercase) string(REGEX REPLACE "[ -]" "_" _arg_fixed ${_arg_uppercase}) - set(${out_string} - ${_arg_fixed} - PARENT_SCOPE) + set(${out_string} ${_arg_fixed} PARENT_SCOPE) endfunction() # Добавление общего префикса ко всем переменным в списке @@ -13,7 +11,5 @@ function(myx_cmake_list_transform_prepend var prefix) foreach(filename ${${var}}) list(APPEND temp "${prefix}${filename}") endforeach() - set(${var} - "${temp}" - PARENT_SCOPE) + set(${var} ${temp} PARENT_SCOPE) endfunction() diff --git a/MyxCMake/modules/MyxCMakeGlobalVariables.cmake b/MyxCMake/modules/MyxCMakeGlobalVariables.cmake index 35d96d0..c7adaf0 100644 --- a/MyxCMake/modules/MyxCMakeGlobalVariables.cmake +++ b/MyxCMake/modules/MyxCMakeGlobalVariables.cmake @@ -14,16 +14,12 @@ string(TOLOWER ${MYX_CMAKE_THEME_NAME_CANONICAL} MYX_CMAKE_THEME_NAME_LOWER) string(TOUPPER ${MYX_CMAKE_ORGANIZATION_NAME_CANONICAL} MYX_CMAKE_ORGANIZATION_NAME_UPPER) string(TOUPPER ${MYX_CMAKE_PROJECT_NAME_CANONICAL} MYX_CMAKE_PROJECT_NAME_UPPER) string(TOUPPER ${MYX_CMAKE_THEME_NAME_CANONICAL} MYX_CMAKE_THEME_NAME_UPPER) -# cmake-format: on option(MYX_CMAKE_ADD_THEME_PREFIX "Append theme name to install prefix" OFF) if(MYX_CMAKE_ADD_THEME_PREFIX AND NOT MYX_CMAKE_THEME_PREFIX_APPENDED) if(NOT MYX_CMAKE_THEME_NAME_LOWER STREQUAL "default") - set(MYX_CMAKE_THEME_PREFIX_APPENDED - ON - CACHE BOOL "" FORCE) - set(CMAKE_INSTALL_PREFIX - "${CMAKE_INSTALL_PREFIX}/${MYX_CMAKE_THEME_NAME}" - CACHE PATH "" FORCE) + set(MYX_CMAKE_THEME_PREFIX_APPENDED ON CACHE BOOL "" FORCE) + set(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/${MYX_CMAKE_THEME_NAME}" CACHE PATH "" FORCE) endif() endif() +# cmake-format: on diff --git a/MyxCMake/modules/MyxCMakeLSBInfo.cmake b/MyxCMake/modules/MyxCMakeLSBInfo.cmake index 36b2d0c..3785321 100644 --- a/MyxCMake/modules/MyxCMakeLSBInfo.cmake +++ b/MyxCMake/modules/MyxCMakeLSBInfo.cmake @@ -24,6 +24,6 @@ else() execute_process(COMMAND ${_lsb_release_executable} -si OUTPUT_VARIABLE MYX_CMAKE_LSB_DISTRIBUTOR_ID OUTPUT_STRIP_TRAILING_WHITESPACE) execute_process(COMMAND ${_lsb_release_executable} -sc OUTPUT_VARIABLE MYX_CMAKE_LSB_CODENAME OUTPUT_STRIP_TRAILING_WHITESPACE) execute_process(COMMAND ${_lsb_release_executable} -sr OUTPUT_VARIABLE MYX_CMAKE_LSB_RELEASE OUTPUT_STRIP_TRAILING_WHITESPACE) - # cmake-format: on endif() + # cmake-format: on endif() diff --git a/MyxCMake/modules/MyxCMakePrecompiledHeaders.cmake b/MyxCMake/modules/MyxCMakePrecompiledHeaders.cmake index 8605e75..e021f69 100644 --- a/MyxCMake/modules/MyxCMakePrecompiledHeaders.cmake +++ b/MyxCMake/modules/MyxCMakePrecompiledHeaders.cmake @@ -1,10 +1,10 @@ +# cmake-format: off if(${CMAKE_VERSION} VERSION_LESS "3.16.0") include(cotire OPTIONAL) if(COMMAND cotire) - option(MYX_CMAKE_PRECOMPILED_HEADERS "MyxCMake: enable precompiled headers" - OFF) + option(MYX_CMAKE_PRECOMPILED_HEADERS "MyxCMake: enable precompiled headers" OFF) endif() else() - option(MYX_CMAKE_PRECOMPILED_HEADERS "MyxCMake: enable precompiled headers" - OFF) + option(MYX_CMAKE_PRECOMPILED_HEADERS "MyxCMake: enable precompiled headers" OFF) endif() +# cmake-format: on