Adjust some error/warning messages and fix include directories
This commit is contained in:
+30
-16
@@ -62,7 +62,7 @@ function(string_append_target_includes)
|
|||||||
# Scan linked libraries as well.
|
# Scan linked libraries as well.
|
||||||
get_target_property(_els ${_target} LINK_LIBRARIES)
|
get_target_property(_els ${_target} LINK_LIBRARIES)
|
||||||
foreach(_lib ${_els})
|
foreach(_lib ${_els})
|
||||||
#string_append_target_includes(LINKED TARGET "${_lib}" OUTPUT "_out" PREFIX "${_ARGS_PREFIX}")
|
string_append_target_includes(LINKED TARGET "${_lib}" OUTPUT "_out" PREFIX "${_ARGS_PREFIX}")
|
||||||
endforeach()
|
endforeach()
|
||||||
endif()
|
endif()
|
||||||
elseif((${target_type} STREQUAL "INTERFACE_LIBRARY"))
|
elseif((${target_type} STREQUAL "INTERFACE_LIBRARY"))
|
||||||
@@ -70,7 +70,7 @@ function(string_append_target_includes)
|
|||||||
set(test "$<$<BOOL:${prop}>:${_ARGS_PREFIX}$<JOIN:${prop}, ${_ARGS_PREFIX}>>")
|
set(test "$<$<BOOL:${prop}>:${_ARGS_PREFIX}$<JOIN:${prop}, ${_ARGS_PREFIX}>>")
|
||||||
set(_out "${_out}${test} ")
|
set(_out "${_out}${test} ")
|
||||||
else()
|
else()
|
||||||
message("clang: Unsupported Target type '${target_type}', please open an issue for this.")
|
message("Clang for CMake: Unsupported Target type '${target_type}', please open an issue for this.")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@@ -100,11 +100,11 @@ function(generate_compile_commands_json)
|
|||||||
set(COMPILER_INCLUDE_PREFIX "-I")
|
set(COMPILER_INCLUDE_PREFIX "-I")
|
||||||
set(COMPILER_DEFINE_PREFIX "-D")
|
set(COMPILER_DEFINE_PREFIX "-D")
|
||||||
else()
|
else()
|
||||||
message("clang-tidy: C ID '${CMAKE_C_COMPILER_ID}'")
|
message("Clang for CMake: C ID '${CMAKE_C_COMPILER_ID}'")
|
||||||
message("clang-tidy: C Version '${CMAKE_C_COMPILER_VERSION}'")
|
message("Clang for CMake: C Version '${CMAKE_C_COMPILER_VERSION}'")
|
||||||
message("clang-tidy: C++ ID '${CMAKE_CXX_COMPILER_ID}'")
|
message("Clang for CMake: C++ ID '${CMAKE_CXX_COMPILER_ID}'")
|
||||||
message("clang-tidy: C++ Version '${CMAKE_CXX_COMPILER_VERSION}'")
|
message("Clang for CMake: C++ Version '${CMAKE_CXX_COMPILER_VERSION}'")
|
||||||
message(FATAL_ERROR "clang-tidy: Current Compiler is not yet supported, please open an issue for it.")
|
message(FATAL_ERROR "Clang for CMake: Current Compiler is not yet supported, please open an issue for it.")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Default Filter
|
# Default Filter
|
||||||
@@ -145,9 +145,7 @@ function(generate_compile_commands_json)
|
|||||||
## C++ Standard
|
## C++ Standard
|
||||||
get_target_property(_el ${_target} CXX_STANDARD)
|
get_target_property(_el ${_target} CXX_STANDARD)
|
||||||
if(COMPILER_TAG STREQUAL "MSVC")
|
if(COMPILER_TAG STREQUAL "MSVC")
|
||||||
if(${MSVC_VERSION} LESS "1920")
|
if(${MSVC_VERSION} GREATER_EQUAL "1920")
|
||||||
message(FATAL_ERROR "clang-tidy: Current Compiler is not yet supported, please open an issue for it.")
|
|
||||||
else()
|
|
||||||
if((_el EQUAL 98) OR (_el EQUAL 11))
|
if((_el EQUAL 98) OR (_el EQUAL 11))
|
||||||
# Nothing to do, this is the default.
|
# Nothing to do, this is the default.
|
||||||
elseif(_el EQUAL 14)
|
elseif(_el EQUAL 14)
|
||||||
@@ -157,6 +155,22 @@ function(generate_compile_commands_json)
|
|||||||
elseif(_el EQUAL 20)
|
elseif(_el EQUAL 20)
|
||||||
string(APPEND COMPILER_OPTIONS "/std:c++latest ")
|
string(APPEND COMPILER_OPTIONS "/std:c++latest ")
|
||||||
endif()
|
endif()
|
||||||
|
elseif(${MSVC_VERSION} GREATER_EQUAL "1910")
|
||||||
|
if((_el EQUAL 98) OR (_el EQUAL 11))
|
||||||
|
# Nothing to do, this is the default.
|
||||||
|
elseif(_el EQUAL 14)
|
||||||
|
string(APPEND COMPILER_OPTIONS "/std:c++14 ")
|
||||||
|
elseif(_el EQUAL 17)
|
||||||
|
string(APPEND COMPILER_OPTIONS "/std:c++17 ")
|
||||||
|
elseif(_el EQUAL 20)
|
||||||
|
string(APPEND COMPILER_OPTIONS "/std:c++latest ")
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
message("Clang for CMake: C ID '${CMAKE_C_COMPILER_ID}'")
|
||||||
|
message("Clang for CMake: C Version '${CMAKE_C_COMPILER_VERSION}'")
|
||||||
|
message("Clang for CMake: C++ ID '${CMAKE_CXX_COMPILER_ID}'")
|
||||||
|
message("Clang for CMake: C++ Version '${CMAKE_CXX_COMPILER_VERSION}'")
|
||||||
|
message(FATAL_ERROR "Clang for CMake: Current Compiler is not yet supported, please open an issue for it.")
|
||||||
endif()
|
endif()
|
||||||
elseif((COMPILER_TAG STREQUAL "CLANG") OR (COMPILER_TAG STREQUAL "GNU"))
|
elseif((COMPILER_TAG STREQUAL "CLANG") OR (COMPILER_TAG STREQUAL "GNU"))
|
||||||
if(_el EQUAL 98)
|
if(_el EQUAL 98)
|
||||||
@@ -240,7 +254,7 @@ function(clang_format)
|
|||||||
bin32
|
bin32
|
||||||
)
|
)
|
||||||
if(NOT CLANG_FORMAT_BIN)
|
if(NOT CLANG_FORMAT_BIN)
|
||||||
message(WARNING "Clang: Could not find clang-format at path '${CLANG_FORMAT_BIN}', disabling clang-format...")
|
message(WARNING "Clang for CMake: Could not find clang-format at path '${CLANG_FORMAT_BIN}', disabling clang-format...")
|
||||||
return()
|
return()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@@ -257,12 +271,12 @@ function(clang_format)
|
|||||||
ERROR_QUIET
|
ERROR_QUIET
|
||||||
)
|
)
|
||||||
if(NOT _VERSION_RESULT EQUAL 0)
|
if(NOT _VERSION_RESULT EQUAL 0)
|
||||||
message(WARNING "Clang: Could not discover version, disabling clang-format...")
|
message(WARNING "Clang for CMake: Could not discover version, disabling clang-format...")
|
||||||
return()
|
return()
|
||||||
endif()
|
endif()
|
||||||
string(REGEX MATCH "([0-9]+\.[0-9]+\.[0-9]+)" _VERSION_MATCH ${_VERSION_OUTPUT})
|
string(REGEX MATCH "([0-9]+\.[0-9]+\.[0-9]+)" _VERSION_MATCH ${_VERSION_OUTPUT})
|
||||||
if(NOT ${_VERSION_MATCH} VERSION_GREATER_EQUAL ${_ARGS_VERSION})
|
if(NOT ${_VERSION_MATCH} VERSION_GREATER_EQUAL ${_ARGS_VERSION})
|
||||||
message(WARNING "Clang: Old version discovered, disabling clang-format...")
|
message(WARNING "Clang for CMake: Old version discovered, disabling clang-format...")
|
||||||
return()
|
return()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
@@ -338,7 +352,7 @@ function(clang_tidy)
|
|||||||
bin32
|
bin32
|
||||||
)
|
)
|
||||||
if(NOT CLANG_TIDY_BIN)
|
if(NOT CLANG_TIDY_BIN)
|
||||||
message(WARNING "Clang: Could not find clang-tidy at path '${CLANG_TIDY_BIN}', disabling clang-tidy...")
|
message(WARNING "Clang for CMake: Could not find clang-tidy at path '${CLANG_TIDY_BIN}', disabling clang-tidy...")
|
||||||
return()
|
return()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@@ -355,12 +369,12 @@ function(clang_tidy)
|
|||||||
ERROR_QUIET
|
ERROR_QUIET
|
||||||
)
|
)
|
||||||
if(NOT _VERSION_RESULT EQUAL 0)
|
if(NOT _VERSION_RESULT EQUAL 0)
|
||||||
message(WARNING "Clang: Could not discover version, disabling clang-tidy...")
|
message(WARNING "Clang for CMake: Could not discover version, disabling clang-tidy...")
|
||||||
return()
|
return()
|
||||||
endif()
|
endif()
|
||||||
string(REGEX MATCH "([0-9]+\.[0-9]+\.[0-9]+)" _VERSION_MATCH ${_VERSION_OUTPUT})
|
string(REGEX MATCH "([0-9]+\.[0-9]+\.[0-9]+)" _VERSION_MATCH ${_VERSION_OUTPUT})
|
||||||
if(NOT ${_VERSION_MATCH} VERSION_GREATER_EQUAL ${_ARGS_VERSION})
|
if(NOT ${_VERSION_MATCH} VERSION_GREATER_EQUAL ${_ARGS_VERSION})
|
||||||
message(WARNING "Clang: Old version discovered, disabling clang-tidy...")
|
message(WARNING "Clang for CMake: Old version discovered, disabling clang-tidy...")
|
||||||
return()
|
return()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
Reference in New Issue
Block a user