1
0
Fork 0
mirror of https://github.com/Neargye/magic_enum.git synced 2026-01-09 23:34:23 +00:00

Add support for the ROS build system (#161)

This commit is contained in:
Tim Clephas 2022-03-12 19:04:42 +01:00 committed by GitHub
parent 718d2601b2
commit 948c760939
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 35 additions and 1 deletions

View file

@ -37,6 +37,8 @@ write_basic_package_version_file(${PROJECT_NAME}ConfigVersion.cmake
ARCH_INDEPENDENT)
if(MAGIC_ENUM_OPT_INSTALL)
include(GNUInstallDirs)
install(TARGETS ${PROJECT_NAME}
EXPORT ${PROJECT_NAME}Config)
@ -52,4 +54,7 @@ if(MAGIC_ENUM_OPT_INSTALL)
export(EXPORT ${PROJECT_NAME}Config
NAMESPACE ${PROJECT_NAME}::)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/package.xml
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME})
endif()

View file

@ -139,7 +139,7 @@ enum class Color { RED = 2, BLUE = 4, GREEN = 8 };
// color_entries[0].first -> Color::RED
// color_entries[0].second -> "RED"
```
* Enum fusion for multi-level switch/case statements
```cpp
@ -250,6 +250,13 @@ enum class Color { RED = 2, BLUE = 4, GREEN = 8 };
(Note that you must use a supported compiler or specify it with `export CC= <compiler>`.)
* If you are using [Ros](https://www.ros.org/), you can include this package by adding `<depend>magic_enum</depend>` to your package.xml and include this package in your workspace. In your CMakeLists.txt add the following:
```cmake
find_package(magic_enum CONFIG REQUIRED)
...
target_link_libraries(your_executable magic_enum::magic_enum)
```
## Compiler compatibility
* Clang/LLVM >= 5

22
package.xml Normal file
View file

@ -0,0 +1,22 @@
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format2.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<!-- A package.xml in the root of a cmake projects allows it to be built using catkin or colcon (the ROS build system) -->
<package format="2">
<name>magic_enum</name>
<version>0.7.3</version>
<description>
Static reflection for enums (to string, from string, iteration) for modern C++,
work with any enum type without any macro or boilerplate code
</description>
<maintainer email="neargye@gmail.com">Neargye</maintainer>
<license>MIT</license>
<buildtool_depend>cmake</buildtool_depend>
<export>
<build_type>cmake</build_type>
</export>
</package>