diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index fe61a22d..e62e74f6 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -40,3 +40,10 @@ foreach(T ${CLI_SINGLE_TESTS}) endforeach() + +# Link test (build error if inlines missing) +add_library(link_test_1 link_test_1.cpp) +target_link_libraries(link_test_1 PUBLIC CLI11) +add_executable(link_test_2 link_test_2.cpp) +target_link_libraries(link_test_2 PUBLIC CLI11 link_test_1) +add_gtest(link_test_2) diff --git a/tests/link_test_1.cpp b/tests/link_test_1.cpp new file mode 100644 index 00000000..42a33e4b --- /dev/null +++ b/tests/link_test_1.cpp @@ -0,0 +1,6 @@ +#include "CLI/CLI.hpp" +#include "CLI/Timer.hpp" + +int do_nothing() { + return 7; +} diff --git a/tests/link_test_2.cpp b/tests/link_test_2.cpp new file mode 100644 index 00000000..85990149 --- /dev/null +++ b/tests/link_test_2.cpp @@ -0,0 +1,12 @@ +#include "CLI/CLI.hpp" +#include "CLI/Timer.hpp" +#include + +int do_nothing(); + +// Verifies there are no ungarded inlines +TEST(Link, DoNothing) { + int a = do_nothing(); + EXPECT_EQ(7, a); +} +