Skip to content
Paul Colby edited this page Dec 26, 2013 · 10 revisions

Building PMDA++

PMDA++ doesn't actually need building... it's a header-only library. However, the project does includes a few buildable components - some examples, and tests. Building these follows the usual cmake build process:

  1. Create an out-of-tree build directory.
  2. Run cmake
  3. Run make and/or make check

For example:

mkdir ~/some/temp/build
cd ~/some/temp/build
cmake /path/to/source/checkout
make check

Building PMDAs Based on PMDA++

Building PMDAs build on the PMDA++ library should be quite easy. A typical CMakeList.txt file would look like:

make_minimum_required (VERSION 2.6 FATAL_ERROR)

project(mypmda)

add_executable("pmda${PROJECT_NAME}" "${PROJECT_NAME}.cpp")

target_link_libraries("pmda${PROJECT_NAME}" pcp pcp_pmda boost_program_options)

# If you don't want Boost dependencies:
#set_property(
#   TARGET "pmda${PROJECT_NAME}"
#   PROPERTY COMPILE_DEFINITIONS PCP_CPP_NO_BOOST
#)

I'd also recommend enabling compiler warnings, such as:

include(CheckCXXCompilerFlag)
check_cxx_compiler_flag(-Wall   HAVE_WALL)
check_cxx_compiler_flag(-Werror HAVE_WERROR)
check_cxx_compiler_flag(-Wextra HAVE_WEXTRA)
if (HAVE_WALL)
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
endif()
if (HAVE_WERROR)
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
endif()
if (HAVE_WEXTRA)
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra")
endif()

See the any of the following for some additional examples / inspiration:

Clone this wiki locally