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

Wrong ITKGoogleTest_LIBRARIES value in ITKGoogleTest.cmake #303

Open
yurivict opened this Issue Dec 13, 2018 · 12 comments

Comments

Projects
None yet
4 participants
@yurivict
Copy link

yurivict commented Dec 13, 2018

InsightToolkit-4.13.0 installs the file lib/cmake/ITK-4.13/Modules/ITKGoogleTest.cmake that contains this line:

set(ITKGoogleTest_LIBRARIES "GTest::GTest;GTest::Main")

The xx_LIBRARIES clause is expected to contain paths to the libraries, and can't contain "::".

Depending projects fail like this:

CMake Error at libsrc/CMakeLists.txt:46 (add_library):
  Target "dcmqi" links to target "GTest::GTest" but the target was not found.
  Perhaps a find_package() call is missing for an IMPORTED target, or an
  ALIAS target is missing?

FreeBSD 11.2 amd64
ITK installed from the port.
This also happened before 4.13.0.

@blowekamp

This comment has been minimized.

Copy link
Member

blowekamp commented Dec 13, 2018

The GTest::GTest is an namespace imported alias to the proper library. That line is correct. Now your error message says:

 Perhaps a find_package() call is missing for an IMPORTED target, or an
  ALIAS target is missing?

This seems like a correct lead... I don't believe the Google Test package has been found or imported.

Do you have a minimal CMake project to reproduce the issue against and installed ITK?

Addendum:
Looking at the source . Do you have ITK_USE_SYSTEM_GOOGLETEST enabled?

@yurivict

This comment has been minimized.

Copy link

yurivict commented Dec 13, 2018

The port doesn't set ITK_USE_SYSTEM_GOOGLETEST. I do have the system googletest installed. I guess, googletest should be made a run-time dependency after ITK_USE_SYSTEM_GOOGLETEST is set.

@yurivict

This comment has been minimized.

Copy link

yurivict commented Dec 13, 2018

I added -DITK_USE_SYSTEM_GOOGLETEST=ON and reinstalled ITK, and the problem is still there. googletest-1.8.1 is installed, but it doesn't install any cmake files. It installs /usr/local/bin/gtest-config.

Where do I go from here? Where is GTest namespace supposed to be defined?

@blowekamp

This comment has been minimized.

Copy link
Member

blowekamp commented Dec 13, 2018

You still have not described what you are trying to do or how to reproduce the problem.

The GoogleTest is a library for writing tests. ITK uses it in during compilation of tests. There are not runtime dependencies of ITK on GoogleTest. ITK does not install it's Third-party GoogleTest library into the system.

Perhaps the problem is that ITK should not install the ITKGoogleTest.cmake file.

@yurivict

This comment has been minimized.

Copy link

yurivict commented Dec 13, 2018

It triggers failures in the dependent projects. Currently I encountered the problem with the dcmqi project, https://github.com/QIICR/dcmqi. Before it was also the vv project, https://github.com/open-vv/vv.

I don't have a small example that reproduces it.

@yurivict

This comment has been minimized.

Copy link

yurivict commented Dec 13, 2018

So, ITK is instructed to use the system googletest. The system googletest is installed. Why do depending projects fail then? Why can't they find GTest::?

@blowekamp

This comment has been minimized.

Copy link
Member

blowekamp commented Dec 13, 2018

Its not clear to me what the bug is with ITK. Or how or why these projects are using or include GoogleTest. Perhaps @jcfr or @thewtex can help with the ITK integration on these projects...

@yurivict

This comment has been minimized.

Copy link

yurivict commented Dec 13, 2018

I think other projects include /usr/local/lib/cmake/ITK-4.13/ITKConfig.cmake, which has ITKGoogleTest in it. This is how ITKGoogleTest gets in.

/usr/local/lib/cmake/ITK-4.13/ITKConfig.cmake:63:set(ITK_MODULES_ENABLED "ITKDoubleConversion;ITKKWIML;ITKKWSys;ITKVNL;ITKVNLInstantiation;ITKCommon;ITKFiniteDifference;ITKImageFilterBase;ITKCurvatureFlow;ITKImageAdaptors;ITKNetlib;ITKStatistics;ITKTransform;ITKImageFunction;ITKImageGrid;ITKAnisotropicSmoothing;ITKLabelMap;ITKImageCompose;ITKMesh;ITKZLIB;ITKMetaIO;ITKSpatialObjects;ITKImageStatistics;ITKPath;ITKImageIntensity;ITKThresholding;ITKConnectedComponents;ITKMathematicalMorphology;ITKBinaryMathematicalMorphology;ITKImageLabel;ITKNarrowBand;ITKDistanceMap;ITKQuadEdgeMesh;ITKFastMarching;ITKIOImageBase;ITKImageCompare;ITKSmoothing;ITKImageGradient;ITKImageSources;ITKImageFeature;ITKOptimizers;ITKSignedDistanceFunction;ITKLevelSets;ITKAntiAlias;ITKPolynomials;ITKBiasCorrection;ITKBioCell;ITKClassifiers;ITKColormap;ITKFFT;ITKConvolution;ITKDICOMParser;ITKDeconvolution;ITKDeformableMesh;ITKDenoising;ITKGDCM;ITKIOGDCM;ITKNIFTI;ITKDisplacementField;ITKV3Compatibility;ITKDeprecated;ITKDiffusionTensorImage;ITKEigen;ITKExpat;ITKIOXML;ITKIOSpatialObjects;ITKRegistrationCommon;ITKFEM;ITKPDEDeformableRegistration;ITKFEMRegistration;ITKGIFTI;ITKGPUCommon;ITKGPUFiniteDifference;ITKGPUAnisotropicSmoothing;ITKGPUImageFilterBase;ITKGPURegistrationCommon;ITKGPUPDEDeformableRegistration;ITKGPUSmoothing;ITKGPUThresholding;ITKGoogleTest;ITKHDF5;ITKIOBMP;ITKIOBioRad;ITKIOBruker;ITKIOCSV;ITKIOIPL;ITKIOGE;ITKIOGIPL;ITKIOHDF5;ITKJPEG;ITKIOJPEG;ITKTIFF;ITKIOTIFF;ITKIOLSM;ITKMINC;ITKIOMINC;ITKIOMRC;ITKIOMesh;ITKIOMeta;ITKIONIFTI;ITKNrrdIO;ITKIONRRD;ITKPNG;ITKIOPNG;ITKIORAW;ITKIOSiemens;ITKIOStimulate;ITKTransformFactory;ITKIOTransformBase;ITKIOTransformHDF5;ITKIOTransformInsightLegacy;ITKIOTransformMatlab;ITKIOVTK;ITKImageFusion;ITKImageNoise;ITKIntegratedTest;ITKKLMRegionGrowing;ITKLIBLBFGS;ITKLabelVoting;ITKLevelSetsv4;ITKMarkovRandomFieldsClassifiers;ITKOptimizersv4;ITKMetricsv4;ITKNeuralNetworks;ITKQuadEdgeMeshFiltering;ITKRegionGrowing;ITKRegistrationMethodsv4;ITKSpatialFunction;ITKTestKernel;ITKVTK;ITKVideoCore;ITKVideoFiltering;ITKVideoIO;ITKVoronoi;ITKWatersheds"
@dzenanz

This comment has been minimized.

Copy link
Member

dzenanz commented Dec 13, 2018

When configuring ITK, there is a setting called INSTALL_GTEST. What is its current value in your installation, and what happens if you flip it?

@yurivict

This comment has been minimized.

Copy link

yurivict commented Dec 13, 2018

INSTALL_GTEST was off, I flipped it, but nothing changed.

@thewtex

This comment has been minimized.

Copy link
Member

thewtex commented Dec 16, 2018

@yurivict what is the version of CMake?

@yurivict

This comment has been minimized.

Copy link

yurivict commented Dec 16, 2018

cmake-3.12.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment