Подсветка сообщений
This commit is contained in:
parent
42db4201e7
commit
5b6ed5b79b
@ -5,7 +5,7 @@ get_filename_component(MYX_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" DIRECTORY)
|
||||
|
||||
set(MYX_CMAKE_FUNCTIONS_DIR "${MYX_CMAKE_DIR}/functions")
|
||||
if(NOT IS_DIRECTORY "${MYX_CMAKE_FUNCTIONS_DIR}")
|
||||
message(STATUS "MyxCMake: Functions directory is not found.")
|
||||
myx_cmake_message_warning("MyxCMake: Functions directory is not found.")
|
||||
else()
|
||||
if(NOT ${MYX_CMAKE_FUNCTIONS_DIR} IN_LIST CMAKE_MODULE_PATH)
|
||||
list(INSERT CMAKE_MODULE_PATH 0 "${MYX_CMAKE_FUNCTIONS_DIR}")
|
||||
@ -14,7 +14,7 @@ endif()
|
||||
|
||||
set(MYX_CMAKE_THIRDPARTY_DIR "${MYX_CMAKE_DIR}/thirdparty")
|
||||
if(NOT IS_DIRECTORY "${MYX_CMAKE_THIRDPARTY_DIR}")
|
||||
message(STATUS "MyxCMake: Thirdparty submodule is not found.")
|
||||
myx_cmake_message_warning("MyxCMake: Thirdparty submodule is not found.")
|
||||
else()
|
||||
if(NOT ${MYX_CMAKE_THIRDPARTY_DIR} IN_LIST CMAKE_MODULE_PATH)
|
||||
list(INSERT CMAKE_MODULE_PATH 0 "${MYX_CMAKE_THIRDPARTY_DIR}")
|
||||
@ -23,7 +23,7 @@ endif()
|
||||
|
||||
set(MYX_CMAKE_SANITIZERS_DIR "${MYX_CMAKE_DIR}/sanitizers")
|
||||
if(NOT IS_DIRECTORY "${MYX_CMAKE_SANITIZERS_DIR}")
|
||||
message(STATUS "MyxCMake: Sanitizers submodule is not found.")
|
||||
myx_cmake_message_warning(STATUS "MyxCMake: Sanitizers submodule is not found.")
|
||||
else()
|
||||
if(NOT ${MYX_CMAKE_SANITIZERS_DIR} IN_LIST CMAKE_MODULE_PATH)
|
||||
list(INSERT CMAKE_MODULE_PATH 0 "${MYX_CMAKE_SANITIZERS_DIR}")
|
||||
@ -33,7 +33,7 @@ endif()
|
||||
|
||||
set(MYX_CMAKE_FIND_DIR "${MYX_CMAKE_DIR}/find")
|
||||
if(NOT IS_DIRECTORY "${MYX_CMAKE_FIND_DIR}")
|
||||
message(STATUS "MyxCMake: Custom find submodules are not found.")
|
||||
myx_cmake_message_warning("MyxCMake: Custom find submodules are not found.")
|
||||
else()
|
||||
if(NOT ${MYX_CMAKE_FIND_DIR} IN_LIST CMAKE_MODULE_PATH)
|
||||
list(INSERT CMAKE_MODULE_PATH 0 "${MYX_CMAKE_FIND_DIR}")
|
||||
@ -42,7 +42,7 @@ endif()
|
||||
|
||||
set(MYX_CMAKE_MODULES_DIR "${MYX_CMAKE_DIR}/modules")
|
||||
if(NOT IS_DIRECTORY "${MYX_CMAKE_MODULES_DIR}")
|
||||
message(FATAL_ERROR "MyxCMake: Requried modules directory is not found.")
|
||||
myx_cmake_message_error("MyxCMake: Requried modules directory is not found.")
|
||||
else()
|
||||
if(NOT ${MYX_CMAKE_MODULES_DIR} IN_LIST CMAKE_MODULE_PATH)
|
||||
list(INSERT CMAKE_MODULE_PATH 0 "${MYX_CMAKE_MODULES_DIR}")
|
||||
|
@ -7,7 +7,7 @@ function(myx_cmake_enable_high_precision_math)
|
||||
if(MPFR_FOUND)
|
||||
find_package(MPFRCppThirdparty)
|
||||
else()
|
||||
message(FATAL_ERROR "Nor Quadmath, nor MPFR found.")
|
||||
myx_cmake_message_error("MyxCMake: Nor Quadmath, nor MPFR found.")
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
|
@ -7,9 +7,7 @@ function(myx_cmake_add_shared_library target)
|
||||
endif()
|
||||
get_target_property(__target_type ${target} TYPE)
|
||||
if(NOT __target_type STREQUAL OBJECT_LIBRARY)
|
||||
message(FATAL_ERROR
|
||||
"MyxCMake: myx_cmake_add_shared_library needs target of type OBJECT_LIBRARY")
|
||||
return()
|
||||
myx_cmake_message_error("MyxCMake: myx_cmake_add_shared_library needs target of type OBJECT_LIBRARY")
|
||||
endif()
|
||||
|
||||
add_library(${target}-shared SHARED $<TARGET_OBJECTS:${target}>)
|
||||
|
@ -7,9 +7,7 @@ function(myx_cmake_add_static_library target)
|
||||
endif()
|
||||
get_target_property(__target_type ${target} TYPE)
|
||||
if(NOT __target_type STREQUAL OBJECT_LIBRARY)
|
||||
message(FATAL_ERROR
|
||||
"MyxCMake: myx_cmake_add_static_library needs target of type OBJECT_LIBRARY")
|
||||
return()
|
||||
myx_cmake_message_error("MyxCMake: myx_cmake_add_static_library needs target of type OBJECT_LIBRARY")
|
||||
endif()
|
||||
|
||||
add_library(${target}-static STATIC $<TARGET_OBJECTS:${target}>)
|
||||
|
@ -16,7 +16,7 @@ else()
|
||||
if(NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE Debug CACHE STRING "" FORCE)
|
||||
elseif(NOT "${CMAKE_BUILD_TYPE}" IN_LIST _allowed_build_types)
|
||||
message(FATAL_ERROR "Invalid build type: ${CMAKE_BUILD_TYPE}")
|
||||
myx_cmake_message_error("Invalid build type: ${CMAKE_BUILD_TYPE}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
@ -10,13 +10,13 @@ get_filename_component(_binary_realpath "${CMAKE_BINARY_DIR}" REALPATH)
|
||||
get_filename_component(_install_realpath "${CMAKE_INSTALL_PREFIX}" REALPATH)
|
||||
|
||||
if(_install_realpath STREQUAL _binary_realpath)
|
||||
message(FATAL_ERROR "MyxCMake: Cannot install into build directory.")
|
||||
myx_cmake_message_error("MyxCMake: Cannot install into build directory.")
|
||||
endif()
|
||||
|
||||
if(_install_realpath STREQUAL _source_realpath)
|
||||
message(FATAL_ERROR "MyxCMake: Cannot install into source directory.")
|
||||
myx_cmake_message_error("MyxCMake: Cannot install into source directory.")
|
||||
endif()
|
||||
|
||||
if(_source_realpath STREQUAL _binary_realpath)
|
||||
message(FATAL_ERROR "MyxCMake: In-source builds are not allowed.")
|
||||
myx_cmake_message_error("MyxCMake: In-source builds are not allowed.")
|
||||
endif()
|
||||
|
@ -31,7 +31,7 @@ function(myx_cmake_message_status)
|
||||
endfunction()
|
||||
|
||||
function(myx_cmake_message_notice)
|
||||
message(STATUS ${MyxCMakeColorBold}${ARGV}${MyxCMakeColorReset})
|
||||
message(${MyxCMakeColorBold}${ARGV}${MyxCMakeColorReset})
|
||||
endfunction()
|
||||
|
||||
function(myx_cmake_message)
|
||||
|
@ -1,7 +1,6 @@
|
||||
function(myx_cmake_common_target_properties target)
|
||||
if(NOT TARGET ${target})
|
||||
message(FATAL_ERROR "MyxCMake: Target ${target} does not exists.")
|
||||
return()
|
||||
myx_cmake_message_error("MyxCMake: Target ${target} does not exists.")
|
||||
endif()
|
||||
get_target_property(_target_type ${target} TYPE)
|
||||
|
||||
@ -155,8 +154,7 @@ endfunction()
|
||||
|
||||
function(myx_cmake_common_target_properties_post target)
|
||||
if(NOT TARGET ${target})
|
||||
message(FATAL_ERROR "MyxCMake: Target ${target} does not exists.")
|
||||
return()
|
||||
myx_cmake_message_error("MyxCMake: Target ${target} does not exists.")
|
||||
endif()
|
||||
get_target_property(_target_type ${target} TYPE)
|
||||
|
||||
|
@ -25,11 +25,11 @@ macro(CHECK_ENABLE_DEBUG_CXX_FLAG flag)
|
||||
unset(CMAKE_REQUIRED_QUIET)
|
||||
|
||||
if(CHECK_CXX_FLAG_DEBUG)
|
||||
message(STATUS "'${flag}': debug flag is supported.")
|
||||
myx_cmake_message_notice("'${flag}': debug flag is supported.")
|
||||
string(CONCAT _MYX_CMAKE_DETECTED_CXX_FLAGS_DEBUG
|
||||
"${_MYX_CMAKE_DETECTED_CXX_FLAGS_DEBUG} ${flag}")
|
||||
else()
|
||||
message(STATUS "'${flag}': debug flag is NOT supported.")
|
||||
myx_cmake_message_status("'${flag}': debug flag is NOT supported.")
|
||||
endif()
|
||||
# NOTE: check_cxx_compiler stores variables in the cache.
|
||||
unset(CHECK_CXX_FLAG_DEBUG CACHE)
|
||||
|
@ -5,7 +5,7 @@ if(DISTCC_EXECUTABLE)
|
||||
# cmake-format: off
|
||||
if(NOT DEFINED CMAKE_${lang}_COMPILER_LAUNCHER AND
|
||||
NOT CMAKE_${lang}_COMPILER MATCHES ".*/distcc$")
|
||||
myx_cmake_message("MyxCMake: distcc enabled for ${lang}")
|
||||
myx_cmake_message_notice("MyxCMake: distcc enabled for ${lang}")
|
||||
set(CMAKE_${lang}_COMPILER_LAUNCHER ${DISTCC_EXECUTABLE} CACHE STRING "")
|
||||
endif()
|
||||
# cmake-format: on
|
||||
|
@ -1,17 +1,15 @@
|
||||
function(myx_cmake_check_project_version)
|
||||
if(NOT ${PROJECT_VERSION_PATCH} MATCHES "([0-9]+)")
|
||||
message(FATAL_ERROR "MyxCMake: Please set project version in X.Y.Z format")
|
||||
myx_cmake_message_error("MyxCMake: Please set project version in X.Y.Z format")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(myx_cmake_set_project_version_int)
|
||||
# cmake-format: off
|
||||
myx_cmake_check_project_version()
|
||||
math(
|
||||
EXPR
|
||||
_version_int
|
||||
"(${PROJECT_VERSION_MAJOR} << 16) + (${PROJECT_VERSION_MINOR} << 8) + ${PROJECT_VERSION_PATCH}"
|
||||
)
|
||||
math(EXPR _version_int "(${PROJECT_VERSION_MAJOR} << 16) + (${PROJECT_VERSION_MINOR} << 8) + ${PROJECT_VERSION_PATCH}")
|
||||
set_property(GLOBAL PROPERTY PROJECT_VERSION_INT ${_version_int})
|
||||
# cmake-format: on
|
||||
endfunction()
|
||||
|
||||
myx_cmake_set_project_version_int()
|
||||
|
@ -3,32 +3,25 @@
|
||||
# CMakeLists.txt до подключения MyxCMake, либо передать из командной строки
|
||||
# через ключ -D
|
||||
#
|
||||
|
||||
# cmake-format: off
|
||||
if(NOT MYX_CMAKE_ORGANIZATION_NAME)
|
||||
message(
|
||||
FATAL_ERROR
|
||||
"MyxCMake: Required variable MYX_CMAKE_ORGANIZATION_NAME is not defined")
|
||||
myx_cmake_message_error("MyxCMake: Required variable MYX_CMAKE_ORGANIZATION_NAME is not defined")
|
||||
endif()
|
||||
|
||||
if(NOT MYX_CMAKE_AUTHOR_NAME)
|
||||
message(
|
||||
FATAL_ERROR
|
||||
"MyxCMake: Required variable MYX_CMAKE_AUTHOR_NAME is not defined")
|
||||
myx_cmake_message_error("MyxCMake: Required variable MYX_CMAKE_AUTHOR_NAME is not defined")
|
||||
endif()
|
||||
|
||||
if(NOT MYX_CMAKE_AUTHOR_EMAIL)
|
||||
message(
|
||||
FATAL_ERROR
|
||||
"MyxCMake: Required variable MYX_CMAKE_AUTHOR_EMAIL is not defined")
|
||||
myx_cmake_message_error("MyxCMake: Required variable MYX_CMAKE_AUTHOR_EMAIL is not defined")
|
||||
endif()
|
||||
set(CPACK_PACKAGE_CONTACT
|
||||
"${MYX_CMAKE_AUTHOR_NAME} <${MYX_CMAKE_AUTHOR_EMAIL}>"
|
||||
CACHE STRING "")
|
||||
|
||||
if(NOT MYX_CMAKE_DESCRIPTION)
|
||||
message(
|
||||
FATAL_ERROR
|
||||
"MyxCMake: Required variable MYX_CMAKE_DESCRIPTION is not defined")
|
||||
myx_cmake_message_error("MyxCMake: Required variable MYX_CMAKE_DESCRIPTION is not defined")
|
||||
endif()
|
||||
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY
|
||||
${MYX_CMAKE_DESCRIPTION}
|
||||
CACHE STRING "")
|
||||
|
||||
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY ${MYX_CMAKE_DESCRIPTION} CACHE STRING "")
|
||||
set(CPACK_PACKAGE_CONTACT "${MYX_CMAKE_AUTHOR_NAME} <${MYX_CMAKE_AUTHOR_EMAIL}>" CACHE STRING "")
|
||||
# cmake-format: on
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user