diff --git a/CMakeLists.txt b/CMakeLists.txt index ea76098..0cd5883 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,12 +42,13 @@ configure_package_config_file( ${CMAKE_INSTALL_DATAROOTDIR}/cserver/cmake) install(EXPORT cserverTargets - FILE cserverTargets.cmake + FILE cserverTargets.cmake NAMESPACE cserver:: DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/cserver/cmake) install(FILES "${PROJECT_BINARY_DIR}/cserverConfig.cmake" "${PROJECT_BINARY_DIR}/cserverConfigVersion.cmake" + "${PROJECT_BINARY_DIR}/cmake/check.cpp" DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/cserver/cmake) install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/cserver DESTINATION include) diff --git a/cmake/check.cpp b/cmake/check.cpp new file mode 100644 index 0000000..d34ac6f --- /dev/null +++ b/cmake/check.cpp @@ -0,0 +1,28 @@ +#include +#include + +struct SomeStruct { + constexpr SomeStruct(auto&& arg) { + arg.Method(42); + }; +}; + +struct Injector { + template {}>{}> + auto Method(T&&) const -> void; +}; + +template +inline constexpr auto Use() { + std::ignore = T{Args...}; +}; + +template +consteval auto Ignore() {}; + + +auto main() -> int { + Ignore())>(); + static_assert(std::is_same_v{})), utempl::TypeList>); +}; + diff --git a/cmake/cserverConfig.cmake.in b/cmake/cserverConfig.cmake.in index 9c15f36..c7e7b35 100644 --- a/cmake/cserverConfig.cmake.in +++ b/cmake/cserverConfig.cmake.in @@ -2,3 +2,9 @@ include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake") 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()