Skip to content

Commit

Permalink
cmake: Export targets in the libcommute:: namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
krivenko committed Nov 11, 2022
1 parent 228c7d1 commit e3aab02
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

All notable changes to this project will be documented in this file.

## [0.7.2] - 2022-11-10
## [0.7.2] - Unreleased

- Export CMake targets in the ``libcommute::`` namespace.
- Install CMake configuration files into
``${CMAKE_INSTALL_PREFIX}/lib/cmake/libcommute``, which is the recommended
location.
Expand Down
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ configure_package_config_file(
"${PROJECT_BINARY_DIR}/libcommuteConfig.cmake"
INSTALL_DESTINATION lib/cmake
)
install(EXPORT libcommuteTargets DESTINATION lib/cmake/libcommute)
install(EXPORT libcommuteTargets
NAMESPACE libcommute::
DESTINATION lib/cmake/libcommute)
install(FILES "${PROJECT_BINARY_DIR}/libcommuteConfigVersion.cmake"
"${PROJECT_BINARY_DIR}/libcommuteConfig.cmake"
DESTINATION lib/cmake/libcommute)
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@ a minimal example of an application `CMakeLists.txt` file.
set(libcommute_DIR ${libcommute_ROOT}/lib/cmake)
# Import libcommute target
find_package(libcommute 0.4 CONFIG REQUIRED)
find_package(libcommute 0.7.2 CONFIG REQUIRED)
# Build an executable called 'myprog'
add_executable(myprog myprog.cpp)
target_link_libraries(myprog PRIVATE libcommute)
target_link_libraries(myprog PRIVATE libcommute::libcommute)
```

DSL for quantum-mechanical operators
Expand Down
9 changes: 7 additions & 2 deletions doc/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,13 @@ project.
set(libcommute_DIR ${libcommute_ROOT}/lib/cmake)
# Import libcommute target
find_package(libcommute 0.4 CONFIG REQUIRED)
find_package(libcommute 0.7.2 CONFIG REQUIRED)
# Build an executable called 'myprog'
add_executable(myprog myprog.cpp)
target_link_libraries(myprog PRIVATE libcommute)
target_link_libraries(myprog PRIVATE libcommute::libcommute)
.. note::

Starting from version 0.7.2, *libcommute* exports the namespaced CMake target
``libcommute::libcommute`` instead of just ``libcommute``.

0 comments on commit e3aab02

Please sign in to comment.