Update issue 79
Added a test which uses gflags_declare.h as any other project would use it to avoid such avoidable build configuration mistakes.
#add_gflags_test(deadlock_if_cant_lock 0 "PASS" "" gflags_unittest --deadlock_if_cant_lock)
# ----------------------------------------------------------------------------
+# use gflags_declare.h
+add_executable (gflags_declare_test gflags_declare_test.cc gflags_declare_flags.cc)
+
+add_test(NAME gflags_declare COMMAND gflags_declare_test --message "Hello gflags!")
+set_tests_properties(gflags_declare PROPERTIES PASS_REGULAR_EXPRESSION "Hello gflags!")
+
+# ----------------------------------------------------------------------------
# (negative) compilation tests
if (BUILD_NC_TESTS)
find_package (PythonInterp)
--- /dev/null
+#include <iostream>
+#include <gflags/gflags_declare.h>
+
+DECLARE_string(message); // in gflags_delcare_test.cc
+
+void print_message()
+{
+ std::cout << FLAGS_message << std::endl;
+}
--- /dev/null
+#include <gflags/gflags.h>
+
+DEFINE_string(message, "", "The message to print");
+void print_message(); // in gflags_declare_flags.cc
+
+int main(int argc, char **argv)
+{
+ gflags::SetUsageMessage("Test compilation and use of gflags_declare.h");
+ gflags::ParseCommandLineFlags(&argc, &argv, true);
+ print_message();
+ return 0;
+}