diff --git a/CMakeLists.txt b/CMakeLists.txt index cb9f911..c240940 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -62,8 +62,6 @@ if(${PPPLUGIN_ENABLE_CPP17_COMPATIBILITY}) set(CMAKE_CXX_STANDARD 17) # TODO: generate C++17 compatible header files instead add_definitions("-DPPPLUGIN_CPP17_COMPATIBILITY") - target_link_libraries(${LIBRARY_TARGET_SHARED} fmt::fmt) - target_link_libraries(${LIBRARY_TARGET_STATIC} fmt::fmt) else() set(CMAKE_CXX_STANDARD 20) endif() diff --git a/include/expected.h b/include/expected.h index 677994b..5f6768c 100644 --- a/include/expected.h +++ b/include/expected.h @@ -41,8 +41,15 @@ class Expected { template && std::is_convertible_v>> constexpr Expected(const Expected& rhs); - template && std::is_nothrow_convertible_v>> + template && std::is_convertible_v> +#else + , + typename = std::enable_if_t && std::is_nothrow_convertible_v> +#endif // PPPLUGIN_CPP17_COMPATIBILITY + > constexpr Expected(Expected&& rhs) noexcept; constexpr Expected& operator=(const Expected&) = default; constexpr Expected& operator=(Expected&&) noexcept = default; diff --git a/include/plugin.h b/include/plugin.h index 78af381..f7698f0 100644 --- a/include/plugin.h +++ b/include/plugin.h @@ -42,10 +42,10 @@ class GenericPlugin { GenericPlugin() = default; template > || ...), bool> = true> + std::enable_if_t<(std::is_base_of_v>> || ...), bool> = true> GenericPlugin(P&& plugin); // NOLINT(google-explicit-constructor,hicpp-explicit-conversions) - virtual ~GenericPlugin() = default; + ~GenericPlugin() = default; GenericPlugin(const GenericPlugin&) = default; GenericPlugin(GenericPlugin&&) noexcept = default; GenericPlugin& operator=(const GenericPlugin&) = default; @@ -68,7 +68,7 @@ using Plugin = GenericPlugin template > || ...), bool>> + std::enable_if_t<(std::is_base_of_v>> || ...), bool>> // NOLINTNEXTLINE(bugprone-forwarding-reference-overload); enable_if condition prevents hiding copy/move ctors GenericPlugin::GenericPlugin(P&& plugin) : plugin_(std::forward

(plugin)) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7da13f6..fda0a36 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -10,6 +10,9 @@ target_link_libraries( PUBLIC Boost::python PUBLIC Python::Python PRIVATE ${LUA_LIBRARIES}) +if(${PPPLUGIN_ENABLE_CPP17_COMPATIBILITY}) + target_link_libraries(${LIBRARY_TARGET} PUBLIC fmt::fmt) +endif() target_include_directories( ${LIBRARY_TARGET} PUBLIC $ diff --git a/test/expected_tests.cpp b/test/expected_tests.cpp index f1a0945..75a7380 100644 --- a/test/expected_tests.cpp +++ b/test/expected_tests.cpp @@ -1,5 +1,5 @@ #include "expected.h" -#include "test/test_types.h" +#include "test_types.h" #include "test_helper.h" #include