Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Project option: NO_IGNITION_PREFIX #191

Merged
merged 3 commits into from
Nov 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions cmake/IgnConfigureProject.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#
# Sets up an ignition library project.
#
# NO_IGNITION_PREFIX: Optional. Don't use ignition as prefix in
# cmake project name.
# VERSION_SUFFIX: Optional. Specify a prerelease version suffix.
#
#===============================================================================
Expand All @@ -29,7 +31,7 @@ macro(ign_configure_project)

#------------------------------------
# Define the expected arguments
set(options) # We are not using options yet
set(options NO_IGNITION_PREFIX)
set(oneValueArgs VERSION_SUFFIX)
set(multiValueArgs) # We are not using multiValueArgs yet

Expand Down Expand Up @@ -60,7 +62,11 @@ macro(ign_configure_project)
# Set project variables
#============================================================================

set(PROJECT_NAME_NO_VERSION "ignition-${IGN_DESIGNATION}")
if(ign_configure_project_NO_IGNITION_PREFIX)
set(PROJECT_NAME_NO_VERSION ${IGN_DESIGNATION})
else()
set(PROJECT_NAME_NO_VERSION "ignition-${IGN_DESIGNATION}")
endif()
string(TOLOWER ${PROJECT_NAME_NO_VERSION} PROJECT_NAME_NO_VERSION_LOWER)
string(TOUPPER ${PROJECT_NAME_NO_VERSION} PROJECT_NAME_NO_VERSION_UPPER)
string(TOLOWER ${PROJECT_NAME} PROJECT_NAME_LOWER)
Expand Down
3 changes: 3 additions & 0 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ endif()

set(example_directories
ign_conf
no_ignition_prefix
prerelease
core_nodep
core_child
Expand All @@ -28,6 +29,8 @@ foreach(example ${example_directories})
set(run_codecheck false)
if (${example} STREQUAL "ign_conf")
set(example_tarball_name ignition-minimal-0.1.0.tar.bz2)
elseif (${example} STREQUAL "no_ignition_prefix")
set(example_tarball_name no_ignition_prefix-0.1.0.tar.bz2)
elseif (${example} STREQUAL "prerelease")
set(example_tarball_name ignition-minimal-1.0.0~pre1.tar.bz2)
elseif (${example} STREQUAL "core_nodep")
Expand Down
7 changes: 7 additions & 0 deletions examples/no_ignition_prefix/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR)
project(no_ignition_prefix VERSION 0.1.0)
find_package(ignition-cmake2 REQUIRED)
ign_configure_project(NO_IGNITION_PREFIX)
ign_configure_build(QUIT_IF_BUILD_ERRORS)
ign_create_packages()
ign_create_docs()
18 changes: 18 additions & 0 deletions examples/no_ignition_prefix/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# no\_ignition\_prefix

This package uses the `NO_IGNITION_PREFIX` option to `ign_configure_project`
to allow a cmake package name without the `ignition-` prefix.
To confirm, build this package and then observe that the tarball,
pkg-config `.pc` file, and cmake config files omit the `ignition-` prefix:

~~~
mkdir build
cd build
cmake ..
make
make package_source
~~~

* `no_ignition_prefix-0.1.0.tar.bz2`
* `cmake/no_ignition_prefix-config.cmake`
* `cmake/pkgconfig/no_ignition_prefix.pc`
Empty file.
28 changes: 28 additions & 0 deletions examples/no_ignition_prefix/src/AlmostEmpty.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Copyright (C) 2021 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

#include <ignition/no_ignition_prefix/Export.hh>

namespace ignition
{
namespace no_ignition_prefix
{
class IGNITION_NO_IGNITION_PREFIX_VISIBLE AlmostEmpty
{
};
}
}
3 changes: 3 additions & 0 deletions examples/no_ignition_prefix/src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ign_get_libsources_and_unittests(sources gtest_sources)
ign_create_core_library(SOURCES ${sources} CXX_STANDARD 11)
ign_build_tests(TYPE UNIT SOURCES ${gtest_sources})
Empty file.