<commit_before>CPM
===

CMake C++ Package Manager.

Using CPM
=========

To use CPM in your C++ project, include the following at the top of your
CMakeLists.txt:

```
#------------------------------------------------------------------------------
# Required CPM Setup - See: http://github.com/iauns/cpm
#------------------------------------------------------------------------------
set (CPM_DIR "${CMAKE_CURRENT_BINARY_DIR}/cpm-packages" CACHE TYPE STRING)
if (${CPM_DIR} MATCHES "${CMAKE_CURRENT_BINARY_DIR}")
  message("NOTE: Placing CPM in the binary directory is not recommended.")
endif ()

find_package(Git)
if(NOT GIT_FOUND)
  message(FATAL_ERROR "CPM requires Git.")
endif()
if (NOT EXISTS ${CPM_DIR}/CPM.cmake)
  execute_process(
    COMMAND "${GIT_EXECUTABLE}" clone https://github.com/iauns/cpm ${CPM_DIR}
    RESULT_VARIABLE error_code
    OUTPUT_VARIABLE head_sha
    )
  if(error_code)
    message(FATAL_ERROR "CPM failed to get the hash for HEAD")
  endif()
endif()
include(${CPM_DIR}/CPM.cmake)

# Include any modules here...

# Finalize CPM.
CPM_Finish()
```

Then add the `${CPM_LIBRARIES}` variable to your `target_link_libraries`.

That's it. You will be able to start using CPM modules right away by adding
something like

```
CPM_AddModule("spire"
  GIT_REPOSITORY "https://github.com/SCIInstitute/spire"
  GIT_TAG "v0.7.0")
```

to the "# Include any modules here" section mentioned in the code snippet
above. This will automatically download, build, and link version 0.7.0 of a
thin OpenGL client named Spire. A new namespace is generated for 'spire' and
a preprocessor definition for this namespace is automatically added to your 
project. This definition always follows the form "`CPM_<NAME>_NS`" where
`<NAME>` is the first argument of your call to `CPM_AddModule`. The name is
always capitalized before being added to your preprocessor definitions.

So, in the 'spire' example above we would have a new preprocessor definition
`CPM_SPIRE_NS` added to our project. This declares the namepsace under which
we have bound Spire and you can access spire through this namespace:
`CPM_SPIRE_NS::Interface`. Using this approach, we can *statically* link
against multiple different versions of the spire library and control a number
of settings regarding how these libraries are linked into your program.
Linking against different versions of a library becomes very useful if
multiple modules depend on different versions of the same library.

CPM Externals
-------------
<commit_msg>Adding advice for renaming the automatically generated namespaces.<commit_after>CPM
===

CMake C++ Package Manager.

Using CPM
=========

To use CPM in your C++ project, include the following at the top of your
CMakeLists.txt:

```
#------------------------------------------------------------------------------
# Required CPM Setup - See: http://github.com/iauns/cpm
#------------------------------------------------------------------------------
set (CPM_DIR "${CMAKE_CURRENT_BINARY_DIR}/cpm-packages" CACHE TYPE STRING)
if (${CPM_DIR} MATCHES "${CMAKE_CURRENT_BINARY_DIR}")
  message("NOTE: Placing CPM in the binary directory is not recommended.")
endif ()

find_package(Git)
if(NOT GIT_FOUND)
  message(FATAL_ERROR "CPM requires Git.")
endif()
if (NOT EXISTS ${CPM_DIR}/CPM.cmake)
  execute_process(
    COMMAND "${GIT_EXECUTABLE}" clone https://github.com/iauns/cpm ${CPM_DIR}
    RESULT_VARIABLE error_code
    OUTPUT_VARIABLE head_sha
    )
  if(error_code)
    message(FATAL_ERROR "CPM failed to get the hash for HEAD")
  endif()
endif()
include(${CPM_DIR}/CPM.cmake)

# Include any modules here...

# Finalize CPM.
CPM_Finish()
```

Then add the `${CPM_LIBRARIES}` variable to your `target_link_libraries`.

That's it. You will be able to start using CPM modules right away by adding
something like

```
CPM_AddModule("spire"
  GIT_REPOSITORY "https://github.com/SCIInstitute/spire"
  GIT_TAG "v0.7.0")
```

to the "# Include any modules here" section mentioned in the code snippet
above. This will automatically download, build, and link version 0.7.0 of a
thin OpenGL client named Spire. A new namespace is generated for 'spire' and
a preprocessor definition for this namespace is automatically added to your 
project. This definition always follows the form "`CPM_<NAME>_NS`" where
`<NAME>` is the first argument of your call to `CPM_AddModule`. The name is
always capitalized before being added to your preprocessor definitions.

So, in the 'spire' example above we would have a new preprocessor definition
`CPM_SPIRE_NS` added to our project. This declares the namepsace under which
we have bound Spire and you can access spire through this namespace:
`CPM_SPIRE_NS::Interface`. In general you will want to rename the namespace
to something more appropriate: `namespace Spire = CPM_SPIRE_NS`.

Using this approach, we can *statically* link against multiple different
versions of the spire library and control a number of settings regarding how
these libraries are linked into your program.  Linking against different
versions of a library becomes very useful if multiple modules depend on
different versions of the same library.

CPM Externals
-------------

{'fraction_non_alphanumeric': 0.14409889897624106, 'fraction_numerical': 0.0023179447556499902, 'mean_word_length': 3.4446351931330472, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, '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': '7601216', 'n_tokens_mistral': 1536, 'n_tokens_neox': 1476, 'n_words': 603}