Skip to content

Commit

Permalink
Merge pull request #633 from jorisv/topic/fix_hpp_fcl_windows
Browse files Browse the repository at this point in the history
Fix hpp-fclConfig.cmake on Windows
  • Loading branch information
jorisv authored Dec 4, 2024
2 parents 7103469 + c5efc62 commit 7bf2cfa
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 12 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Remove CMake CMP0167 warnings ([#630](https://github.com/coal-library/coal/pull/630))
- Allow to run test in the build directory on Windows ([#630](https://github.com/coal-library/coal/pull/630))
- Updated nix flake from `hpp-fcl` to `coal` ([#632](https://github.com/coal-library/coal/pull/632)
- Fix hpp-fclConfig.cmake on Windows ([#633](https://github.com/coal-library/coal/pull/633))

### Added
- Add Pixi support ([#629](https://github.com/coal-library/coal/pull/629))
Expand Down
24 changes: 18 additions & 6 deletions hpp-fclConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,22 @@ message(WARNING "Please update your CMake from 'hpp-fcl' to 'coal'")
find_package(coal REQUIRED)

if(NOT TARGET hpp-fcl::hpp-fcl)
add_library(hpp-fcl::hpp-fcl SHARED IMPORTED)
target_link_libraries(hpp-fcl::hpp-fcl INTERFACE coal::coal)
get_property(_cfg TARGET coal::coal PROPERTY IMPORTED_CONFIGURATIONS)
get_property(_loc TARGET coal::coal PROPERTY "IMPORTED_LOCATION_${_cfg}")
set_property(TARGET hpp-fcl::hpp-fcl PROPERTY IMPORTED_LOCATION "${_loc}")
target_compile_definitions(hpp-fcl::hpp-fcl INTERFACE COAL_BACKWARD_COMPATIBILITY_WITH_HPP_FCL)
add_library(hpp-fcl::hpp-fcl INTERFACE IMPORTED)

# Compute the installation prefix relative to this file.
# This code is taken from generated cmake xxxTargets.cmake.
get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH)
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
if(_IMPORT_PREFIX STREQUAL "/")
set(_IMPORT_PREFIX "")
endif()

set_target_properties(
hpp-fcl::hpp-fcl
PROPERTIES INTERFACE_COMPILE_DEFINITIONS
"COAL_BACKWARD_COMPATIBILITY_WITH_HPP_FCL"
INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
INTERFACE_LINK_LIBRARIES "coal::coal")
endif()
8 changes: 2 additions & 6 deletions include/hpp/fcl/coal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,8 @@

#define COAL_BACKWARD_COMPATIBILITY_WITH_HPP_FCL

#ifdef _MSC_VER
#pragma message COAL_DEPRECATED_HEADER( \
"Please update your includes from 'hpp/fcl' to 'coal'")
#else
#warning "Please update your includes from 'hpp/fcl' to 'coal'"
#endif
// Don't setup warning because there can be ignored by -isystem
#pragma message("Please update your includes from 'hpp/fcl' to 'coal'")

#define HPP_FCL_VERSION_AT_LEAST(major, minor, patch) \
COAL_VERSION_AT_LEAST(major, minor, patch)
Expand Down

0 comments on commit 7bf2cfa

Please sign in to comment.