This commit is contained in:
2022-10-07 08:03:03 +03:00
parent 432a1a85e6
commit f0203307c4
8 changed files with 14 additions and 28 deletions

View File

@ -1,4 +1,4 @@
set(MYX_CMAKE_PACKAGE_VERSION "2.0.4")
set(MYX_CMAKE_PACKAGE_VERSION "2.0.5")
if(MYX_CMAKE_PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
set(PACKAGE_VERSION_COMPATIBLE FALSE)
else()

View File

@ -8,10 +8,11 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
# cmake-format: on
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_EXTENSIONS ON)
check_enable_cxx_compiler_flag(-Wno-shadow)
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "e2k")
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_EXTENSIONS ON)
add_compile_options(-Wno-invalid-offsetof)
check_enable_cxx_compiler_flag(-Wno-invalid-offsetof)
list(APPEND CMAKE_LIBRARY_PATH "/usr/lib/e2k-linux-gnu")
endif()
if(CMAKE_COLOR_MAKEFILE)
@ -25,21 +26,3 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
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()

View File

@ -10,16 +10,19 @@ macro(check_enable_cxx_compiler_flag flag)
set(multiValueArgs)
cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
set(cmake_required_quiet TRUE)
set(CMAKE_REQUIRED_QUIET TRUE)
check_cxx_compiler_flag("${flag}" check_cxx_flag)
unset(cmake_required_quiet)
unset(CMAKE_REQUIRED_QUIET)
if(check_cxx_flag)
myx_message_notice("'${flag}': flag is supported.")
if(ARG_TARGET)
target_compile_options(${ARG_TARGET} PUBLIC ${flag})
else()
add_compile_options(${flag})
endif()
else()
myx_message_status("'${flag}': flag is NOT supported.")
endif()
unset(check_cxx_flag CACHE)