Add compiler support check
This commit is contained in:
parent
e01ff2f396
commit
a0ef6c01e4
3 changed files with 36 additions and 1 deletions
|
@ -48,6 +48,7 @@ install(EXPORT cserverTargets
|
||||||
|
|
||||||
install(FILES "${PROJECT_BINARY_DIR}/cserverConfig.cmake"
|
install(FILES "${PROJECT_BINARY_DIR}/cserverConfig.cmake"
|
||||||
"${PROJECT_BINARY_DIR}/cserverConfigVersion.cmake"
|
"${PROJECT_BINARY_DIR}/cserverConfigVersion.cmake"
|
||||||
|
"${PROJECT_BINARY_DIR}/cmake/check.cpp"
|
||||||
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/cserver/cmake)
|
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/cserver/cmake)
|
||||||
|
|
||||||
install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/cserver DESTINATION include)
|
install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/cserver DESTINATION include)
|
||||||
|
|
28
cmake/check.cpp
Normal file
28
cmake/check.cpp
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
#include <utempl/loopholes/core.hpp>
|
||||||
|
#include <utempl/type_list.hpp>
|
||||||
|
|
||||||
|
struct SomeStruct {
|
||||||
|
constexpr SomeStruct(auto&& arg) {
|
||||||
|
arg.Method(42);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Injector {
|
||||||
|
template <typename T, auto _ = utempl::loopholes::Injector<0, utempl::TypeList<T>{}>{}>
|
||||||
|
auto Method(T&&) const -> void;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename T, auto... Args>
|
||||||
|
inline constexpr auto Use() {
|
||||||
|
std::ignore = T{Args...};
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename...>
|
||||||
|
consteval auto Ignore() {};
|
||||||
|
|
||||||
|
|
||||||
|
auto main() -> int {
|
||||||
|
Ignore<decltype(Use<SomeStruct, Injector{}>())>();
|
||||||
|
static_assert(std::is_same_v<decltype(Magic(utempl::loopholes::Getter<0>{})), utempl::TypeList<int>>);
|
||||||
|
};
|
||||||
|
|
|
@ -2,3 +2,9 @@
|
||||||
|
|
||||||
include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake")
|
include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake")
|
||||||
check_required_components("@PROJECT_NAME@")
|
check_required_components("@PROJECT_NAME@")
|
||||||
|
|
||||||
|
try_compile(loopholes_body_inject
|
||||||
|
SOURCES "${CMAKE_CURRENT_LIST_DIR}/check.cpp")
|
||||||
|
if(NOT loopholes_body_inject)
|
||||||
|
message(FATAL_ERROR "The Compiler Doesn't Support Retrieval Of Information Via Loopholes. If You Are Using gcc, Enable Optimizations.")
|
||||||
|
endif()
|
||||||
|
|
Loading…
Reference in a new issue