1 #include <iostream> 2 #include <gflags/gflags.h> 3 4 DEFINE_string(message, "Hello World!", "The message to print"); 5 ValidateMessage(const char * flagname,const std::string & message)6static bool ValidateMessage(const char* flagname, const std::string &message) 7 { 8 return !message.empty(); 9 } 10 DEFINE_validator(message, ValidateMessage); 11 main(int argc,char ** argv)12int main(int argc, char **argv) 13 { 14 gflags::SetUsageMessage("Test CMake configuration of gflags library (gflags-config.cmake)"); 15 gflags::SetVersionString("0.1"); 16 gflags::ParseCommandLineFlags(&argc, &argv, true); 17 std::cout << FLAGS_message << std::endl; 18 gflags::ShutDownCommandLineFlags(); 19 return 0; 20 } 21