<commit_before>CPM
===

[![Build Status](https://travis-ci.org/iauns/cpm.png)](https://travis-ci.org/iauns/cpm)

C++ Package Manager based on CMake.

CPM is designed to save you time and promote small, well-tested, and composable
C++ modules. It allows you to link against multiple different versions of the
same static library so that you can include other C++ modules that may depend
on older or newer versions of the same modules you are using. CPM will also
automatically download and build these C++ modules for you. CPM's goal is to
help support the growth of a "do one thing and do it well" module ecosystem in
C++. To explore the ecosystem head on over to the CPM website:
http://cpmcpp.com (or http://cmakepm.org).

Using CPM, you can also manage C or C++ libraries that do not use CPM. A number
of what we call 'external' modules are already in the cpm-modules repository.
These modules abstract away the details of writing a CMake external project for
you. Just be aware that you cannot statically link against multiple different
versions of these external modules because they are not built as CPM modules.
Although the changes necessary to convert a code base to a CPM module are
minor mostly dealing with namespace names.

Below is a simple example of a CMakeLists.txt file that uses 3 different
modules. The modules are a simple OpenGL wrapper library name Spire, MongoDB's
C library, and G-truc's GLSL vector math library. See the next section for a
full explanation of how to use CPM and work with the namespaces it creates.
Example:

```cmake
  cmake_minimum_required(VERSION 2.8.11 FATAL_ERROR)
  project(Viewer)
  
  #------------------------------------------------------------------------------
  # Required CPM Setup - See: http://github.com/iauns/cpm
  #------------------------------------------------------------------------------
  set(CPM_DIR "${CMAKE_CURRENT_BINARY_DIR}/cpm_packages" CACHE TYPE STRING)
  find_package(Git)
  if(NOT GIT_FOUND)
    message(FATAL_ERROR "CPM requires Git.")
  endif()
  if (NOT EXISTS ${CPM_DIR}/CPM.cmake)
    message(STATUS "Cloning repo (https://github.com/iauns/cpm)")
    execute_process(
      COMMAND "${GIT_EXECUTABLE}" clone https://github.com/iauns/cpm ${CPM_DIR}
      RESULT_VARIABLE error_code
      OUTPUT_QUIET ERROR_QUIET)
    if(error_code)
      message(FATAL_ERROR "CPM failed to get the hash for HEAD")
    endif()
  endif()
  include(${CPM_DIR}/CPM.cmake)
  
  # ++ MODULE: Spire
  CPM_AddModule("spire"
    GIT_REPOSITORY "https://github.com/SCIInstitute/spire"
    GIT_TAG "v0.7.0")

  # ++ EXTERNAL-MODULE: MongoDB
  CPM_AddModule("mongodb"
    GIT_REPOSITORY "https://github.com/iauns/cpm-mongoc"
    GIT_TAG "origin/master")

  # ++ EXTERNAL-MODULE: GLM
  CPM_AddModule("glm"
    GIT_REPOSITORY "https://github.com/iauns/cpm-glm"
    GIT_TAG "0.9.4.6")
  
  CPM_Finish()
  
  #-----------------------------------------------------------------------
  # Setup source
  #-----------------------------------------------------------------------
  file(GLOB Sources
    "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp"
    "${CMAKE_CURRENT_SOURCE_DIR}/*.hpp"<commit_msg>Embelish on short CPM example.<commit_after>CPM
===

[![Build Status](https://travis-ci.org/iauns/cpm.png)](https://travis-ci.org/iauns/cpm)

C++ Package Manager based on CMake.

CPM is designed to save you time and promote small, well-tested, and composable
C++ modules. It allows you to link against multiple different versions of the
same static library so that you can include other C++ modules that may depend
on older or newer versions of the same modules you are using. CPM will also
automatically download and build these C++ modules for you. CPM's goal is to
help support the growth of a "do one thing and do it well" module ecosystem in
C++. To explore the ecosystem head on over to the CPM website:
http://cpmcpp.com (or http://cmakepm.org).

Using CPM, you can also manage C or C++ libraries that do not use CPM. A number
of what we call 'external' modules are already in the cpm-modules repository.
These modules abstract away the details of writing a CMake external project for
you. Just be aware that you cannot statically link against multiple different
versions of these external modules because they are not built as CPM modules.
Although the changes necessary to convert a code base to a CPM module are
minor mostly dealing with namespace names.

Below is a simple example of a CMakeLists.txt file that uses 3 different
modules. The modules are a simple OpenGL wrapper library name Spire, MongoDB's
C library, and G-truc's GLSL vector math library. See the next section for a
full explanation of how to use CPM and work with the namespaces it creates.
Example:

```cmake
  cmake_minimum_required(VERSION 2.8.11 FATAL_ERROR)
  project(Viewer)
  
  #------------------------------------------------------------------------------
  # CPM Setup - See: http://github.com/iauns/cpm
  #------------------------------------------------------------------------------
  set(CPM_DIR "${CMAKE_CURRENT_BINARY_DIR}/cpm_packages" CACHE TYPE STRING)
  find_package(Git)
  if(NOT GIT_FOUND)
    message(FATAL_ERROR "CPM requires Git.")
  endif()
  if (NOT EXISTS ${CPM_DIR}/CPM.cmake)
    message(STATUS "Cloning repo (https://github.com/iauns/cpm)")
    execute_process(
      COMMAND "${GIT_EXECUTABLE}" clone https://github.com/iauns/cpm ${CPM_DIR}
      RESULT_VARIABLE error_code
      OUTPUT_QUIET ERROR_QUIET)
    if(error_code)
      message(FATAL_ERROR "CPM failed to get the hash for HEAD")
    endif()
  endif()
  include(${CPM_DIR}/CPM.cmake)

  #------------------------------------------------------------------------------
  # Add CPM Modules
  #------------------------------------------------------------------------------
  
  # ++ MODULE: Spire
  CPM_AddModule("spire"
    GIT_REPOSITORY "https://github.com/SCIInstitute/spire"
    GIT_TAG "v0.7.0")

  # ++ EXTERNAL-MODULE: MongoDB
  CPM_AddModule("mongodb"
    GIT_REPOSITORY "https://github.com/iauns/cpm-mongoc"
    GIT_TAG "origin/master")

  # ++ EXTERNAL-MODULE: GLM
  CPM_AddModule("glm"
    GIT_REPOSITORY "https://github.com/iauns/cpm-glm"
    GIT_TAG "0.9.4.6")
  
  CPM_Finish()
  
  #-----------------------------------------------------------------------
  # Setup source
  #-----------------------------------------------------------------------
  file(GLOB Sources
    "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp"
    "${CMAKE_CURRENT_SOURCE_DIR}/*.hpp"
{'fraction_non_alphanumeric': 0.19755758231565929, 'fraction_numerical': 0.0037100015458339775, 'mean_word_length': 2.3662851196670136, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 14, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3559471', 'n_tokens_mistral': 1948, 'n_tokens_neox': 1888, 'n_words': 669}