Skip to content

Commit

Permalink
Use REPLACE_INCLUDE_PATH and NO_PROJECT_PREFIX
Browse files Browse the repository at this point in the history
Signed-off-by: methylDragon <[email protected]>
  • Loading branch information
methylDragon committed Jul 12, 2022
1 parent efe92a3 commit fb9a7eb
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 20 deletions.
4 changes: 2 additions & 2 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@
1. Do not modify `CMAKE_FIND_LIBRARY_PREFIXES` and `CMAKE_FIND_LIBRARY_SUFFIXES` on Windows
* [Pull request #189](https://github.com/gazebosim/gz-cmake/pull/189)

1. Project option: `REPLACE_GZ_INCLUDE_PATH`
1. Project option: `REPLACE_INCLUDE_PATH`
* [Pull request #190](https://github.com/gazebosim/gz-cmake/pull/190)

1. Project option: `NO_GZ_PREFIX`
1. Project option: `NO_PROJECT_PREFIX`
* [Pull request #191](https://github.com/gazebosim/gz-cmake/pull/191)

### Gazebo CMake 2.9.0 (2021-09-02)
Expand Down
22 changes: 11 additions & 11 deletions cmake/GzConfigureProject.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
#
# Sets up a Gazebo library project.
#
# NO_GZ_PREFIX: Optional. Don't use Gazebo as prefix in
# NO_PROJECT_PREFIX: Optional. Don't use gz- as prefix in
# cmake project name.
# REPLACE_GZ_INCLUDE_PATH: Optional. Specify include folder
# REPLACE_INCLUDE_PATH: Optional. Specify include folder
# names to replace the default value of
# gz/${GZ_DESIGNATION}
# VERSION_SUFFIX: Optional. Specify a prerelease version suffix.
Expand All @@ -34,8 +34,8 @@ macro(ign_configure_project)
# TODO(chapulina) Enable warnings after all libraries have migrated.
# message(WARNING "ign_configure_project is deprecated, use gz_configure_project instead.")

set(options NO_GZ_PREFIX NO_IGNITION_PREFIX) # TODO(CH3): NO_IGNITION_PREFIX IS DEPRECATED.
set(oneValueArgs REPLACE_GZ_INCLUDE_PATH REPLACE_IGNITION_INCLUDE_PATH VERSION_SUFFIX) # TODO(CH3): REPLACE_IGNITION_INCLUDE_PATH IS DEPRECATED.
set(options NO_PROJECT_PREFIX NO_IGNITION_PREFIX) # TODO(CH3): NO_IGNITION_PREFIX IS DEPRECATED.
set(oneValueArgs REPLACE_INCLUDE_PATH REPLACE_IGNITION_INCLUDE_PATH VERSION_SUFFIX) # TODO(CH3): REPLACE_IGNITION_INCLUDE_PATH IS DEPRECATED.
set(multiValueArgs) # We are not using multiValueArgs yet
_gz_cmake_parse_arguments(gz_configure_project "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})

Expand All @@ -48,8 +48,8 @@ macro(gz_configure_project)
if (NOT gz_configure_project_skip_parsing)
#------------------------------------
# Define the expected arguments
set(options NO_GZ_PREFIX NO_IGNITION_PREFIX) # TODO(CH3): NO_IGNITION_PREFIX IS DEPRECATED.
set(oneValueArgs REPLACE_GZ_INCLUDE_PATH REPLACE_IGNITION_INCLUDE_PATH VERSION_SUFFIX) # TODO(CH3): REPLACE_IGNITION_INCLUDE_PATH IS DEPRECATED.
set(options NO_PROJECT_PREFIX NO_IGNITION_PREFIX) # TODO(CH3): NO_IGNITION_PREFIX IS DEPRECATED.
set(oneValueArgs REPLACE_INCLUDE_PATH REPLACE_IGNITION_INCLUDE_PATH VERSION_SUFFIX) # TODO(CH3): REPLACE_IGNITION_INCLUDE_PATH IS DEPRECATED.
set(multiValueArgs) # We are not using multiValueArgs yet

#------------------------------------
Expand Down Expand Up @@ -87,10 +87,10 @@ macro(gz_configure_project)
# Set project variables
#============================================================================

if(gz_configure_project_NO_GZ_PREFIX)
if(gz_configure_project_NO_PROJECT_PREFIX)
set(PROJECT_NAME_NO_VERSION ${GZ_DESIGNATION})
elseif(gz_configure_project_NO_IGNITION_PREFIX) # TODO(CH3): NO_IGNITION_PREFIX IS DEPRECATED.
message(DEPRECATION "[NO_IGNITION_PREFIX] is deprecated. Please use [NO_GZ_PREFIX] instead!")
message(DEPRECATION "[NO_IGNITION_PREFIX] is deprecated. Please use [NO_PROJECT_PREFIX] instead!")
set(PROJECT_NAME_NO_VERSION ${GZ_DESIGNATION})
else()
set(PROJECT_NAME_NO_VERSION "${PROJECT_PREFIX}-${GZ_DESIGNATION}")
Expand All @@ -116,10 +116,10 @@ macro(gz_configure_project)
set(PROJECT_EXPORT_NAME ${PROJECT_NAME_LOWER})
set(PROJECT_LIBRARY_TARGET_NAME ${PROJECT_NAME_LOWER})

if(gz_configure_project_REPLACE_GZ_INCLUDE_PATH)
set(PROJECT_INCLUDE_DIR ${gz_configure_project_REPLACE_GZ_INCLUDE_PATH})
if(gz_configure_project_REPLACE_INCLUDE_PATH)
set(PROJECT_INCLUDE_DIR ${gz_configure_project_REPLACE_INCLUDE_PATH})
elseif(gz_configure_project_REPLACE_IGNITION_INCLUDE_PATH) # TODO(CH3): REPLACE_IGNITION_INCLUDE_PATH IS DEPRECATED.
message(DEPRECATION "[REPLACE_IGNITION_INCLUDE_PATH] is deprecated. Please use [REPLACE_GZ_INCLUDE_PATH] instead!")
message(DEPRECATION "[REPLACE_IGNITION_INCLUDE_PATH] is deprecated. Please use [REPLACE_INCLUDE_PATH] instead!")
set(PROJECT_INCLUDE_DIR ${gz_configure_project_REPLACE_IGNITION_INCLUDE_PATH})
else()
set(PROJECT_INCLUDE_DIR gz/${GZ_DESIGNATION})
Expand Down
2 changes: 1 addition & 1 deletion examples/comp_deps/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR)
project(gz-component_deps VERSION 0.1.0)
find_package(gz-cmake3 REQUIRED)
gz_configure_project(
REPLACE_GZ_INCLUDE_PATH gz/component_deps
REPLACE_INCLUDE_PATH gz/component_deps
)
gz_configure_build(QUIT_IF_BUILD_ERRORS
COMPONENTS child parent)
Expand Down
2 changes: 1 addition & 1 deletion examples/core_nodep/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR)
project(gz-core_no_deps VERSION 0.1.0)
find_package(gz-cmake3 REQUIRED)
gz_configure_project(
REPLACE_GZ_INCLUDE_PATH gz/core_no_deps
REPLACE_INCLUDE_PATH gz/core_no_deps
)
gz_configure_build(QUIT_IF_BUILD_ERRORS)
gz_create_packages()
Expand Down
2 changes: 1 addition & 1 deletion examples/core_nodep_static/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR)
project(gz-core_no_deps_static VERSION 0.1.0)
find_package(gz-cmake3 REQUIRED)
gz_configure_project(
REPLACE_GZ_INCLUDE_PATH gz/core_no_deps_static
REPLACE_INCLUDE_PATH gz/core_no_deps_static
)
OPTION(BUILD_SHARED_LIBS OFF)
gz_configure_build(QUIT_IF_BUILD_ERRORS)
Expand Down
4 changes: 2 additions & 2 deletions examples/no_gz_prefix/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR)
project(no_gz_prefix VERSION 0.1.0)
find_package(gz-cmake3 REQUIRED)
gz_configure_project(
NO_GZ_PREFIX
REPLACE_GZ_INCLUDE_PATH no_gz)
NO_PROJECT_PREFIX
REPLACE_INCLUDE_PATH no_gz)
gz_configure_build(QUIT_IF_BUILD_ERRORS)
gz_create_packages()
gz_create_docs()
4 changes: 2 additions & 2 deletions examples/no_gz_prefix/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Configuring project name

This package uses the `NO_GZ_PREFIX` option in `gz_configure_project`
This package uses the `NO_PROJECT_PREFIX` option in `gz_configure_project`
to allow a cmake package name without the `gz-` prefix.
To confirm, configure this package and
`package_source` and then observe that the tarball,
Expand All @@ -21,7 +21,7 @@ make package_source

## Configuring include directory names

This package uses the `REPLACE_GZ_INCLUDE_PATH` option in `gz_configure_project`
This package uses the `REPLACE_INCLUDE_PATH` option in `gz_configure_project`
to allow a custom include path of `no_gz`, which doesn't start with `ignition/`.
To confirm, build the package and observe that `AlmostEmpty.cc`
compiles successfully while including `no_gz/Export.hh`:
Expand Down

0 comments on commit fb9a7eb

Please sign in to comment.