CMake configuration fails using find_package(PCL CONFIG COMPONENTS REQUIRED features) in _CMakeLists.txt_ . I first ran into this issue while trying to migrate code using PCL and Qt5 (which compiles fine) from MacOS to Windows 10. To make sure it wasn't something I had done wrong I then tried to build the qt_visualizer tutorial and received the same configuration failed issue.
CMake issue specifically:
CMake Error at C:/vcpkg/installed/x64-windows/share/pcl/PCLConfig.cmake:668 (set_target_properties):
Property INTERFACE_LINK_LIBRARIES may not contain link-type keyword
"optimized". The INTERFACE_LINK_LIBRARIES property may contain
configuration-sensitive generator-expressions which may be used to specify
per-configuration rules.
Call Stack (most recent call first):
C:/vcpkg/scripts/buildsystems/vcpkg.cmake:234 (_find_package)
CMakeLists.txt:24 (find_package)
All other components of PCL work fine through find_package.
I thought this was likely an issue with using vcpkg installation of PCL (which is still may be), however I then tried building PCL from source using the latest from Git and received the same error. I also tried installing through the _PCL-1.9.1-AllInOne-msvc2017-win64.exe_, which did compile pcl_features fine when using the included 3rd Party libraries. However, needing the PCL Qt5 libraries (QVTKWidget, etc...) which is didn't appear to be included, I tried to link to the vcpkg version of VTK 8.2 which returned the same issue.
My next step will be to try and link to VTK compiled from source but thought I would submit an issue in the meantime.
Can you add
message(STATUS "--------> ${PCL_${COMPONENT}_LINK_LIBRARIES}"
to the PCLConfig.cmake that was generated in your build directory? (Somewhere around the line 668 that raises error.)
(I've put an "<---" at the end of the status make it a bit more clear) Adding that at line 667 before set_target_properties(...) gives the following:
looking for PCL_COMMON
Found PCL_COMMON: C:/vcpkg/installed/x64-windows/lib/pcl_common_release.lib
--------> <---
looking for PCL_OCTREE
Found PCL_OCTREE: C:/vcpkg/installed/x64-windows/lib/pcl_octree_release.lib
--------> pcl_common <---
looking for PCL_IO
Found PCL_IO: C:/vcpkg/installed/x64-windows/lib/pcl_io_release.lib
--------> pcl_common;pcl_octree <---
looking for PCL_KDTREE
Found PCL_KDTREE: C:/vcpkg/installed/x64-windows/lib/pcl_kdtree_release.lib
--------> pcl_common <---
looking for PCL_GEOMETRY
Found PCL_GEOMETRY: C:/vcpkg/installed/x64-windows/include
looking for PCL_SEARCH
Found PCL_SEARCH: C:/vcpkg/installed/x64-windows/lib/pcl_search_release.lib
--------> pcl_common;pcl_kdtree;pcl_octree <---
looking for PCL_VISUALIZATION
Found PCL_VISUALIZATION: C:/vcpkg/installed/x64-windows/lib/pcl_visualization_release.lib
--------> pcl_common;pcl_io;pcl_kdtree;pcl_search;pcl_octree <---
looking for PCL_SAMPLE_CONSENSUS
Found PCL_SAMPLE_CONSENSUS: C:/vcpkg/installed/x64-windows/lib/pcl_sample_consensus_release.lib
--------> pcl_common;pcl_search <---
looking for PCL_FILTERS
Found PCL_FILTERS: C:/vcpkg/installed/x64-windows/lib/pcl_filters_release.lib
--------> pcl_common;pcl_sample_consensus;pcl_search;pcl_kdtree;pcl_octree <---
looking for PCL_2D
Found PCL_2D: C:/vcpkg/installed/x64-windows/include
looking for PCL_FEATURES
Found PCL_FEATURES: C:/vcpkg/installed/x64-windows/lib/pcl_features_release.lib
--------> pcl_common;pcl_search;pcl_kdtree;pcl_octree;pcl_filters;vtksys;vtkCommonCore;vtkCommonMath;vtkCommonMisc;vtkCommonSystem;vtkCommonTransforms;vtkCommonDataModel;vtkCommonColor;vtkCommonExecutionModel;vtkCommonComputationalGeometry;vtkFiltersCore;vtkFiltersGeneral;vtkImagingCore;vtkImagingFourier;vtkFiltersStatistics;vtkFiltersExtraction;vtkInfovisCore;vtkFiltersGeometry;vtkFiltersSources;vtkRenderingCore;optimized;C:/vcpkg/installed/x64-windows/share/vtk/../../lib/zlib.lib;debug;C:/vcpkg/installed/x64-windows/share/vtk/../../debug/lib/zlibd.lib;C:/vcpkg/installed/x64-windows/share/vtk/../../lib/freetype.lib;C:/vcpkg/installed/x64-windows/share/vtk/../../debug/lib/freetyped.lib;vtkRenderingFreeType;vtkRenderingContext2D;vtkChartsCore;vtkDICOMParser;vtkdoubleconversion;C:/vcpkg/installed/x64-windows/share/vtk/../../lib/lz4.lib;C:/vcpkg/installed/x64-windows/share/vtk/../../debug/lib/lz4d.lib;vtklzma;vtkIOCore;vtkIOLegacy;C:/vcpkg/installed/x64-windows/share/vtk/../../lib/expat.lib;vtkIOXMLParser;vtkDomainsChemistry;C:/vcpkg/installed/x64-windows/share/vtk/../../lib/glew32.lib;C:/vcpkg/installed/x64-windows/share/vtk/../../debug/lib/glew32d.lib;vtkRenderingOpenGL2;vtkDomainsChemistryOpenGL2;vtkIOXML;vtkParallelCore;vtkFiltersAMR;vtkFiltersFlowPaths;vtkFiltersGeneric;vtkImagingSources;vtkFiltersHybrid;vtkFiltersHyperTree;vtkImagingGeneral;vtkFiltersImaging;vtkFiltersModeling;vtkFiltersParallel;vtkFiltersParallelImaging;vtkFiltersPoints;vtkFiltersProgrammable;vtkFiltersSMP;vtkFiltersSelection;vtkFiltersTexture;vtkFiltersTopology;verdict;vtkFiltersVerdict;vtkGUISupportMFC;vtkInteractionStyle;vtkGUISupportQt;vtksqlite;vtkIOSQL;vtkGUISupportQtSQL;vtkmetaio;C:/vcpkg/installed/x64-windows/share/vtk/../../lib/jpeg.lib;C:/vcpkg/installed/x64-windows/share/vtk/../../debug/lib/jpegd.lib;C:/vcpkg/installed/x64-windows/share/vtk/../../lib/libpng16.lib;C:/vcpkg/installed/x64-windows/share/vtk/../../debug/lib/libpng16d.lib;C:/vcpkg/installed/x64-windows/share/vtk/../../lib/tiff.lib;C:/vcpkg/installed/x64-windows/share/vtk/../../debug/lib/tiffd.lib;C:/vcpkg/installed/x64-windows/share/vtk/../../lib/lzma.lib;vtkIOImage;vtkImagingHybrid;vtkInfovisLayout;vtkImagingColor;vtkRenderingAnnotation;vtkRenderingVolume;vtkInteractionWidgets;vtkViewsCore;C:/vcpkg/installed/x64-windows/share/vtk/../../lib/proj.lib;C:/vcpkg/installed/x64-windows/share/vtk/../../debug/lib/projd.lib;vtkGeovisCore;C:/vcpkg/installed/x64-windows/share/vtk/../../lib/hdf5.lib;C:/vcpkg/installed/x64-windows/share/vtk/../../debug/lib/hdf5_D.lib;C:/vcpkg/installed/x64-windows/share/vtk/../../lib/hdf5_hl.lib;C:/vcpkg/installed/x64-windows/share/vtk/../../debug/lib/hdf5_hl_D.lib;vtkIOAMR;vtkIOAsynchronous;vtkpugixml;vtkIOCityGML;vtkIOEnSight;vtknetcdf;vtkexodusII;vtkIOExodus;vtkgl2ps;vtkRenderingGL2PSOpenGL2;vtkIOExport;vtkIOExportOpenGL2;vtklibharu;vtkIOExportPDF;vtkIOGeometry;vtkIOImport;C:/vcpkg/installed/x64-windows/share/vtk/../../lib/libxml2.lib;vtkIOInfovis;vtkIOLSDyna;vtkIOMINC;C:/vcpkg/installed/x64-windows/share/vtk/../../lib/ogg.lib;C:/vcpkg/installed/x64-windows/share/vtk/../../lib/theoraenc.lib;C:/vcpkg/installed/x64-windows/share/vtk/../../lib/theoradec.lib;vtkIOMovie;vtkIONetCDF;vtkIOPLY;C:/vcpkg/installed/x64-windows/share/vtk/../../lib/jsoncpp.lib;vtkIOParallel;vtkIOParallelXML;vtkIOSegY;vtkIOTecplotTable;vtkIOVeraOut;vtkIOVideo;vtkImagingMath;vtkImagingMorphological;vtkImagingStatistics;vtkImagingStencil;vtkInteractionImage;vtkRenderingContextOpenGL2;vtkRenderingImage;vtkRenderingLOD;vtkRenderingLabel;vtkRenderingQt;vtkRenderingVolumeOpenGL2;vtkViewsContext2D;vtkViewsInfovis;vtkViewsGeovis;vtkViewsQt <---
So the issue is that zlib (which is depended upon by vtk) is exporting both debug and optimized libraries. I'm not a vcpkg/Windows user myself, so can not say why is that. @UnaNancyOwen any idea why vcpkg builds and exports both? Shouldn't it build only single config (as requested by user)?
@taketwo I think so too. However, it seems to be policy of vcpkg.
I think that @ras0219-msft @Rastaban can answer that question. They are members of vcpkg team.
I'm having the exact same issue:
Environment:
Found PCL_COMMON: C:/apps/vcpkg/installed/x64-windows/lib/pcl_common_release.lib
--------> <-------
looking for PCL_KDTREE
Found PCL_KDTREE: C:/apps/vcpkg/installed/x64-windows/lib/pcl_kdtree_release.lib
--------> pcl_common <-------
looking for PCL_OCTREE
Found PCL_OCTREE: C:/apps/vcpkg/installed/x64-windows/lib/pcl_octree_release.lib
--------> pcl_common <-------
looking for PCL_SEARCH
Found PCL_SEARCH: C:/apps/vcpkg/installed/x64-windows/lib/pcl_search_release.lib
--------> pcl_common;pcl_kdtree;pcl_octree <-------
looking for PCL_SAMPLE_CONSENSUS
Found PCL_SAMPLE_CONSENSUS: C:/apps/vcpkg/installed/x64-windows/lib/pcl_sample_consensus_release.lib
--------> pcl_common;pcl_search <-------
looking for PCL_FILTERS
Found PCL_FILTERS: C:/apps/vcpkg/installed/x64-windows/lib/pcl_filters_release.lib
--------> pcl_common;pcl_sample_consensus;pcl_search;pcl_kdtree;pcl_octree <-------
looking for PCL_2D
Found PCL_2D: C:/apps/vcpkg/installed/x64-windows/include
looking for PCL_GEOMETRY
Found PCL_GEOMETRY: C:/apps/vcpkg/installed/x64-windows/include
looking for PCL_IO
Found PCL_IO: C:/apps/vcpkg/installed/x64-windows/lib/pcl_io_release.lib
--------> pcl_common;pcl_octree <-------
looking for PCL_FEATURES
Found PCL_FEATURES: C:/apps/vcpkg/installed/x64-windows/lib/pcl_features_release.lib
--------> pcl_common;pcl_search;pcl_kdtree;pcl_octree;pcl_filters;vtksys;vtkCommonCore;vtkCommonMath;vtkCommonMisc;vtkCommonSystem;vtkCommonTransforms;vtkCommonDataModel;vtkCommonColor;vtkCommonExecutionModel;vtkCommonComputationalGeometry;vtkFiltersCore;vtkFiltersGeneral;vtkImagingCore;vtkImagingFourier;vtkFiltersStatistics;vtkFiltersExtraction;vtkInfovisCore;vtkFiltersGeometry;vtkFiltersSources;vtkRenderingCore;optimized;C:/apps/vcpkg/installed/x64-windows/share/vtk/../../lib/zlib.lib;debug;C:/apps/vcpkg/installed/x64-windows/share/vtk/../../debug/lib/zlibd.lib;C:/apps/vcpkg/installed/x64-windows/share/vtk/../../lib/freetype.lib;C:/apps/vcpkg/installed/x64-windows/share/vtk/../../debug/lib/freetyped.lib;vtkRenderingFreeType;vtkRenderingContext2D;vtkChartsCore;vtkDICOMParser;C:/apps/vcpkg/installed/x64-windows/share/vtk/../../lib/double-conversion.lib;C:/apps/vcpkg/installed/x64-windows/share/vtk/../../lib/lz4.lib;C:/apps/vcpkg/installed/x64-windows/share/vtk/../../debug/lib/lz4d.lib;C:/apps/vcpkg/installed/x64-windows/share/vtk/../../lib/lzma.lib;vtkIOCore;vtkIOLegacy;C:/apps/vcpkg/installed/x64-windows/share/vtk/../../lib/expat.lib;vtkIOXMLParser;vtkDomainsChemistry;C:/apps/vcpkg/installed/x64-windows/share/vtk/../../lib/glew32.lib;C:/apps/vcpkg/installed/x64-windows/share/vtk/../../debug/lib/glew32d.lib;vtkRenderingOpenGL2;vtkDomainsChemistryOpenGL2;vtkIOXML;vtkParallelCore;vtkFiltersAMR;vtkFiltersFlowPaths;vtkFiltersGeneric;vtkImagingSources;vtkFiltersHybrid;vtkFiltersHyperTree;vtkImagingGeneral;vtkFiltersImaging;vtkFiltersModeling;vtkFiltersParallel;vtkFiltersParallelImaging;vtkFiltersPoints;vtkFiltersProgrammable;vtkFiltersSMP;vtkFiltersSelection;vtkFiltersTexture;vtkFiltersTopology;verdict;vtkFiltersVerdict;vtkGUISupportMFC;vtkmetaio;C:/apps/vcpkg/installed/x64-windows/share/vtk/../../lib/jpeg.lib;C:/apps/vcpkg/installed/x64-windows/share/vtk/../../debug/lib/jpegd.lib;C:/apps/vcpkg/installed/x64-windows/share/vtk/../../lib/libpng16.lib;C:/apps/vcpkg/installed/x64-windows/share/vtk/../../debug/lib/libpng16d.lib;C:/apps/vcpkg/installed/x64-windows/share/vtk/../../lib/tiff.lib;C:/apps/vcpkg/installed/x64-windows/share/vtk/../../debug/lib/tiffd.lib;vtkIOImage;vtkImagingHybrid;vtkInfovisLayout;vtkInteractionStyle;vtkImagingColor;vtkRenderingAnnotation;vtkRenderingVolume;vtkInteractionWidgets;vtkViewsCore;C:/apps/vcpkg/installed/x64-windows/share/vtk/../../lib/proj.lib;C:/apps/vcpkg/installed/x64-windows/share/vtk/../../debug/lib/projd.lib;vtkGeovisCore;C:/apps/vcpkg/installed/x64-windows/share/vtk/../../lib/hdf5.lib;C:/apps/vcpkg/installed/x64-windows/share/vtk/../../debug/lib/hdf5_D.lib;C:/apps/vcpkg/installed/x64-windows/share/vtk/../../lib/hdf5_hl.lib;C:/apps/vcpkg/installed/x64-windows/share/vtk/../../debug/lib/hdf5_hl_D.lib;vtkIOAMR;vtkIOAsynchronous;vtkIOCityGML;vtkIOEnSight;C:/apps/vcpkg/installed/x64-windows/share/vtk/../../lib/netcdf.lib;vtkexodusII;vtkIOExodus;vtkgl2ps;vtkRenderingGL2PSOpenGL2;vtkIOExport;vtkIOExportOpenGL2;C:/apps/vcpkg/installed/x64-windows/share/vtk/../../lib/libhpdf.lib;C:/apps/vcpkg/installed/x64-windows/share/vtk/../../debug/lib/libhpdfd.lib;vtkIOExportPDF;vtkIOGeometry;vtkIOImport;C:/apps/vcpkg/installed/x64-windows/share/vtk/../../lib/libxml2.lib;vtkIOInfovis;vtkIOLSDyna;vtkIOMINC;C:/apps/vcpkg/installed/x64-windows/share/vtk/../../lib/ogg.lib;C:/apps/vcpkg/installed/x64-windows/share/vtk/../../lib/theoraenc.lib;C:/apps/vcpkg/installed/x64-windows/share/vtk/../../lib/theoradec.lib;vtkIOMovie;vtkIONetCDF;vtkIOPLY;C:/apps/vcpkg/installed/x64-windows/share/vtk/../../lib/jsoncpp.lib;vtkIOParallel;vtkIOParallelXML;C:/apps/vcpkg/installed/x64-windows/share/vtk/../../lib/sqlite3.lib;vtkIOSQL;vtkIOSegY;vtkIOTecplotTable;vtkIOVeraOut;vtkIOVideo;vtkImagingMath;vtkImagingMorphological;vtkImagingStatistics;vtkImagingStencil;vtkInteractionImage;vtkRenderingContextOpenGL2;vtkRenderingImage;vtkRenderingLOD;vtkRenderingLabel;vtkRenderingVolumeOpenGL2;vtkViewsContext2D;vtkViewsInfovis;vtkViewsGeovis <-------
Same issue here. Any solution ?
I temporarily installed the available binary version and used this inside my CMakeLists.txt
set(PCL_DIR "path/to/PCL")
find_package(PCL CONFIG REQUIRED)
target_link_libraries(MyProject pcl_<component1> pcl_<component2> ...)
where component1 and component2 are any of PCL components (common, octree, io, etc).
Check PCLconfig.cmake for a list of all components.
I would have preferred to use it through vcpkg still.
I find that the same error happens even when building pcl from source but not via vcpkg.
It looks like that the value of PCL_FEATURES_LINK_LIBRARIES is not correct.
So, finally I walk around the problem by commenting out the following line in PCLConfig.cmake:
`
`
Same issue here. Any solution ?
Same issue here as well.
Using @qpoisson workaround fixed the problem for me.
I just updated vcpkg as I was using old portfiles and this problem just popped out of the blue.
It wasn't present before.
By my understanding, VTK is carrying wrong information of zlib and in particular the link-type keywords like optimized or debug. As a consequence, this is either a VTK problem or how pcl get the information from it (I'm just formulating idea here, I did not have time to trace back the error). Am I wrong? Any suggestion to where I could have a look to fix this?
any idea why vcpkg builds and exports both?
Do you mean why are there both release and debug? vcpkg build and install both types and everything should be consistent and properly handled. Something changed because this problem wasn't present in earlier version of the portfiles (either vtk or pcl ones).
Shouldn't it build only single config (as requested by user)?
If you refer between debug or release the answer is no. It build and install both 馃槃
Edit PS: I have some projects that use zlib from vcpkg without problems getting debug/release when they are built in debug/release.
Just ran into the same problem, and it triggered for me with a simple find_package(PCL REQUIRED) in the downstream. @claudiofantacci were you able to figure out what has to change in the pcl porfile to get --head installation work? I am trying to figure out whether this problem is fixed in the latest master. Also, do you have any idea which commit in vcpkg breaks it?
Hey @jasjuang, to be honest, I don't remember whether the problem disappeared with the very last vcpkg upgrade and rebuild I made on my workstation or I work around the issue with @qpoisson suggestion. I'll have a look tomorrow 馃憤 (ping me otherwise! 馃槃).
I'll have a look tomorrow +1 (ping me otherwise! smile).
Is the offer for the ping still valid? :D
Unfortunately I don't have Windows anymore 馃槶 Sorry about that!
Most helpful comment
Unfortunately I don't have Windows anymore 馃槶 Sorry about that!