我在 Cmake 中相当新,我正在使用它与 Qt Creator 一起运行 SimpleITK,但我需要将我用 SimpleITK 编写的代码插入到另一个已经使用 qmake 运行的代码中。因此我必须转换它。这是cmakelist:
cmake_minimum_required(VERSION 3.10)
project(Registration_ITK_CMAKE)
set(ITK_DIR "/home/felippe/SimpleITK-build/ITK-prefix/lib/cmake/ITK/")
find_package(SimpleITK REQUIRED)
#set(CMAKE_PREFIX_PATH "/home/felippe/SimpleITK-build/ITK-prefix/")
add_executable(${PROJECT_NAME} "main.cpp")
target_link_libraries ( Registration_ITK_CMAKE ${SimpleITK_LIBRARIES} )
重要的是要说 SimpleITK 需要一些 ITK 库,所以我已经尝试包含 ITK 和 SimpleITK 的所有 .lib 文件,但我有大量的“未定义的引用 ...”返回由编译器。这是我的.pro:
TEMPLATE = app
CONFIG += console c++11 static
CONFIG -= app_bundle
CONFIG -= qt
INCLUDEPATH += /home/felippe/SimpleITK-build/include/SimpleITK-1.3
INCLUDEPATH += /home/felippe/SimpleITK-build/ITK-prefix/include/ITK-4.13
#SimpleITK LIB files
LIBS += "/home/felippe/SimpleITK-build/SimpleITK-build/lib/libgtest.a"
LIBS += "/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITKBasicFilters0-1.3.a"
LIBS += "/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITKCommon-1.3.a"
LIBS += "/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITKBasicFilters1-1.3.a"
LIBS += "/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITKExplicit-1.3.a"
LIBS += "/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITKIO-1.3.a"
LIBS += "/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_ITKAnisotropicSmoothing-1.3.a"
LIBS += "/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_ITKAntiAlias-1.3.a"
LIBS += "/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_ITKBiasCorrection-1.3.a"
LIBS += "/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_ITKBinaryMathematicalMorphology-1.3.a"
LIBS += "/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_ITKClassifiers-1.3.a"
LIBS += "/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_ITKColormap-1.3.a"
LIBS += "/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_ITKCommon-1.3.a"
LIBS += "/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_ITKConnectedComponents-1.3.a"
LIBS += "/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_ITKConvolution-1.3.a"
LIBS += "/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_ITKCurvatureFlow-1.3.a"
LIBS += "/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_ITKDeconvolution-1.3.a"
LIBS += "/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_ITKDenoising-1.3.a"
LIBS += "/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_ITKDisplacementField-1.3.a"
LIBS += "/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_ITKDistanceMap-1.3.a"
LIBS += "/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_ITKFastMarching-1.3.a"
LIBS += "/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_ITKFFT-1.3.a"
LIBS += "/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_ITKImageCompare-1.3.a"
LIBS += "/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_ITKImageCompose-1.3.a"
LIBS += "/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_ITKImageFeature-1.3.a"
LIBS += "/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_ITKImageFilterBase-1.3.a"
LIBS += "/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_ITKImageFunction-1.3.a"
LIBS += "/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_ITKImageFusion-1.3.a"
LIBS += "/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_ITKImageGradient-1.3.a"
LIBS += "/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_ITKImageGrid-1.3.a"
LIBS += "/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_ITKImageIntensity-1.3.a"
LIBS += "/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_ITKImageLabel-1.3.a"
LIBS += "/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_ITKImageNoise-1.3.a"
LIBS += "/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_ITKImageSources-1.3.a"
LIBS += "/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_ITKImageStatistics-1.3.a"
LIBS += "/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_ITKLabelMap-1.3.a"
LIBS += "/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_ITKLabelVoting-1.3.a"
LIBS += "/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_ITKLevelSets-1.3.a"
LIBS += "/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_ITKMathematicalMorphology-1.3.a"
LIBS += "/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_ITKPDEDeformableRegistration-1.3.a"
LIBS += "/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_ITKRegionGrowing-1.3.a"
LIBS += "/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_ITKRegistrationCommon-1.3.a"
LIBS += "/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_ITKReview-1.3.a"
LIBS += "/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_ITKSmoothing-1.3.a"
LIBS += "/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_ITKThresholding-1.3.a"
LIBS += "/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_ITKTransform-1.3.a"
LIBS += "/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_ITKWatersheds-1.3.a"
LIBS += "/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITKRegistration-1.3.a"
LIBS += "/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITK_SimpleITKFilters-1.3.a"
LIBS += "/home/felippe/SimpleITK-build/SimpleITK-build/lib/libSimpleITKUnitTestBase.a"
#ITK Lib Files
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKDICOMParser-4.13.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKEXPAT-4.13.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKFEM-4.13.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libitkgdcmcharls-4.13.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libitkgdcmDICT-4.13.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libitkgdcmDSED-4.13.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libitkgdcmjpeg8-4.13.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libitkgdcmjpeg12-4.13.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libitkgdcmjpeg16-4.13.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libitkgdcmMEXD-4.13.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libitkgdcmMSFF-4.13.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libitkgdcmopenjp2-4.13.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libitkgdcmsocketxx-4.13.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libitkgdcmuuid-4.13.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKgiftiio-4.13.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libitkhdf5.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libitkhdf5_cpp.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKIOBMP-4.13.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKIOBruker-4.13.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKIOCSV-4.13.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKIOGE-4.13.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKIOGIPL-4.13.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKIOHDF5-4.13.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKIOIPL-4.13.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKIOLSM-4.13.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKIOMesh-4.13.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKIOMeta-4.13.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKIOMRC-4.13.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKIONRRD-4.13.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKIOPNG-4.13.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKIOSiemens-4.13.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKIOStimulate-4.13.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKIOTIFF-4.13.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKIOTransformHDF5-4.13.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKIOTransformMatlab-4.13.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKIOJPEG-4.13.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKIOMINC-4.13.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libitkjpeg-4.13.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKLabelMap-4.13.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libitklbfgs-4.13.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libitkminc2-4.13.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libitknetlib-4.13.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libitkNetlibSlatec-4.13.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKniftiio-4.13.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKNrrdIO-4.13.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libitkopenjpeg-4.13.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKOptimizers-4.13.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKBioCell-4.13.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKOptimizersv4-4.13.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libitkpng-4.13.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKQuadEdgeMesh-4.13.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKStatistics-4.13.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libitktiff-4.13.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libitkv3p_netlib-4.13.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libitkvcl-4.13.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKVideoCore-4.13.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKVideoIO-4.13.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libitkvnl_algo-4.13.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKznz-4.13.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKBiasCorrection-4.13.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKWatersheds-4.13.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKIOTransformInsightLegacy-4.13.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libitkzlib-4.13.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKMesh-4.13.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKMetaIO-4.13.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKPolynomials-4.13.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKTransformFactory-4.13.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKIONIFTI-4.13.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKVTK-4.13.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKKLMRegionGrowing-4.13.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKIOTransformBase-4.13.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libitktestlib-4.13.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKReview-4.13.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKPath-4.13.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libitkdouble-conversion-4.13.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKTransform-4.13.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKSpatialObjects-4.13.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libitkgdcmCommon-4.13.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libitkvnl-4.13.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-build/lib/libITKVNLInstantiation-4.13.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKIOGDCM-4.13.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKCommon-4.13.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libitksys-4.13.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-build/lib/libITKIOImageBase-4.13.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libitkgdcmIOD-4.13.a"
LIBS += "/home/felippe/SimpleITK-build/ITK-prefix/lib/libITKIOXML-4.13.a"
LIBS += -lpthread
SOURCES += \
main.cpp
那么如何解决这个问题呢?
谢谢。