Skip to content

Comments

Fix searching for dll paths, instead of adding .lib path.#6410

Open
larshg wants to merge 1 commit intoPointCloudLibrary:masterfrom
larshg:fixdllpath
Open

Fix searching for dll paths, instead of adding .lib path.#6410
larshg wants to merge 1 commit intoPointCloudLibrary:masterfrom
larshg:fixdllpath

Conversation

@larshg
Copy link
Contributor

@larshg larshg commented Feb 24, 2026

Fixes #6345

@larshg larshg added module: cmake changelog: fix Meta-information for changelog generation labels Feb 24, 2026
@larshg larshg requested a review from Copilot February 24, 2026 16:26
@larshg larshg added this to the pcl-1.16.0 milestone Feb 24, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses Windows CMake import target metadata so that IMPORTED_LOCATION points to the actual runtime .dll (not the .lib import library), fixing $<TARGET_RUNTIME_DLLS:...> behavior (Issue #6345).

Changes:

  • Adds find_file() lookups for per-component DLL paths under ${PCL_ROOT}/bin.
  • Updates imported PCL component targets to use found DLL paths for IMPORTED_LOCATION[_<CONFIG>] while keeping .lib paths in IMPORTED_IMPLIB[_<CONFIG>].
  • Introduces a special-case branch for the io component DLL naming.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 665 to 678
if(PCL_${COMPONENT}_LIBRARY_DEBUG)
set_target_properties(${pcl_component}
PROPERTIES
IMPORTED_CONFIGURATIONS "RELEASE;DEBUG"
IMPORTED_LOCATION_RELEASE "${PCL_${COMPONENT}_LIBRARY}"
IMPORTED_LOCATION_DEBUG "${PCL_${COMPONENT}_LIBRARY_DEBUG}"
IMPORTED_LOCATION_RELEASE "${PCL_${COMPONENT}_DLL_PATH}"
IMPORTED_LOCATION_DEBUG "${PCL_${COMPONENT}_DLL_PATH_DEBUG}"
IMPORTED_IMPLIB_RELEASE "${PCL_${COMPONENT}_LIBRARY}"
IMPORTED_IMPLIB_DEBUG "${PCL_${COMPONENT}_LIBRARY_DEBUG}"
)
else()
set_target_properties(${pcl_component}
PROPERTIES
IMPORTED_LOCATION "${PCL_${COMPONENT}_LIBRARY}"
IMPORTED_LOCATION "${PCL_${COMPONENT}_DLL_PATH}"
IMPORTED_IMPLIB "${PCL_${COMPONENT}_LIBRARY}"
Copy link

Copilot AI Feb 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMPORTED_LOCATION* is being set to ${PCL_${COMPONENT}_DLL_PATH} unconditionally. On non-Windows platforms and on Windows static builds there may be no .dll (and find_file(... .dll) will fail), resulting in an empty/incorrect IMPORTED_LOCATION and a broken imported target. Please gate the DLL lookup + IMPORTED_LOCATION* override behind WIN32 and PCL_SHARED_LIBS (or @PCL_LIB_TYPE@ STREQUAL "SHARED"), and otherwise keep using ${PCL_${COMPONENT}_LIBRARY} for IMPORTED_LOCATION* as before.

Copilot uses AI. Check for mistakes.
Comment on lines +649 to +664
if ("${component}" STREQUAL "io")
find_file(PCL_${COMPONENT}_DLL_PATH
NAMES
pcl_io_ply$${PCL_RELEASE_SUFFIX}.dll
pcl_io_ply$${PCL_RELWITHDEBINFO_SUFFIX}.dll
pcl_io_ply$${PCL_MINSIZEREL_SUFFIX}.dll
HINTS "${PCL_ROOT}/bin"
NO_DEFAULT_PATH)

find_file(PCL_${COMPONENT}_DLL_PATH_DEBUG
NAMES ${pcl_component}${PCL_DEBUG_SUFFIX}.dll
HINTS "${PCL_ROOT}/bin"
NO_DEFAULT_PATH)

endif()

Copy link

Copilot AI Feb 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The special-casing for the io component looks incorrect and currently breaks the DLL name patterns: pcl_io_ply$${PCL_RELEASE_SUFFIX}.dll includes an extra $ (will expand to a literal $ plus the suffix), and the debug search still uses ${pcl_component}${PCL_DEBUG_SUFFIX}.dll (i.e., pcl_io...) instead of pcl_io_ply.... Also, since io_ply is already inserted as its own component (and pcl_io depends on it), this io branch likely shouldn’t override PCL_IO_DLL_PATH at all.

Suggested change
if ("${component}" STREQUAL "io")
find_file(PCL_${COMPONENT}_DLL_PATH
NAMES
pcl_io_ply$${PCL_RELEASE_SUFFIX}.dll
pcl_io_ply$${PCL_RELWITHDEBINFO_SUFFIX}.dll
pcl_io_ply$${PCL_MINSIZEREL_SUFFIX}.dll
HINTS "${PCL_ROOT}/bin"
NO_DEFAULT_PATH)
find_file(PCL_${COMPONENT}_DLL_PATH_DEBUG
NAMES ${pcl_component}${PCL_DEBUG_SUFFIX}.dll
HINTS "${PCL_ROOT}/bin"
NO_DEFAULT_PATH)
endif()

Copilot uses AI. Check for mistakes.
Comment on lines +636 to +647
# find dll paths
find_file(PCL_${COMPONENT}_DLL_PATH
NAMES
${pcl_component}${PCL_RELEASE_SUFFIX}.dll
${pcl_component}${PCL_RELWITHDEBINFO_SUFFIX}.dll
${pcl_component}${PCL_MINSIZEREL_SUFFIX}.dll
HINTS "${PCL_ROOT}/bin"
NO_DEFAULT_PATH)
find_file(PCL_${COMPONENT}_DLL_PATH_DEBUG
NAMES ${pcl_component}${PCL_DEBUG_SUFFIX}.dll
HINTS "${PCL_ROOT}/bin"
NO_DEFAULT_PATH)
Copy link

Copilot AI Feb 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new find_file(PCL_${COMPONENT}_DLL_PATH[_DEBUG] ...) results are not marked advanced like the other find_* cache variables in this config. Consider adding mark_as_advanced(PCL_${COMPONENT}_DLL_PATH PCL_${COMPONENT}_DLL_PATH_DEBUG) to avoid cluttering the CMake cache/UI.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog: fix Meta-information for changelog generation module: cmake

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[build/cmake] Incorrect IMPORTED_LOCATION for Windows DLLs in PCL CMake config

1 participant