External_LIBRARIES links to both debug and release version when using system libraries
Hi all
Using vtk 8.2.0 through VCPKG gives difficulties as they compile with system libraries - see VCPKG issue.
I have located it to, that the linking is both expressed in the TARGET files, ie: export of VTKTargets debug version:
# Create imported target vtkRenderingFreeType
add_library(vtkRenderingFreeType SHARED IMPORTED)
set_target_properties(vtkRenderingFreeType PROPERTIES
INTERFACE_COMPILE_FEATURES "cxx_nullptr;cxx_override"
INTERFACE_LINK_LIBRARIES "vtkCommonCore;vtkCommonExecutionModel;vtkRenderingCore;vtkRenderingCore;**\$<\$<NOT:\$<CONFIG:DEBUG>>:E:/vcpkg/installed/x64-windows/lib/freetype.lib>;\$<\$<CONFIG:DEBUG>:E:/vcpkg/installed/x64-windows/debug/lib/freetyped.lib>"**
)
but also in the cmake module files ie, for freetype:
set(vtkfreetype_LOADED 1)
set(vtkfreetype_DEPENDS "vtkkwiml;vtkzlib")
**set(vtkfreetype_LIBRARIES "optimized;E:/vcpkg/installed/x64-windows/lib/freetype.lib;debug;E:/vcpkg/installed/x64-windows/debug/lib/freetyped.lib")**
set(vtkfreetype_INCLUDE_DIRS "E:/vcpkg/buildtrees/vtk/x64-windows-dbg/ThirdParty/freetype;E:/vcpkg/buildtrees/vtk/src/v8.2.0-d1dd9405dd/ThirdParty/freetype;E:/vcpkg/installed/x64-windows/include")
set(vtkfreetype_LIBRARY_DIRS "")
set(vtkfreetype_RUNTIME_LIBRARY_DIRS "E:/vcpkg/buildtrees/vtk/x64-windows-dbg/bin")
set(vtkfreetype_WRAP_HIERARCHY_FILE "")
set(vtkfreetype_KIT "")
set(vtkfreetype_TARGETS_FILE "")
set(vtkfreetype_EXCLUDE_FROM_WRAPPING 1)
I have spent quite some time now, trying to figure out where I could preferable remove the THIRDPARTY_LIBRARIES lines, as this gives trouble, when its merged together with all the other "libraries".
I have seen a dublicate remove call somewhere, which probably ends up removing the optimzized/debug specifiers from the cmake modules LIBRARIES definitions, so only the first optimized lib is somewhat correctly set, rest get placed under debug, because they get removed in the dublicate removal call.
When finding VTK in a simple test downstream project, the VTK_LIBRARIES end up having these libraries (Replaced ; with newline)
vtkCommonColor
vtkCommonCore
vtksys
vtkCommonDataModel
vtkCommonMath
vtkCommonMisc
vtkCommonSystem
vtkCommonTransforms
vtkFiltersSources
vtkCommonComputationalGeometry
vtkCommonExecutionModel
vtkFiltersCore
vtkFiltersGeneral
vtkInteractionStyle
vtkFiltersExtraction
vtkFiltersStatistics
vtkImagingFourier
vtkImagingCore
vtkRenderingCore
vtkFiltersGeometry
vtkRenderingContextOpenGL2
vtkRenderingContext2D
vtkRenderingFreeType
optimized
E:/vcpkg/installed/x64-windows/share/vtk/../../lib/freetype.lib
debug
E:/vcpkg/installed/x64-windows/share/vtk/../../debug/lib/freetyped.lib
E:/vcpkg/installed/x64-windows/share/vtk/../../lib/zlib.lib
E:/vcpkg/installed/x64-windows/share/vtk/../../debug/lib/zlibd.lib
vtkRenderingOpenGL2
E:/vcpkg/installed/x64-windows/share/vtk/../../lib/glew32.lib
E:/vcpkg/installed/x64-windows/share/vtk/../../debug/lib/glew32d.lib
vtkRenderingGL2PSOpenGL2
vtkgl2ps
E:/vcpkg/installed/x64-windows/share/vtk/../../lib/libpng16.lib
E:/vcpkg/installed/x64-windows/share/vtk/../../debug/lib/libpng16d.lib
Can someone put me in the right direction to elimnate the dublicate linking entries. Since there probably won't be a 8.2.x I guess it would be a patch used by VCPKG.
ie. maybe add a loop that iterates through all lines loaded for each .cmake file, removing the line where both LIBRARIES
and \${VTK_INSTALL_PREFIX}
is present, ie
to here
regards, Lars