Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Jose Luis Rivero <[email protected]>
Signed-off-by: Silvio Traversaro <[email protected]>
  • Loading branch information
traversaro and j-rivero committed Apr 20, 2023
1 parent b704b9e commit d7708fc
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ jobs:
id: ci
uses: gazebo-tooling/action-gz-ci@jammy
with:
cmake-args: '-DBUILDSYSTEM_TESTING=True'
cmake-args: '-DBUILDSYSTEM_TESTING=True -DGZ_ENABLE_RELOCATABLE_INSTALL=True'

3 changes: 3 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## Gazebo CMake 3.x

1. Add optional binary relocatability in downstream libraries
* [Pull request #334](https://github.com/gazebosim/gz-cmake/pull/334)

### Gazebo CMake 3.0.1 (2022-10-11)

1. 1. FindIgnOGRE2: preserve PKG_CONFIG_PATH
Expand Down
26 changes: 26 additions & 0 deletions cmake/GzUtils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2003,6 +2003,20 @@ endmacro()
#
# To use this macro, please add gz_find_package(DL)
# in the dependencies of your project
#
# Arguments are as follows:
#
# GET_INSTALL_PREFIX_FUNCTION: Required. The name (with namespace) of the function that returns
# the install directory of the package. Example: gz::${GZ_DESIGNATION}::getInstallPrefix
#
# GET_INSTALL_PREFIX_HEADER: Required. The name (with full relative path) of the include that contains
# the declaration of the ${GET_INSTALL_PREFIX_FUNCTION} function.
# Example: gz/${GZ_DESIGNATION}/InstallationDirectories.hh
#
# OVERRIDE_INSTALL_PREFIX_ENV_VARIABLE: Required. The name of the environmental variable that can be
# used to override the value returned by ${GET_INSTALL_PREFIX_FUNCTION} at runtime.
# Example: GZ_${GZ_DESIGNATION_UPPER}_INSTALL_PREFIX

macro(gz_add_get_install_prefix_impl)
set(_options)
set(_oneValueArgs
Expand Down Expand Up @@ -2068,6 +2082,12 @@ macro(gz_add_get_install_prefix_impl)
#include <${gz_add_get_install_prefix_impl_GET_INSTALL_PREFIX_HEADER}>
#ifdef _MSC_VER
// Disable warnings related to the use of std::getenv
// See https://stackoverflow.com/questions/66090389/c17-what-new-with-error-c4996-getenv-this-function-or-variable-may-be-un
#pragma warning(disable: 4996)
#endif
std::string ${gz_add_get_install_prefix_impl_GET_INSTALL_PREFIX_FUNCTION}()
{
if(const char* override_env_var = std::getenv(\"${gz_add_get_install_prefix_impl_OVERRIDE_INSTALL_PREFIX_ENV_VARIABLE}\"))
Expand Down Expand Up @@ -2126,6 +2146,12 @@ std::string ${gz_add_get_install_prefix_impl_GET_INSTALL_PREFIX_FUNCTION}()
#include <${gz_add_get_install_prefix_impl_GET_INSTALL_PREFIX_HEADER}>
#ifdef _MSC_VER
// Disable warnings related to the use of std::getenv
// See https://stackoverflow.com/questions/66090389/c17-what-new-with-error-c4996-getenv-this-function-or-variable-may-be-un
#pragma warning(disable: 4996)
#endif
std::string ${gz_add_get_install_prefix_impl_GET_INSTALL_PREFIX_FUNCTION}()
{
if(const char* override_env_var = std::getenv(\"${gz_add_get_install_prefix_impl_OVERRIDE_INSTALL_PREFIX_ENV_VARIABLE}\"))
Expand Down
4 changes: 2 additions & 2 deletions test/get_install_prefix/get_install_prefix_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
#include <iostream>
#include <filesystem>

#include <get_install_prefix_test_shared.h>
#include <get_install_prefix_test_static.h>
#include "get_install_prefix_test_shared.h"
#include "get_install_prefix_test_static.h"
#include <get_install_prefix_test_cmake_variables.h>

std::string toCanonical(const std::string input_path)
Expand Down

0 comments on commit d7708fc

Please sign in to comment.