Skip to content

Use find_package and target_link_libraries to include system double conversion and properly include double-conversion #579

@Neumann-A

Description

@Neumann-A

Description

double-conversion exports configs and targets. Those should be used to correctly include/link against double-conversion.

Expected coding style

in ITK\Modules\Core\Common\src\itkNumberToString.cxx
#include "double-conversion/double-conversion.h"
(actually would expect #include <double-conversion/double-conversion.h> for system headers
but that is against ITK coding style)

In ITK\Modules\ThirdParty\DoubleConversion\CMakeLists.txt

if(ITK_USE_SYSTEM_DOUBLECONVERSION)
  find_package(double-conversion CONFIG REQUIRED)
else()

and a target_link_libraries call where the target which requires double-conversion is linked against target double-conversion::double-conversion (Properly in ITK\Modules\Core\Common\src\CMakeLists.txt @ line 138)

Actual coding style

in ITK\Modules\Core\Common\src\itkNumberToString.cxx
#include "double-conversion.h"

In ITK\Modules\ThirdParty\DoubleConversion\CMakeLists.txt

if(ITK_USE_SYSTEM_DOUBLECONVERSION)
  find_library(double-conversion_LIBRARIES double-conversion)
  find_path(double-conversion_INCLUDE_DIRS double-conversion.h
    PATH_SUFFIXES double-conversion
    )

  if (double-conversion_LIBRARIES AND double-conversion_INCLUDE_DIRS)
    set(ITKDoubleConversion_SYSTEM_INCLUDE_DIRS
      ${double-conversion_INCLUDE_DIRS})
    set(ITKDoubleConversion_LIBRARIES
      "${double-conversion_LIBRARIES}")
  else()
    message(ERROR "double-conversion system library not found")
  endif()
else()

Metadata

Metadata

Assignees

Labels

Good first issueA good issue for community members new to contributingarea:ThirdPartyIssues affecting the ThirdParty moduletype:StyleStyle changes: no logic impact (indentation, comments, naming)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions