diff --git a/MyxCMake/MyxCMakeConfig.cmake b/MyxCMake/MyxCMakeConfig.cmake index f74cff9..48d5f02 100644 --- a/MyxCMake/MyxCMakeConfig.cmake +++ b/MyxCMake/MyxCMakeConfig.cmake @@ -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}") diff --git a/MyxCMake/functions/MyxCMakeHighPrecisionMath.cmake b/MyxCMake/functions/MyxCMakeHighPrecisionMath.cmake index 67bcb76..b9dee33 100644 --- a/MyxCMake/functions/MyxCMakeHighPrecisionMath.cmake +++ b/MyxCMake/functions/MyxCMakeHighPrecisionMath.cmake @@ -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() diff --git a/MyxCMake/modules/MyxCMakeAddSharedLibrary.cmake b/MyxCMake/modules/MyxCMakeAddSharedLibrary.cmake index 94dd6e0..8f85f89 100644 --- a/MyxCMake/modules/MyxCMakeAddSharedLibrary.cmake +++ b/MyxCMake/modules/MyxCMakeAddSharedLibrary.cmake @@ -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 $) diff --git a/MyxCMake/modules/MyxCMakeAddStaticLibrary.cmake b/MyxCMake/modules/MyxCMakeAddStaticLibrary.cmake index 0cd7db9..f41a436 100644 --- a/MyxCMake/modules/MyxCMakeAddStaticLibrary.cmake +++ b/MyxCMake/modules/MyxCMakeAddStaticLibrary.cmake @@ -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 $) diff --git a/MyxCMake/modules/MyxCMakeBuildTypes.cmake b/MyxCMake/modules/MyxCMakeBuildTypes.cmake index 98bd779..075a104 100644 --- a/MyxCMake/modules/MyxCMakeBuildTypes.cmake +++ b/MyxCMake/modules/MyxCMakeBuildTypes.cmake @@ -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() diff --git a/MyxCMake/modules/MyxCMakeCheckPaths.cmake b/MyxCMake/modules/MyxCMakeCheckPaths.cmake index 6c06f9e..e176fe0 100644 --- a/MyxCMake/modules/MyxCMakeCheckPaths.cmake +++ b/MyxCMake/modules/MyxCMakeCheckPaths.cmake @@ -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() diff --git a/MyxCMake/modules/MyxCMakeColoredMessages.cmake b/MyxCMake/modules/MyxCMakeColoredMessages.cmake index 95da001..248877b 100644 --- a/MyxCMake/modules/MyxCMakeColoredMessages.cmake +++ b/MyxCMake/modules/MyxCMakeColoredMessages.cmake @@ -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) diff --git a/MyxCMake/modules/MyxCMakeCommonTargetProperties.cmake b/MyxCMake/modules/MyxCMakeCommonTargetProperties.cmake index 3315a2a..3ff2f9e 100644 --- a/MyxCMake/modules/MyxCMakeCommonTargetProperties.cmake +++ b/MyxCMake/modules/MyxCMakeCommonTargetProperties.cmake @@ -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) diff --git a/MyxCMake/modules/MyxCMakeCompilerFlags.cmake b/MyxCMake/modules/MyxCMakeCompilerFlags.cmake index cadad3f..6e4459d 100644 --- a/MyxCMake/modules/MyxCMakeCompilerFlags.cmake +++ b/MyxCMake/modules/MyxCMakeCompilerFlags.cmake @@ -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) diff --git a/MyxCMake/modules/MyxCMakeDistCC.cmake b/MyxCMake/modules/MyxCMakeDistCC.cmake index 4c11b37..f7879fb 100644 --- a/MyxCMake/modules/MyxCMakeDistCC.cmake +++ b/MyxCMake/modules/MyxCMakeDistCC.cmake @@ -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 diff --git a/MyxCMake/modules/MyxCMakeProjectVersion.cmake b/MyxCMake/modules/MyxCMakeProjectVersion.cmake index de5ffa6..bd89b2d 100644 --- a/MyxCMake/modules/MyxCMakeProjectVersion.cmake +++ b/MyxCMake/modules/MyxCMakeProjectVersion.cmake @@ -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() diff --git a/MyxCMake/modules/MyxCMakeRequiredVariables.cmake b/MyxCMake/modules/MyxCMakeRequiredVariables.cmake index 04a19d4..ad31501 100644 --- a/MyxCMake/modules/MyxCMakeRequiredVariables.cmake +++ b/MyxCMake/modules/MyxCMakeRequiredVariables.cmake @@ -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 +