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

Fix hpp-fclConfig.cmake on Windows #633

Merged
merged 3 commits into from
Dec 4, 2024
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
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
Loading