1
0
mirror of https://github.com/wjwwood/serial.git synced 2026-01-22 11:44:53 +08:00

cmake: Add option for alternative name cxx-serial.

The name serial is problematic when packaging since it's basically too
generic and easily generates name clashes. Add an option which builds
the package as cxx-serial instead, by default off to not break existing
usage.

Gbp-Pq: Name 0008-cmake-Add-option-for-alternative-name-cxx-serial.patch
This commit is contained in:
Alec Leamas 2020-09-22 15:51:26 +02:00
parent e1dabd8649
commit 5f1ab387b7
2 changed files with 13 additions and 3 deletions

View File

@ -1,16 +1,26 @@
cmake_minimum_required(VERSION 3.5.0) cmake_minimum_required(VERSION 3.5.0)
option(USE_CXX_SERIAL "build package name cxx-serial" OFF)
if (USE_CXX_SERIAL)
set(PKG_NAME cxx-serial)
else ()
set(PKG_NAME serial)
endif ()
message(STATUS "Building package ${PKG_NAME}")
# Find catkin # Find catkin
find_package(catkin REQUIRED) find_package(catkin REQUIRED)
set(PROJ_SOVERSION 1) set(PROJ_SOVERSION 1)
project(serial project(${PKG_NAME}
VERSION 1.2.1 VERSION 1.2.1
DESCRIPTION "Cross-platform, Serial Port library written in C++" DESCRIPTION "Cross-platform, Serial Port library written in C++"
HOMEPAGE_URL "http://wjwwood.io/serial/" HOMEPAGE_URL "http://wjwwood.io/serial/"
) )
configure_file(package.xml.in ${PROJECT_SOURCE_DIR}/package.xml @ONLY)
if(APPLE) if(APPLE)
find_library(IOKIT_LIBRARY IOKit) find_library(IOKIT_LIBRARY IOKit)
find_library(FOUNDATION_LIBRARY Foundation) find_library(FOUNDATION_LIBRARY Foundation)
@ -19,7 +29,7 @@ endif()
# Public options and command line configuration # Public options and command line configuration
option(ENABLE_TEST_PROGRAM "Build test program" OFF) option(ENABLE_TEST_PROGRAM "Build test program" OFF)
option(CATKIN_ENABLE_TESTING "Enable catkin unit tests" ON) option(CATKIN_ENABLE_TESTING "Enable catkin unit tests" ON)
set(SERIAL_DOCDIR ${CMAKE_INSTALL_PREFIX}/share/doc/serial set(SERIAL_DOCDIR ${CMAKE_INSTALL_PREFIX}/share/doc/${PROJECT_NAME}
CACHE STRING "Installation root for doxygen docs." CACHE STRING "Installation root for doxygen docs."
) )

View File

@ -1,6 +1,6 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<package> <package>
<name>serial</name> <name>@PROJECT_NAME@</name>
<version>1.2.1</version> <version>1.2.1</version>
<description> <description>
Serial is a cross-platform, simple to use library for using serial ports on computers. Serial is a cross-platform, simple to use library for using serial ports on computers.