2.0.4
This commit is contained in:
parent
f6107e5bff
commit
432a1a85e6
@ -28,16 +28,20 @@ include(CMakeDependentOption)
|
||||
include(${MYX_CMAKE_LIB_DIR}/macro/CreateSymlink.cmake)
|
||||
include(${MYX_CMAKE_LIB_DIR}/macro/FindPackages.cmake)
|
||||
include(${MYX_CMAKE_LIB_DIR}/macro/InstallRelative.cmake)
|
||||
include(${MYX_CMAKE_LIB_DIR}/macro/CheckEnableCxxCompilerFlag.cmake)
|
||||
|
||||
include(${MYX_CMAKE_LIB_DIR}/ColoredMessages.cmake)
|
||||
include(${MYX_CMAKE_LIB_DIR}/PopulateCMakeBinaryDir.cmake)
|
||||
include(${MYX_CMAKE_LIB_DIR}/CurrentDate.cmake)
|
||||
include(${MYX_CMAKE_LIB_DIR}/ColoredMessages.cmake)
|
||||
include(${MYX_CMAKE_LIB_DIR}/NinjaGeneratorWarning.cmake)
|
||||
include(${MYX_CMAKE_LIB_DIR}/DirectoriesGuards.cmake)
|
||||
include(${MYX_CMAKE_LIB_DIR}/SemanticProjectVersion.cmake)
|
||||
include(${MYX_CMAKE_LIB_DIR}/NinjaGeneratorWrapper.cmake)
|
||||
include(${MYX_CMAKE_LIB_DIR}/FetchContentAdd.cmake)
|
||||
|
||||
include(${MYX_CMAKE_LIB_DIR}/LSBInfo.cmake)
|
||||
include(${MYX_CMAKE_LIB_DIR}/Toolchain.cmake)
|
||||
include(${MYX_CMAKE_LIB_DIR}/CompilerFlags.cmake)
|
||||
include(${MYX_CMAKE_LIB_DIR}/AddExecutable.cmake)
|
||||
include(${MYX_CMAKE_LIB_DIR}/AddLibrary.cmake)
|
||||
include(${MYX_CMAKE_LIB_DIR}/TargetSetup.cmake)
|
||||
|
@ -1,4 +1,4 @@
|
||||
set(MYX_CMAKE_PACKAGE_VERSION "2.0.3")
|
||||
set(MYX_CMAKE_PACKAGE_VERSION "2.0.4")
|
||||
if(MYX_CMAKE_PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
|
||||
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||
else()
|
||||
|
45
MyxCMake/lib/CompilerFlags.cmake
Normal file
45
MyxCMake/lib/CompilerFlags.cmake
Normal file
@ -0,0 +1,45 @@
|
||||
include_guard(GLOBAL)
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
# cmake-format: off
|
||||
if((MYX_CMAKE_LSB_DISTRIBUTOR_ID STREQUAL "AstraLinuxSE") AND
|
||||
(MYX_CMAKE_LSB_CODENAME STREQUAL "smolensk") AND
|
||||
(MYX_CMAKE_LSB_RELEASE_VERSION STREQUAL "1.5"))
|
||||
# cmake-format: on
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_CXX_EXTENSIONS ON)
|
||||
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "e2k")
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
set(CMAKE_CXX_EXTENSIONS ON)
|
||||
add_compile_options(-Wno-invalid-offsetof)
|
||||
list(APPEND CMAKE_LIBRARY_PATH "/usr/lib/e2k-linux-gnu")
|
||||
endif()
|
||||
if(CMAKE_COLOR_MAKEFILE)
|
||||
check_enable_cxx_compiler_flag(-fdiagnostics-color=auto)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
if(CMAKE_COLOR_MAKEFILE)
|
||||
check_enable_cxx_compiler_flag(-fcolor-diagnostics)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
option(MYX_CMAKE_WARNINGS_NORMAL "Normal level" ON)
|
||||
cmake_dependent_option(MYX_CMAKE_WARNINGS_VERBOSE "Verbose level" OFF "MYX_CMAKE_WARNINGS_NORMAL" OFF)
|
||||
|
||||
if(MYX_CMAKE_WARNINGS_NORMAL)
|
||||
if((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") OR
|
||||
(CMAKE_CXX_COMPILER_ID STREQUAL "GNU"))
|
||||
check_enable_cxx_compiler_flag(-Wall)
|
||||
check_enable_cxx_compiler_flag(-Wextra)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(MYX_CMAKE_WARNINGS_VERBOSE)
|
||||
if((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") OR
|
||||
(CMAKE_CXX_COMPILER_ID STREQUAL "GNU"))
|
||||
check_enable_cxx_compiler_flag(-Wpedantic)
|
||||
check_enable_cxx_compiler_flag(-Wnoexcept)
|
||||
endif()
|
||||
endif()
|
34
MyxCMake/lib/LSBInfo.cmake
Normal file
34
MyxCMake/lib/LSBInfo.cmake
Normal file
@ -0,0 +1,34 @@
|
||||
include_guard(GLOBAL)
|
||||
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL Linux)
|
||||
set(MYX_CMAKE_LSB_DISTRIBUTOR_ID "unknown")
|
||||
set(MYX_CMAKE_LSB_CODENAME "unknown")
|
||||
set(MYX_CMAKE_LSB_RELEASE_VERSION "unknown")
|
||||
|
||||
if(CMAKE_CROSSCOMPILING)
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(EXISTS /etc/mcst_version)
|
||||
set(MYX_CMAKE_LSB_DISTRIBUTOR_ID "ElbrusD")
|
||||
set(MYX_CMAKE_LSB_CODENAME "Jessie")
|
||||
execute_process(COMMAND cat /etc/mcst_version
|
||||
OUTPUT_VARIABLE MYX_CMAKE_LSB_RELEASE_VERSION
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
else()
|
||||
find_program(LSB_RELEASE_EXECUTABLE lsb_release)
|
||||
# cmake-format: off
|
||||
if(LSB_RELEASE_EXECUTABLE)
|
||||
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_VERSION
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
endif()
|
||||
# cmake-format: on
|
||||
endif()
|
||||
endif()
|
35
MyxCMake/lib/Toolchain.cmake
Normal file
35
MyxCMake/lib/Toolchain.cmake
Normal file
@ -0,0 +1,35 @@
|
||||
include_guard(GLOBAL)
|
||||
|
||||
# Предпочтительные пути к утилитам для компоновки
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
# cmake-format: off
|
||||
# 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_VERSION 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")
|
||||
# Elbrus E2K
|
||||
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "e2k")
|
||||
find_program(CMAKE_GCC_AR NAMES "/usr/${CMAKE_SYSTEM_PROCESSOR}-linux/bin/ar")
|
||||
find_program(CMAKE_GCC_NM NAMES "/usr/${CMAKE_SYSTEM_PROCESSOR}-linux/bin/nm")
|
||||
find_program(CMAKE_GCC_RANLIB NAMES "/usr/${CMAKE_SYSTEM_PROCESSOR}-linux/bin/ranlib")
|
||||
# Другие версии Linux
|
||||
else()
|
||||
find_program(CMAKE_GCC_AR NAMES "gcc-ar" "ar")
|
||||
find_program(CMAKE_GCC_NM NAMES "gcc-nm" "nm")
|
||||
find_program(CMAKE_GCC_RANLIB NAMES "gcc-ranlib" "ranlib")
|
||||
endif()
|
||||
# cmake-format: on
|
||||
|
||||
if(CMAKE_GCC_AR)
|
||||
set(CMAKE_AR ${CMAKE_GCC_AR} CACHE STRING "" FORCE)
|
||||
endif()
|
||||
if(CMAKE_GCC_NM)
|
||||
set(CMAKE_NM ${CMAKE_GCC_NM} CACHE STRING "" FORCE)
|
||||
endif()
|
||||
if(CMAKE_GCC_RANLIB)
|
||||
set(CMAKE_RANLIB ${CMAKE_GCC_RANLIB} CACHE STRING "" FORCE)
|
||||
endif()
|
||||
endif()
|
34
MyxCMake/lib/macro/CheckEnableCxxCompilerFlag.cmake
Normal file
34
MyxCMake/lib/macro/CheckEnableCxxCompilerFlag.cmake
Normal file
@ -0,0 +1,34 @@
|
||||
include_guard(GLOBAL)
|
||||
|
||||
# based on https://github.com/bluescarni/yacma
|
||||
|
||||
include(CheckCXXCompilerFlag)
|
||||
|
||||
macro(check_enable_cxx_compiler_flag flag)
|
||||
set(options)
|
||||
set(oneValueArgs TARGET)
|
||||
set(multiValueArgs)
|
||||
cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
|
||||
set(cmake_required_quiet TRUE)
|
||||
check_cxx_compiler_flag("${flag}" check_cxx_flag)
|
||||
unset(cmake_required_quiet)
|
||||
|
||||
if(check_cxx_flag)
|
||||
if(ARG_TARGET)
|
||||
target_compile_options(${ARG_TARGET} PUBLIC ${flag})
|
||||
else()
|
||||
add_compile_options(${flag})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
unset(check_cxx_flag CACHE)
|
||||
foreach(iter IN LISTS oneValueArgs multiValueArgs)
|
||||
unset(ARG_${iter})
|
||||
endforeach()
|
||||
unset(ARG_UNPARSED_ARGUMENTS)
|
||||
unset(multiValueArgs)
|
||||
unset(oneValueArgs)
|
||||
unset(options)
|
||||
endmacro()
|
||||
|
@ -4,7 +4,6 @@ macro(myx_find_packages)
|
||||
set(options)
|
||||
set(oneValueArgs)
|
||||
set(multiValueArgs PACKAGES Boost Qt5 Qt5Private)
|
||||
|
||||
cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
|
||||
foreach(iter ${ARG_PACKAGES})
|
||||
|
@ -3,7 +3,7 @@
|
||||
## Установка
|
||||
|
||||
В корневом каталоге проекта создать каталог `cmake` и распаковать в него
|
||||
[архив](../../../releases/download/2.0.3/myx-cmake-local-2.0.3.tar.xz ).
|
||||
[архив](../../../releases/download/2.0.4/myx-cmake-local-2.0.4.tar.xz ).
|
||||
|
||||
## Использование
|
||||
|
||||
|
2
debian/CMakeLists.txt
vendored
2
debian/CMakeLists.txt
vendored
@ -1,5 +1,5 @@
|
||||
cmake_minimum_required(VERSION 3.6 FATAL_ERROR)
|
||||
project(myx-cmake VERSION 2.0.3 LANGUAGES)
|
||||
project(myx-cmake VERSION 2.0.4 LANGUAGES)
|
||||
|
||||
include(GNUInstallDirs)
|
||||
file(WRITE ${CMAKE_SOURCE_DIR}/MyxCMake/MyxCMakeConfigVersion.cmake
|
||||
|
2
debian/changelog
vendored
2
debian/changelog
vendored
@ -1,4 +1,4 @@
|
||||
myx-cmake (2.0.3) unstable; urgency=medium
|
||||
myx-cmake (2.0.4) unstable; urgency=medium
|
||||
|
||||
* New version.
|
||||
|
||||
|
@ -20,11 +20,11 @@ if(ENV{MYX_CMAKE_DIR})
|
||||
set(MYX_CMAKE_DIR $ENV{MYX_CMAKE_DIR})
|
||||
endif()
|
||||
if(MYX_CMAKE_DIR)
|
||||
find_package(MyxCMake 2.0.3 REQUIRED CONFIG PATHS ${MYX_CMAKE_DIR} NO_DEFAULT_PATH)
|
||||
find_package(MyxCMake 2.0.4 REQUIRED CONFIG PATHS ${MYX_CMAKE_DIR} NO_DEFAULT_PATH)
|
||||
myx_message_notice("=== MyxCMake directory: ${MyxCMake_CONFIG} ===")
|
||||
else()
|
||||
if(MYX_CMAKE_USE_SYSTEM)
|
||||
find_package(MyxCMake 2.0.3 REQUIRED)
|
||||
find_package(MyxCMake 2.0.4 REQUIRED)
|
||||
myx_message_notice("=== MyxCMake directory: ${MyxCMake_CONFIG} ===")
|
||||
else()
|
||||
include(${PROJECT_SOURCE_DIR}/cmake/myx/MyxCMakeConfig.cmake)
|
||||
|
Loading…
Reference in New Issue
Block a user