What should my CMake file look like for linking my program with the Boost library under Ubuntu?
The errors shown during running make
:
main.cpp:(.text+0x3b): undefined reference to `boost::program_options::options_description::m_default_line_length'
The main file is really simple:
#include <boost/program_options/options_description.hpp>
#include <boost/program_options/option.hpp>
using namespace std;
#include <iostream>
namespace po = boost::program_options;
int main(int argc, char** argv) {
po::options_description desc("Allowed options");
desc.add_options()
("help", "produce help message")
;
return 0;
}
I've managed to do that. The only lines that I've added to my CMake files were:
target_link_libraries(
my_target_file
${Boost_PROGRAM_OPTIONS_LIBRARY}
)