Версия 0.4.8

This commit is contained in:
Andrei Astafev 2022-01-25 13:21:05 +03:00
parent 2a12f0250f
commit f163819116
7 changed files with 25 additions and 46 deletions

View File

@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.0) cmake_minimum_required(VERSION 3.0)
project(myx-cmake VERSION 0.4.7 LANGUAGES) project(myx-cmake VERSION 0.4.8 LANGUAGES)
include(GNUInstallDirs) include(GNUInstallDirs)
file(WRITE ${CMAKE_SOURCE_DIR}/MyxCMake/MyxCMakeConfigVersion.cmake file(WRITE ${CMAKE_SOURCE_DIR}/MyxCMake/MyxCMakeConfigVersion.cmake

View File

@ -1,8 +1,8 @@
# C compiler name # C compiler name
if(CMAKE_C_COMPILER_ID STREQUAL "Intel") if(CMAKE_C_COMPILER_ID STREQUAL "Intel")
set(CMAKE_C_COMPILER_IS_INTEL ON) set(CMAKE_C_COMPILER_IS_INTEL ON)
elseif(CMAKE_C_COMPILER_ID STREQUAL "Clang" OR CMAKE_C_COMPILER_ID STREQUAL elseif(CMAKE_C_COMPILER_ID STREQUAL "Clang" OR
"AppleClang") CMAKE_C_COMPILER_ID STREQUAL "AppleClang")
set(CMAKE_C_COMPILER_IS_CLANG ON) set(CMAKE_C_COMPILER_IS_CLANG ON)
elseif(CMAKE_C_COMPILER_ID STREQUAL "GNU") elseif(CMAKE_C_COMPILER_ID STREQUAL "GNU")
set(CMAKE_C_COMPILER_IS_GCC ON) set(CMAKE_C_COMPILER_IS_GCC ON)
@ -13,8 +13,8 @@ endif()
# C++ compiler name # C++ compiler name
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
set(CMAKE_CXX_COMPILER_IS_INTEL ON) set(CMAKE_CXX_COMPILER_IS_INTEL ON)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR
"AppleClang") CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
set(CMAKE_CXX_COMPILER_IS_CLANG ON) set(CMAKE_CXX_COMPILER_IS_CLANG ON)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(CMAKE_CXX_COMPILER_IS_GCC ON) set(CMAKE_CXX_COMPILER_IS_GCC ON)
@ -25,13 +25,12 @@ endif()
# Предпочтительные пути к утилитам для компоновки # Предпочтительные пути к утилитам для компоновки
if(CMAKE_CXX_COMPILER_IS_GCC) if(CMAKE_CXX_COMPILER_IS_GCC)
# Astra Linux Smolensk 1.5 # Astra Linux Smolensk 1.5
if(MYX_CMAKE_LSB_DISTRIBUTOR_ID STREQUAL "AstraLinuxSE" if(MYX_CMAKE_LSB_DISTRIBUTOR_ID STREQUAL "AstraLinuxSE" AND
AND MYX_CMAKE_LSB_CODENAME STREQUAL "smolensk" MYX_CMAKE_LSB_CODENAME STREQUAL "smolensk" AND
AND MYX_CMAKE_LSB_RELEASE STREQUAL "1.5") 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_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_NM NAMES "/usr/bin/x86_64-linux-gnu-gcc-nm-4.7")
find_program(CMAKE_GCC_RANLIB find_program(CMAKE_GCC_RANLIB NAMES "/usr/bin/x86_64-linux-gnu-gcc-ranlib-4.7")
NAMES "/usr/bin/x86_64-linux-gnu-gcc-ranlib-4.7")
# Elbrus E2K # Elbrus E2K
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "e2k") elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "e2k")
find_program(CMAKE_GCC_AR find_program(CMAKE_GCC_AR
@ -47,18 +46,12 @@ if(CMAKE_CXX_COMPILER_IS_GCC)
endif() endif()
if(CMAKE_GCC_AR) if(CMAKE_GCC_AR)
set(CMAKE_AR set(CMAKE_AR ${CMAKE_GCC_AR} CACHE STRING "" FORCE)
${CMAKE_GCC_AR}
CACHE STRING "" FORCE)
endif() endif()
if(CMAKE_GCC_NM) if(CMAKE_GCC_NM)
set(CMAKE_NM set(CMAKE_NM ${CMAKE_GCC_NM} CACHE STRING "" FORCE)
${CMAKE_GCC_NM}
CACHE STRING "" FORCE)
endif() endif()
if(CMAKE_GCC_RANLIB) if(CMAKE_GCC_RANLIB)
set(CMAKE_RANLIB set(CMAKE_RANLIB ${CMAKE_GCC_RANLIB} CACHE STRING "" FORCE)
${CMAKE_GCC_RANLIB}
CACHE STRING "" FORCE)
endif() endif()
endif() endif()

View File

@ -6,13 +6,7 @@ option(MYX_CMAKE_WARNING_OUTPUT "Enable warning output" OFF)
# Если сборка производится в режиме для отладки, то включаются флаги для # Если сборка производится в режиме для отладки, то включаются флаги для
# разрешения отладочной печати # разрешения отладочной печати
if(CMAKE_BUILD_TYPE STREQUAL Debug) if(CMAKE_BUILD_TYPE STREQUAL Debug)
set(MYX_CMAKE_DEBUG_OUTPUT set(MYX_CMAKE_DEBUG_OUTPUT ON CACHE BOOL "" FORCE)
ON set(MYX_CMAKE_INFO_OUTPUT ON CACHE BOOL "" FORCE)
CACHE BOOL "" FORCE) set(MYX_CMAKE_WARNING_OUTPUT ON CACHE BOOL "" FORCE)
set(MYX_CMAKE_INFO_OUTPUT
ON
CACHE BOOL "" FORCE)
set(MYX_CMAKE_WARNING_OUTPUT
ON
CACHE BOOL "" FORCE)
endif() endif()

View File

@ -2,9 +2,7 @@
function(myx_cmake_canonical_string in_string out_string) function(myx_cmake_canonical_string in_string out_string)
string(TOUPPER ${in_string} _arg_uppercase) string(TOUPPER ${in_string} _arg_uppercase)
string(REGEX REPLACE "[ -]" "_" _arg_fixed ${_arg_uppercase}) string(REGEX REPLACE "[ -]" "_" _arg_fixed ${_arg_uppercase})
set(${out_string} set(${out_string} ${_arg_fixed} PARENT_SCOPE)
${_arg_fixed}
PARENT_SCOPE)
endfunction() endfunction()
# Добавление общего префикса ко всем переменным в списке # Добавление общего префикса ко всем переменным в списке
@ -13,7 +11,5 @@ function(myx_cmake_list_transform_prepend var prefix)
foreach(filename ${${var}}) foreach(filename ${${var}})
list(APPEND temp "${prefix}${filename}") list(APPEND temp "${prefix}${filename}")
endforeach() endforeach()
set(${var} set(${var} ${temp} PARENT_SCOPE)
"${temp}"
PARENT_SCOPE)
endfunction() endfunction()

View File

@ -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_ORGANIZATION_NAME_CANONICAL} MYX_CMAKE_ORGANIZATION_NAME_UPPER)
string(TOUPPER ${MYX_CMAKE_PROJECT_NAME_CANONICAL} MYX_CMAKE_PROJECT_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) 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) 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(MYX_CMAKE_ADD_THEME_PREFIX AND NOT MYX_CMAKE_THEME_PREFIX_APPENDED)
if(NOT MYX_CMAKE_THEME_NAME_LOWER STREQUAL "default") if(NOT MYX_CMAKE_THEME_NAME_LOWER STREQUAL "default")
set(MYX_CMAKE_THEME_PREFIX_APPENDED set(MYX_CMAKE_THEME_PREFIX_APPENDED ON CACHE BOOL "" FORCE)
ON set(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/${MYX_CMAKE_THEME_NAME}" CACHE PATH "" FORCE)
CACHE BOOL "" FORCE)
set(CMAKE_INSTALL_PREFIX
"${CMAKE_INSTALL_PREFIX}/${MYX_CMAKE_THEME_NAME}"
CACHE PATH "" FORCE)
endif() endif()
endif() endif()
# cmake-format: on

View File

@ -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} -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} -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) execute_process(COMMAND ${_lsb_release_executable} -sr OUTPUT_VARIABLE MYX_CMAKE_LSB_RELEASE OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()
# cmake-format: on # cmake-format: on
endif() endif()
endif()

View File

@ -1,10 +1,10 @@
# cmake-format: off
if(${CMAKE_VERSION} VERSION_LESS "3.16.0") if(${CMAKE_VERSION} VERSION_LESS "3.16.0")
include(cotire OPTIONAL) include(cotire OPTIONAL)
if(COMMAND cotire) if(COMMAND cotire)
option(MYX_CMAKE_PRECOMPILED_HEADERS "MyxCMake: enable precompiled headers" option(MYX_CMAKE_PRECOMPILED_HEADERS "MyxCMake: enable precompiled headers" OFF)
OFF)
endif() endif()
else() else()
option(MYX_CMAKE_PRECOMPILED_HEADERS "MyxCMake: enable precompiled headers" option(MYX_CMAKE_PRECOMPILED_HEADERS "MyxCMake: enable precompiled headers" OFF)
OFF)
endif() endif()
# cmake-format: on