From f09ac0eb6cfcf39edab82ba2e206d15cb07058e9 Mon Sep 17 00:00:00 2001 From: Milian Wolff Date: Thu, 30 Apr 2015 13:26:27 +0200 Subject: [PATCH] Stay backwards compatible to old Boost 1.41 for RHEL 6 compatibility. --- CMakeLists.txt | 2 +- heaptrack_print.cpp | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3cd9666..b0dbbdf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,7 @@ SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wpedantic") -find_package(Boost 1.45.0 REQUIRED COMPONENTS iostreams program_options) +find_package(Boost 1.41.0 REQUIRED COMPONENTS iostreams program_options) find_package(Threads REQUIRED) add_subdirectory(3rdparty) diff --git a/heaptrack_print.cpp b/heaptrack_print.cpp index 3b252ad..3dc5fb4 100644 --- a/heaptrack_print.cpp +++ b/heaptrack_print.cpp @@ -840,7 +840,7 @@ int main(int argc, char** argv) { po::options_description desc("Options"); desc.add_options() - ("file,f", po::value()->required(), + ("file,f", po::value(), "The heaptrack data file to print.") ("shorten-templates,t", po::value()->default_value(true)->implicit_value(true), "Shorten template identifiers.") @@ -891,6 +891,14 @@ int main(int argc, char** argv) return 1; } + if (!vm.count("file")) { + // NOTE: stay backwards compatible to old boost 1.41 available in RHEL 6 + // otherwise, we could simplify this by setting the file option + // as ->required() using the new 1.42 boost API + cerr << "ERROR: the option '--file' is required but missing\n\n" << desc << endl; + return 1; + } + AccumulatedTraceData data; const auto inputFile = vm["file"].as(); -- 2.7.4