Getting ready

We wish to compile the following source code into a single executable:

#include <cstdlib>#include <iostream>#include <string>std::string say_hello() { return std::string("Hello, CMake world!"); }int main() {  std::cout << say_hello() << std::endl;  return EXIT_SUCCESS;}

Get CMake Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.