Repository: RTKConsortium/RTK (language: python)

Issue:
ITKs CMP0120 policy breaks RTK compatibility
Hi,

I was building ITK from master branch with RTK and CUDA.
I used VS 2019 (v16.8.7) and CMake v3.20.3 with Python v3.8.5 and CUDA Toolkit v10.2 under Windows 10.
This fails due to the following reasons:
```
75>------ Build started: Project: RTKPython, Configuration: Release x64 ------
75>itkRTK-5.3.lib(cuda_compile_1_generated_rtkCudaWeidingerForwardModelImageFilter.cu.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in RTKPython.obj
75>itkRTK-5.3.lib(cuda_compile_1_generated_rtkCudaForwardProjectionImageFilter.cu.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in RTKPython.obj
75>itkRTK-5.3.lib(cuda_compile_1_generated_rtkCudaBackProjectionImageFilter.cu.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in RTKPython.obj
75>itkRTK-5.3.lib(cuda_compile_1_generated_rtkCudaConjugateGradientImageFilter.cu.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in RTKPython.obj
75>itkRTK-5.3.lib(cuda_compile_1_generated_rtkCudaUtilities.cu.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in RTKPython.obj
75>itkRTK-5.3.lib(cuda_compile_1_generated_rtkCudaRayCastBackProjectionImageFilter.cu.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in RTKPython.obj
75>itkRTK-5.3.lib(cuda_compile_1_generated_rtkCudaConstantVolumeSource.cu.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in RTKPython.obj
75>itkRTK-5.3.lib(cuda_compile_1_generated_rtkCudaDisplacedDetectorImageFilter.cu.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in RTKPython.obj
75>itkRTK-5.3.lib(cuda_compile_1_generated_rtkCudaFFTProjectionsConvolutionImageFilter.cu.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in RTKPython.obj
75>itkRTK-5.3.lib(cuda_compile_1_generated_rtkCudaSplatImageFilter.cu.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in RTKPython.obj
75>itkRTK-5.3.lib(cuda_compile_1_generated_rtkCudaInterpolateImageFilter.cu.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in RTKPython.obj
75>itkRTK-5.3.lib(cuda_compile_1_generated_rtkCudaConstantVolumeSeriesSource.cu.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in RTKPython.obj
75>itkRTK-5.3.lib(cuda_compile_1_generated_rtkCudaWarpForwardProjectionImageFilter.cu.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in RTKPython.obj
75>itkRTK-5.3.lib(cuda_compile_1_generated_rtkCudaWarpBackProjectionImageFilter.cu.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in RTKPython.obj
75>itkRTK-5.3.lib(cuda_compile_1_generated_rtkCudaCyclicDeformationImageFilter.cu.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in RTKPython.obj
75>itkRTK-5.3.lib(cuda_compile_1_generated_rtkCudaFDKWeightProjectionFilter.cu.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in RTKPython.obj
75>itkRTK-5.3.lib(cuda_compile_1_generated_rtkCudaCropImageFilter.cu.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in RTKPython.obj
75>itkRTK-5.3.lib(cuda_compile_1_generated_rtkCudaFDKBackProjectionImageFilter.cu.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in RTKPython.obj
75>msvcprt.lib(MSVCP140.dll) : error LNK2005: "protected: __cdecl std::basic_streambuf<char,struct std::char_traits<char> >::basic_streambuf<char,struct std::char_traits<char> >(void)" (??0?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEAA@XZ) already defined in itkRTK-5.3.lib(cuda_compile_1_generated_rtkCudaWeidingerForwardModelImageFilter.cu.obj)
75>msvcprt.lib(MSVCP140.dll) : error LNK2005: "public: virtual __cdecl std::basic_streambuf<char,struct std::char_traits<char> >::~basic_streambuf<char,struct std::char_traits<char> >(void)" (??1?$basic_streambuf@DU?$char_traits@D@std@@@std@@UEAA@XZ) already defined in itkRTK-5.3.lib(cuda_compile_1_generated_rtkCudaWeidingerForwardModelImageFilter.cu.obj)
75>msvcprt.lib(MSVCP140.dll) : error LNK2005: "public: int __cdecl std::basic_streambuf<char,struct std::char_traits<char> >::sputc(char)" (?sputc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAAHD@Z) already defined in itkRTK-5.3.lib(cuda_compile_1_generated_rtkCudaWeidingerForwardModelImageFilter.cu.obj)
75>msvcprt.lib(MSVCP140.dll) : error LNK2005: "public: __int64 __cdecl std::basic_streambuf<char,struct std::char_traits<char> >::sputn(char const *,__int64)" (?sputn@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAA_JPEBD_J@Z) already defined in itkRTK-5.3.lib(cuda_compile_1_generated_rtkCudaWeidingerForwardModelImageFilter.cu.obj)
75>msvcprt.lib(MSVCP140.dll) : error LNK2005: "protected: char * __cdecl std::basic_streambuf<char,struct std::char_traits<char> >::_Pninc(void)" (?_Pninc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEAAPEADXZ) already defined in itkRTK-5.3.lib(cuda_compile_1_generated_rtkCudaWeidingerForwardModelImageFilter.cu.obj)
75>msvcprt.lib(MSVCP140.dll) : error LNK2005: "public: virtual __cdecl std::basic_ios<char,struct std::char_traits<char> >::~basic_ios<char,struct std::char_traits<char> >(void)" (??1?$basic_ios@DU?$char_traits@D@std@@@std@@UEAA@XZ) already defined in itkRTK-5.3.lib(cuda_compile_1_generated_rtkCudaWeidingerForwardModelImageFilter.cu.obj)
75>msvcprt.lib(MSVCP140.dll) : error LNK2005: "public: void __cdecl std::basic_ios<char,struct std::char_traits<char> >::setstate(int,bool)" (?setstate@?$basic_ios@DU?$char_traits@D@std@@@std@@QEAAXH_N@Z) already defined in itkRTK-5.3.lib(cuda_compile_1_generated_rtkCudaWeidingerForwardModelImageFilter.cu.obj)
75>msvcprt.lib(MSVCP140.dll) : error LNK2005: "protected: __cdecl std::basic_ios<char,struct std::char_traits<char> >::basic_ios<char,struct std::char_traits<char> >(void)" (??0?$basic_ios@DU?$char_traits@D@std@@@std@@IEAA@XZ) already defined in itkRTK-5.3.lib(cuda_compile_1_generated_rtkCudaWeidingerForwardModelImageFilter.cu.obj)
75>msvcprt.lib(MSVCP140.dll) : error LNK2005: "public: __cdecl std::basic_ostream<char,struct std::char_traits<char> >::basic_ostream<char,struct std::char_traits<char> >(class std::basic_streambuf<char,struct std::char_traits<char> > *,bool)" (??0?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAA@PEAV?$basic_streambuf@DU?$char_traits@D@std@@@1@_N@Z) already defined in itkRTK-5.3.lib(cuda_compile_1_generated_rtkCudaWeidingerForwardModelImageFilter.cu.obj)
75>msvcprt.lib(MSVCP140.dll) : error LNK2005: "public: virtual __cdecl std::basic_ostream<char,struct std::char_traits<char> >::~basic_ostream<char,struct std::char_traits<char> >(void)" (??1?$basic_ostream@DU?$char_traits@D@std@@@std@@UEAA@XZ) already defined in itkRTK-5.3.lib(cuda_compile_1_generated_rtkCudaWeidingerForwardModelImageFilter.cu.obj)
75>msvcprt.lib(MSVCP140.dll) : error LNK2005: "public: void __cdecl std::basic_ostream<char,struct std::char_traits<char> >::_Osfx(void)" (?_Osfx@?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAXXZ) already defined in itkRTK-5.3.lib(cuda_compile_1_generated_rtkCudaWeidingerForwardModelImageFilter.cu.obj)
75>msvcprt.lib(MSVCP140.dll) : error LNK2005: "public: class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl std::basic_ostream<char,struct std::char_traits<char> >::operator<<(int)" (??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@H@Z) already defined in itkRTK-5.3.lib(cuda_compile_1_generated_rtkCudaFFTProjectionsConvolutionImageFilter.cu.obj)
75>msvcprt.lib(MSVCP140.dll) : error LNK2005: "public: class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl std::basic_ostream<char,struct std::char_traits<char> >::flush(void)" (?flush@?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@XZ) already defined in itkRTK-5.3.lib(cuda_compile_1_generated_rtkCudaWeidingerForwardModelImageFilter.cu.obj)
75>msvcprt.lib(MSVCP140.dll) : error LNK2005: "public: class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl std::basic_ostream<char,struct std::char_traits<char> >::operator<<(unsigned int)" (??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@I@Z) already defined in itkRTK-5.3.lib(cuda_compile_1_generated_rtkCudaWeidingerForwardModelImageFilter.cu.obj)
75>msvcprt.lib(MSVCP140.dll) : error LNK2005: "public: struct _Cvtvec __cdecl std::_Locinfo::_Getcvt(void)const " (?_Getcvt@_Locinfo@std@@QEBA?AU_Cvtvec@@XZ) already defined in itkRTK-5.3.lib(cuda_compile_1_generated_rtkCudaWeidingerForwardModelImageFilter.cu.obj)
75>msvcprt.lib(MSVCP140.dll) : error LNK2005: "public: char __cdecl std::basic_ios<char,struct std::char_traits<char> >::widen(char)const " (?widen@?$basic_ios@DU?$char_traits@D@std@@@std@@QEBADD@Z) already defined in itkRTK-5.3.lib(cuda_compile_1_generated_rtkCudaWeidingerForwardModelImageFilter.cu.obj)
75>msvcprt.lib(MSVCP140.dll) : error LNK2005: "public: class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl std::basic_ostream<char,struct std::char_traits<char> >::operator<<(class std::basic_ostream<char,struct std::char_traits<char> > & (__cdecl*)(class std::basic_ostream<char,struct std::char_traits<char> > &))" (??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@P6AAEAV01@AEAV01@@Z@Z) already defined in itkRTK-5.3.lib(cuda_compile_1_generated_rtkCudaWeidingerForwardModelImageFilter.cu.obj)
75>msvcprt.lib(MSVCP140.dll) : error LNK2005: "public: class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl std::basic_ostream<char,struct std::char_traits<char> >::put(char)" (?put@?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@D@Z) already defined in itkRTK-5.3.lib(cuda_compile_1_generated_rtkCudaWeidingerForwardModelImageFilter.cu.obj)
75>msvcprt.lib(MSVCP140.dll) : error LNK2005: "public: __cdecl std::locale::id::operator unsigned __int64(void)" (??Bid@locale@std@@QEAA_KXZ) already defined in itkRTK-5.3.lib(cuda_compile_1_generated_rtkCudaWeidingerForwardModelImageFilter.cu.obj)
75>msvcprt.lib(MSVCP140.dll) : error LNK2005: "protected: void __cdecl std::basic_streambuf<char,struct std::char_traits<char> >::_Init(void)" (?_Init@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEAAXXZ) already defined in itkRTK-5.3.lib(cuda_compile_1_generated_rtkCudaWeidingerForwardModelImageFilter.cu.obj)
75>msvcprt.lib(MSVCP140.dll) : error LNK2005: "protected: virtual __int64 __cdecl std::basic_streambuf<char,struct std::char_traits<char> >::xsgetn(char *,__int64)" (?xsgetn@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MEAA_JPEAD_J@Z) already defined in itkRTK-5.3.lib(cuda_compile_1_generated_rtkCudaWeidingerForwardModelImageFilter.cu.obj)
75>msvcprt.lib(MSVCP140.dll) : error LNK2005: "protected: virtual __int64 __cdecl std::basic_streambuf<char,struct std::char_traits<char> >::xsputn(char const *,__int64)" (?xsputn@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MEAA_JPEBD_J@Z) already defined in itkRTK-5.3.lib(cuda_compile_1_generated_rtkCudaWeidingerForwardModelImageFilter.cu.obj)
75>msvcprt.lib(MSVCP140.dll) : error LNK2005: "public: void __cdecl std::basic_ios<char,struct std::char_traits<char> >::clear(int,bool)" (?clear@?$basic_ios@DU?$char_traits@D@std@@@std@@QEAAXH_N@Z) already defined in itkRTK-5.3.lib(cuda_compile_1_generated_rtkCudaWeidingerForwardModelImageFilter.cu.obj)
75>msvcprt.lib(MSVCP140.dll) : error LNK2005: "public: static unsigned __int64 __cdecl std::ctype<char>::_Getcat(class std::locale::facet const * *,class std::locale const *)" (?_Getcat@?$ctype@D@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z) already defined in itkRTK-5.3.lib(cuda_compile_1_generated_rtkCudaWeidingerForwardModelImageFilter.cu.obj)
75>msvcprt.lib(MSVCP140.dll) : error LNK2005: "public: class std::locale __cdecl std::ios_base::getloc(void)const " (?getloc@ios_base@std@@QEBA?AVlocale@2@XZ) already defined in itkRTK-5.3.lib(cuda_compile_1_generated_rtkCudaWeidingerForwardModelImageFilter.cu.obj)
75>msvcprt.lib(MSVCP140.dll) : error LNK2005: "public: char __cdecl std::ctype<char>::widen(char)const " (?widen@?$ctype@D@std@@QEBADD@Z) already defined in itkRTK-5.3.lib(cuda_compile_1_generated_rtkCudaWeidingerForwardModelImageFilter.cu.obj)
75>msvcprt.lib(MSVCP140.dll) : error LNK2005: "protected: char * __cdecl std::basic_streambuf<char,struct std::char_traits<char> >::eback(void)const " (?eback@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEBAPEADXZ) already defined in itkRTK-5.3.lib(cuda_compile_1_generated_rtkCudaWeidingerForwardModelImageFilter.cu.obj)
75>msvcprt.lib(MSVCP140.dll) : error LNK2005: "protected: char * __cdecl std::basic_streambuf<char,struct std::char_traits<char> >::gptr(void)const " (?gptr@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEBAPEADXZ) already defined in itkRTK-5.3.lib(cuda_compile_1_generated_rtkCudaWeidingerForwardModelImageFilter.cu.obj)
75>msvcprt.lib(MSVCP140.dll) : error LNK2005: "protected: char * __cdecl std::basic_streambuf<char,struct std::char_traits<char> >::pbase(void)const " (?pbase@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEBAPEADXZ) already defined in itkRTK-5.3.lib(cuda_compile_1_generated_rtkCudaWeidingerForwardModelImageFilter.cu.obj)
75>msvcprt.lib(MSVCP140.dll) : error LNK2005: "protected: char * __cdecl std::basic_streambuf<char,struct std::char_traits<char> >::pptr(void)const " (?pptr@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEBAPEADXZ) already defined in itkRTK-5.3.lib(cuda_compile_1_generated_rtkCudaWeidingerForwardModelImageFilter.cu.obj)
75>msvcprt.lib(MSVCP140.dll) : error LNK2005: "protected: char * __cdecl std::basic_streambuf<char,struct std::char_traits<char> >::egptr(void)const " (?egptr@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEBAPEADXZ) already defined in itkRTK-5.3.lib(cuda_compile_1_generated_rtkCudaWeidingerForwardModelImageFilter.cu.obj)
75>msvcprt.lib(MSVCP140.dll) : error LNK2005: "public: int __cdecl std::ios_base::rdstate(void)const " (?rdstate@ios_base@std@@QEBAHXZ) already defined in itkRTK-5.3.lib(cuda_compile_1_generated_rtkCudaWeidingerForwardModelImageFilter.cu.obj)
75>libcpmt.lib(locale0.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in RTKPython.obj
75>libcpmt.lib(locale0.obj) : error LNK2005: "void __cdecl std::_Facet_Register(class std::_Facet_base *)" (?_Facet_Register@std@@YAXPEAV_Facet_base@1@@Z) already defined in msvcprt.lib(locale0_implib.obj)
75>libcpmt.lib(locale0.obj) : error LNK2005: "private: static class std::locale::_Locimp * __cdecl std::locale::_Getgloballocale(void)" (?_Getgloballocale@locale@std@@CAPEAV_Locimp@12@XZ) already defined in msvcprt.lib(MSVCP140.dll)
75>libcpmt.lib(locale0.obj) : error LNK2005: "private: static class std::locale::_Locimp * __cdecl std::locale::_Init(bool)" (?_Init@locale@std@@CAPEAV_Locimp@12@_N@Z) already defined in msvcprt.lib(MSVCP140.dll)
75>libcpmt.lib(locale0.obj) : error LNK2005: "public: static void __cdecl std::_Locinfo::_Locinfo_ctor(class std::_Locinfo *,char const *)" (?_Locinfo_ctor@_Locinfo@std@@SAXPEAV12@PEBD@Z) already defined in msvcprt.lib(MSVCP140.dll)
75>libcpmt.lib(locale0.obj) : error LNK2005: "public: static void __cdecl std::_Locinfo::_Locinfo_dtor(class std::_Locinfo *)" (?_Locinfo_dtor@_Locinfo@std@@SAXPEAV12@@Z) already defined in msvcprt.lib(MSVCP140.dll)
75>libcpmt.lib(locale0.obj) : error LNK2005: "public: static class std::locale const & __cdecl std::locale::classic(void)" (?classic@locale@std@@SAAEBV12@XZ) already defined in msvcprt.lib(MSVCP140.dll)
75>libcpmt.lib(locale.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in RTKPython.obj
75>libcpmt.lib(locale.obj) : error LNK2005: "public: static unsigned __int64 __cdecl std::codecvt<char,char,struct _Mbstatet>::_Getcat(class std::locale::facet const * *,class std::locale const *)" (?_Getcat@?$codecvt@DDU_Mbstatet@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z) already defined in msvcprt.lib(MSVCP140.dll)
75>libcpmt.lib(locale.obj) : error LNK2005: "public: static class std::locale __cdecl std::locale::global(class std::locale const &)" (?global@locale@std@@SA?AV12@AEBV12@@Z) already defined in msvcprt.lib(MSVCP140.dll)
75>libcpmt.lib(locale.obj) : error LNK2005: "public: int __cdecl std::basic_streambuf<char,struct std::char_traits<char> >::sbumpc(void)" (?sbumpc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAAHXZ) already defined in msvcprt.lib(MSVCP140.dll)
75>libcpmt.lib(locale.obj) : error LNK2005: "public: int __cdecl std::basic_streambuf<char,struct std::char_traits<char> >::sgetc(void)" (?sgetc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAAHXZ) already defined in msvcprt.lib(MSVCP140.dll)
75>libcpmt.lib(iosptrs.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in RTKPython.obj
75>libcpmt.lib(wlocale.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in RTKPython.obj
75>libcpmt.lib(wlocale.obj) : error LNK2005: "public: unsigned short const * __cdecl std::_Locinfo::_W_Getdays(void)const " (?_W_Getdays@_Locinfo@std@@QEBAPEBGXZ) already defined in msvcprt.lib(MSVCP140.dll)
75>libcpmt.lib(wlocale.obj) : error LNK2005: "public: unsigned short const * __cdecl std::_Locinfo::_W_Getmonths(void)const " (?_W_Getmonths@_Locinfo@std@@QEBAPEBGXZ) already defined in msvcprt.lib(MSVCP140.dll)
75>libcpmt.lib(xlocale.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in RTKPython.obj
75>libcpmt.lib(xlocale.obj) : error LNK2005: "public: unsigned short const * __cdecl std::_Locinfo::_W_Getdays(void)const " (?_W_Getdays@_Locinfo@std@@QEBAPEBGXZ) already defined in msvcprt.lib(MSVCP140.dll)
75>libcpmt.lib(xlocale.obj) : error LNK2005: "public: unsigned short const * __cdecl std::_Locinfo::_W_Getmonths(void)const " (?_W_Getmonths@_Locinfo@std@@QEBAPEBGXZ) already defined in msvcprt.lib(MSVCP140.dll)
75>libcpmt.lib(xlocale.obj) : error LNK2005: "public: int __cdecl std::basic_streambuf<char,struct std::char_traits<char> >::sbumpc(void)" (?sbumpc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAAHXZ) already defined in msvcprt.lib(MSVCP140.dll)
75>libcpmt.lib(xlocale.obj) : error LNK2005: "public: int __cdecl std::basic_streambuf<char,struct std::char_traits<char> >::sgetc(void)" (?sgetc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAAHXZ) already defined in msvcprt.lib(MSVCP140.dll)
75>libcpmt.lib(xstol.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in RTKPython.obj
75>libcpmt.lib(xstoul.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in RTKPython.obj
75>libcpmt.lib(xstoll.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in RTKPython.obj
75>libcpmt.lib(xstoull.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in RTKPython.obj
75>libcpmt.lib(xlock.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in RTKPython.obj
75>libcpmt.lib(xlock.obj) : error LNK2005: "public: __cdecl std::_Lockit::_Lockit(int)" (??0_Lockit@std@@QEAA@H@Z) already defined in msvcprt.lib(MSVCP140.dll)
75>libcpmt.lib(xlock.obj) : error LNK2005: "public: __cdecl std::_Lockit::~_Lockit(void)" (??1_Lockit@std@@QEAA@XZ) already defined in msvcprt.lib(MSVCP140.dll)
75>libcpmt.lib(xstrcoll.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in RTKPython.obj
75>libcpmt.lib(xdateord.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in RTKPython.obj
75>libcpmt.lib(xwctomb.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in RTKPython.obj
75>libcpmt.lib(xwctomb.obj) : error LNK2005: _Getcvt already defined in msvcprt.lib(MSVCP140.dll)
75>libcpmt.lib(xwcscoll.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in RTKPython.obj
75>libcpmt.lib(xwcsxfrm.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in RTKPython.obj
75>libcpmt.lib(xgetwctype.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in RTKPython.obj
75>libcpmt.lib(xtowlower.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in RTKPython.obj
75>libcpmt.lib(xtowupper.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in RTKPython.obj
75>libcpmt.lib(xstrxfrm.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in RTKPython.obj
75>libcpmt.lib(xmtx.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in RTKPython.obj
75>libcpmt.lib(StlCompareStringA.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in RTKPython.obj
75>libcpmt.lib(winapinls.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in RTKPython.obj
75>libcpmt.lib(StlCompareStringW.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in RTKPython.obj
75>libcpmt.lib(StlLCMapStringW.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in RTKPython.obj
75>libcpmt.lib(StlLCMapStringA.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in RTKPython.obj
75>libcpmt.lib(winapisupp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in RTKPython.obj
75>   Creating library C:/ITK/bin-withRTKandCUDA-vs/lib/Release/RTKPython.lib and object C:/ITK/bin-withRTKandCUDA-vs/lib/Release/RTKPython.exp
75>LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library
75>C:\ITK\bin-withRTKandCUDA-vs\Wrapping\Generators\Python\itk\_RTKPython.pyd : fatal error LNK1169: one or more multiply defined symbols found
75>Done building project "RTKPython.vcxproj" -- FAILED.
```

The CMake flags I used:
```
-G "Visual Studio 16 2019"
-A x64
-DBUILD_EXAMPLES=OFF
-DBUILD_SHARED_LIBS=OFF
-DBUILD_TESTING=OFF 
-DITK_LEGACY_SILENT=ON 
-DITK_USE_GPU=ON 
-DITK_WRAP_PYTHON=ON 
-DITK_WRAP_unsigned_long_long=ON 
-DITK_WRAP_signed_long_long=ON 
-DModule_RTK=ON 
-DModule_ITKCudaCommon=ON 
-DRTK_USE_CUDA=ON 
-DCUDA_HAVE_GPU=ON 
-DRTK_BUILD_APPLICATIONS=ON
```

I compared compiler flags and linker settings with older working releases but couldn't spot a difference.


Discussion / hints:
Thanks for reporting. It's not the wrapping only, it's also the applications I think, see e.g. [this build](https://my.cdash.org/viewBuildError.php?buildid=2019255). This happens since InsightSoftwareConsortium/ITK@ce2efb1b9. I did not manage to identify why but this is on my todo list... If you have time, can you try reverting this ITK commit to confirm that fixes the compilation? That would be helpful.
You are right, disabling the python wrapping leads to the same problems.
However, reverting the commit you mentioned seems to fix the situation, but this is obviously no long term solution.
Anything else I can check? I am afraid I am not understanding what this CMake policy affects.

I also noticed that the applications are no longer in `bin_dir\bin\Release` but in `bin_dir\Wrapping\Generators\Python\itk`.
Is this a side of effect of the problem at hand or another issue?
> You are right, disabling the python wrapping leads to the same problems.
> However, reverting the commit you mentioned seems to fix the situation, but this is obviously no long term solution.
> Anything else I can check? I am afraid I am not understanding what this CMake policy affects.

We agree it's not a solution. It's not clear to me what is the problem, maybe it's not even CMP0120. As I said, on my todo list...

> 
> I also noticed that the applications are no longer in `bin_dir\bin\Release` but in `bin_dir\Wrapping\Generators\Python\itk`.
> Is this a side of effect of the problem at hand or another issue?

I wasn't aware of this, probably because I compile applications and wrapping separtely. @LucasGandel is revisiting this kind of things, see #415. Maybe he knows what is the issue here.



Fix patch:
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3dfa01696..754cf3d43 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -91,14 +91,6 @@ if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
   endif()
 endif()
 
-#=========================================================
-# Allow for multiple CL.EXE to write to the same .PDB file
-if(RTK_USE_CUDA)
-  if(WIN32)
-    set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /FS")
-  endif()
-endif()
-
 include(cmake/rtkCompilerFlags.cmake)
 
 # --------------------------------------------------------
@@ -212,11 +204,7 @@ set(RTK_VERSION_PATCH ${RTK_VERSION_PATCH})
 # Whether the compiled version of RTK uses CUDA
 set(RTK_USE_CUDA ${RTK_USE_CUDA})
 
-if(${RTK_USE_CUDA})
-  list(APPEND CMAKE_MODULE_PATH ${RTK_MODULE_PATH_CONFIG})
-  # if we are using CUDA, make sure CUDA libraries are available
-  find_package(CUDA_wrap REQUIRED)
-  include_directories(${CUDA_INCLUDE_DIRS})
+if(RTK_USE_CUDA)
   set(RTK_CUDA_PROJECTIONS_SLAB_SIZE \"16\" CACHE STRING \"Number of projections processed simultaneously in CUDA forward and back projections\")
 endif()
 ")
@@ -230,9 +218,7 @@ set(RTK_VERSION_PATCH ${RTK_VERSION_PATCH})
 # Whether the compiled version of RTK uses CUDA
 set(RTK_USE_CUDA ${RTK_USE_CUDA})
 
-if(${RTK_USE_CUDA})
-  # if we are using CUDA, make sure CUDA libraries are available
-  find_package(CUDA_wrap REQUIRED)
+if(RTK_USE_CUDA)
   set(RTK_CUDA_PROJECTIONS_SLAB_SIZE \"16\" CACHE STRING \"Number of projections processed simultaneously in CUDA forward and back projections\")
 endif()
 ")
@@ -253,11 +239,9 @@ endif()
 
 # Install configuration file
 install(FILES ${RTK_BINARY_DIR}/rtkConfiguration.h DESTINATION ${RTK_INSTALL_INCLUDE_DIR})
-install(FILES ${RTK_SOURCE_DIR}/cmake/FindCUDA_wrap.cmake
-              ${RTK_SOURCE_DIR}/cmake/FindGengetopt.cmake
+install(FILES ${RTK_SOURCE_DIR}/cmake/FindGengetopt.cmake
               ${RTK_SOURCE_DIR}/cmake/GetGitRevisionDescription.cmake
               ${RTK_SOURCE_DIR}/cmake/GetGitRevisionDescription.cmake.in
-              ${RTK_SOURCE_DIR}/cmake/has_cuda_gpu.cxx
         DESTINATION ${ITK_INSTALL_PACKAGE_DIR})
 if(NOT ITK_SOURCE_DIR)
   install(CODE "MESSAGE(FATAL_ERROR \"Cannot install, RTK is compiled separately from ITK. Installation is only functional if RTK is compiled within ITK.\")")
diff --git a/applications/CMakeLists.txt b/applications/CMakeLists.txt
index dd1e0932d..1e1e5e5af 100644
--- a/applications/CMakeLists.txt
+++ b/applications/CMakeLists.txt
@@ -116,7 +116,7 @@ if(BUILD_TESTING)
   set_tests_properties(rtkappprojectshepploganphantomtest PROPERTIES DEPENDS rtkappsimulatedgeometrytest)
 
   # FDK test
-  if(RTK_USE_CUDA AND CUDA_HAVE_GPU)
+  if(RTK_USE_CUDA)
     add_test(rtkappfdktest ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/rtkfdk -g geo -p . -r sheppy.mha -o fdk.mha --hardware cuda --dimension 21)
   else()
     add_test(rtkappfdktest ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/rtkfdk -g geo -p . -r sheppy.mha -o fdk.mha --dimension 21)
diff --git a/cmake/FindCUDA_wrap.cmake b/cmake/FindCUDA_wrap.cmake
deleted file mode 100644
index 4c4bf4a1c..000000000
--- a/cmake/FindCUDA_wrap.cmake
+++ /dev/null
@@ -1,81 +0,0 @@
-# - Wrapper around FindCUDA
-cmake_minimum_required(VERSION 3.3)
-
-if (MINGW)
-  # Cuda doesn't work with mingw at all
-  set (CUDA_FOUND FALSE)
-elseif (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} VERSION_LESS 2.8)
-  # FindCuda is included with CMake 2.8
-  set (CUDA_FOUND FALSE)
-else ()
-  # GCS 2011.03.16
-  # Make nvcc less whiny
-  if (CMAKE_COMPILER_IS_GNUCC)
-    set (CUDA_PROPAGATE_HOST_FLAGS CACHE BOOL OFF)
-  endif ()
-
-  # GCS 2012-05-11:  We need to propagate cxx flags to nvcc, but
-  # the flag -ftest-coverage causes nvcc to barf, so exclude that one
-  if (CMAKE_COMPILER_IS_GNUCC)
-    string (REPLACE "-ftest-coverage" "" TMP "${CMAKE_CXX_FLAGS}")
-    string (REPLACE "-ftemplate-depth-50" "" TMP "${TMP}")
-    string (REPLACE " " "," TMP "${TMP}")
-    set (CUDA_CXX_FLAGS ${CUDA_CXX_FLAGS} ${TMP})
-  endif ()
-  find_package (CUDA QUIET)
-endif ()
-
-# GCS 2012-09-25 - Seems this is needed too
-if ("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64")
-  set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} -Xcompiler -fPIC")
-endif ()
-
-# SR Remove warning with shared libs and MSVC
-if(MSVC)
-  set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} -DRTK_EXPORTS")
-endif()
-
-set (CUDA_FOUND ${CUDA_FOUND} CACHE BOOL "Did we find cuda?")
-mark_as_advanced(CUDA_FOUND)
-
-if (CUDA_FOUND)
-  cuda_include_directories (${CMAKE_CURRENT_SOURCE_DIR})
-endif ()
-
-if("${CUDA_VERSION}" VERSION_LESS 9.0)
- set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS}
-     -gencode arch=compute_20,code=sm_20)
-endif()
-if("${CUDA_VERSION}" VERSION_LESS 11.0)
- set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS}
-     -gencode arch=compute_30,code=sm_30)
-endif()
-set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS}
-     -Wno-deprecated-gpu-targets
-     -Wno-deprecated-declarations
-     -gencode arch=compute_35,code=sm_35
-     -gencode arch=compute_35,code=compute_35
-     )
-
-if(NOT "-std=c++${CMAKE_CXX_STANDARD}" IN_LIST CUDA_NVCC_FLAGS)
-  list(APPEND CUDA_NVCC_FLAGS "-std=c++${CMAKE_CXX_STANDARD}")
-endif()
-
-if(CUDA_FOUND)
-  try_run(RUN_RESULT_VAR COMPILE_RESULT_VAR
-         ${CMAKE_BINARY_DIR}
-         ${CMAKE_CURRENT_LIST_DIR}/has_cuda_gpu.cxx
-         CMAKE_FLAGS
-             -DINCLUDE_DIRECTORIES:STRING=${CUDA_TOOLKIT_INCLUDE}
-             -DLINK_LIBRARIES:STRING=${CUDA_CUDART_LIBRARY}
-         COMPILE_OUTPUT_VARIABLE COMPILE_OUTPUT_VAR
-         RUN_OUTPUT_VARIABLE RUN_OUTPUT_VAR)
-    # COMPILE_RESULT_VAR is TRUE when compile succeeds
-    # RUN_RESULT_VAR is zero when a GPU is found
-    if(COMPILE_RESULT_VAR AND NOT RUN_RESULT_VAR)
-        set(CUDA_HAVE_GPU TRUE CACHE BOOL "Whether CUDA-capable GPU is present")
-    else()
-        set(CUDA_HAVE_GPU FALSE CACHE BOOL "Whether CUDA-capable GPU is present")
-    endif()
-    mark_as_advanced(CUDA_HAVE_GPU)
-endif()
diff --git a/cmake/has_cuda_gpu.cxx b/cmake/has_cuda_gpu.cxx
deleted file mode 100644
index 2337ab6cd..000000000
--- a/cmake/has_cuda_gpu.cxx
+++ /dev/null
@@ -1,28 +0,0 @@
-#include <cstdio>
-#include <cuda_runtime.h>
-
-int
-main()
-{
-  int                   deviceCount, device;
-  int                   gpuDeviceCount = 0;
-  struct cudaDeviceProp properties;
-  cudaError_t           cudaResultCode = cudaGetDeviceCount(&deviceCount);
-  if (cudaResultCode != cudaSuccess)
-    deviceCount = 0;
-  /* machines with no GPUs can still report one emulation device */
-  for (device = 0; device < deviceCount; ++device)
-  {
-    cudaGetDeviceProperties(&properties, device);
-    if (properties.major != 9999) /* 9999 means emulation only */
-      ++gpuDeviceCount;
-  }
-  printf("%d GPU CUDA device(s) found\n", gpuDeviceCount);
-
-  /* don't just return the number of gpus, because other runtime cuda
-     errors can also yield non-zero return values */
-  if (gpuDeviceCount > 0)
-    return 0; /* success */
-  else
-    return 1; /* failure */
-}
diff --git a/itk-module-init.cmake b/itk-module-init.cmake
index 3c61659c4..564b3fc2c 100644
--- a/itk-module-init.cmake
+++ b/itk-module-init.cmake
@@ -3,23 +3,32 @@
 #
 list(APPEND CMAKE_MODULE_PATH ${RTK_SOURCE_DIR}/cmake)
 
-find_package(CUDA_wrap QUIET)
-if(CUDA_FOUND)
-  if(${CUDA_VERSION} VERSION_LESS 8.0)
-    message(WARNING "CUDA version ${CUDA_VERSION} is not supported by RTK.")
-    set(RTK_USE_CUDA_DEFAULT OFF)
+include(CheckLanguage)
+check_language(CUDA)
+
+# Determine default value for RTK_USE_CUDA
+set(RTK_USE_CUDA_DEFAULT OFF)
+if (CMAKE_CUDA_COMPILER)
+  find_package(CUDAToolkit)
+  if(NOT CUDAToolkit_FOUND)
+    message(WARNING "CUDAToolkit not found (available since CMake v3.17). RTK_USE_CUDA set to OFF.")
+  elseif(DEFINED CUDAToolkit_VERSION AND "${CUDAToolkit_VERSION}" VERSION_LESS 8.0)
+    message(WARNING "CUDA version ${CUDAToolkit_VERSION} is not supported by RTK, version 8 is required. RTK_USE_CUDA set to OFF.")
   else()
     set(RTK_USE_CUDA_DEFAULT ON)
   endif()
-else()
-  set(RTK_USE_CUDA_DEFAULT OFF)
 endif()
 option(RTK_USE_CUDA "Use CUDA for RTK" ${RTK_USE_CUDA_DEFAULT})
 
+# Configure CUDA compilation options
 if(RTK_USE_CUDA)
-  if(NOT CUDA_FOUND)
-    find_package(CUDA_wrap REQUIRED)
-  endif()
+  enable_language(CUDA)
+  set(CMAKE_CUDA_RUNTIME_LIBRARY Static)
+
+  include_directories(${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES})
+  find_package(CUDAToolkit REQUIRED 8.0)
+
+  set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets")
+  set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-declarations")
   set(RTK_CUDA_PROJECTIONS_SLAB_SIZE "16" CACHE STRING "Number of projections processed simultaneously in CUDA forward and back projections")
 endif()
-
diff --git a/rtkConfiguration.h.in b/rtkConfiguration.h.in
index 0e4e94628..c8ec2f167 100644
--- a/rtkConfiguration.h.in
+++ b/rtkConfiguration.h.in
@@ -28,9 +28,6 @@ namespace rtk
 using ThreadIdType = itk::ThreadIdType;
 }
 
-#ifndef CUDA_FOUND
-#  cmakedefine CUDA_FOUND
-#endif
 #cmakedefine RTK_PROBE_EACH_FILTER
 #cmakedefine RTK_USE_CUDA
 #cmakedefine RTK_BUILD_SHARED_LIBS 1
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 4fff512bc..748bad7f8 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -69,7 +69,32 @@ set_directory_properties(PROPERTIES COMPILE_DEFINITIONS "${defComSansVTK}")
 # CUDA library
 #=========================================================
 if (RTK_USE_CUDA)
-  set(RTK_CUDA_FILES
+  set(RTK_SRCS ${RTK_SRCS}
+    rtkCudaAverageOutOfROIImageFilter.cxx
+    rtkCudaConstantVolumeSeriesSource.cxx
+    rtkCudaConstantVolumeSource.cxx
+    rtkCudaCropImageFilter.cxx
+    rtkCudaCyclicDeformationImageFilter.cxx
+    rtkCudaDisplacedDetectorImageFilter.cxx
+    rtkCudaFDKBackProjectionImageFilter.cxx
+    rtkCudaFDKConeBeamReconstructionFilter.cxx
+    rtkCudaFDKWeightProjectionFilter.cxx
+    rtkCudaForwardWarpImageFilter.cxx
+    rtkCudaInterpolateImageFilter.cxx
+    rtkCudaIterativeFDKConeBeamReconstructionFilter.cxx
+    rtkCudaLagCorrectionImageFilter.cxx
+    rtkCudaLaplacianImageFilter.cxx
+    rtkCudaLastDimensionTVDenoisingImageFilter.cxx
+    rtkCudaParkerShortScanImageFilter.cxx
+    rtkCudaPolynomialGainCorrectionImageFilter.cxx
+    rtkCudaRayCastBackProjectionImageFilter.cxx
+    rtkCudaSplatImageFilter.cxx
+    rtkCudaTotalVariationDenoisingBPDQImageFilter.cxx
+    rtkCudaWarpBackProjectionImageFilter.cxx
+    rtkCudaWarpForwardProjectionImageFilter.cxx
+    rtkCudaWarpImageFilter.cxx)
+
+  set(RTK_SRCS ${RTK_SRCS}
     rtkCudaAverageOutOfROIImageFilter.cu
     rtkCudaBackProjectionImageFilter.cu
     rtkCudaConjugateGradientImageFilter.cu
@@ -99,37 +124,6 @@ if (RTK_USE_CUDA)
     rtkCudaWarpImageFilter.cu
     rtkCudaWeidingerForwardModelImageFilter.cu
     )
-
-  set(CUDA_PROPAGATE_HOST_FLAGS ON)
-  set(CUDA_USE_STATIC_CUDA_RUNTIME OFF)#WARNING: mandatory for defining runtime type \MT vs \MD
-  CUDA_COMPILE(RTK_CUDA_WRAPPERS ${RTK_CUDA_FILES})
-
-  set(RTK_SRCS ${RTK_SRCS}
-    rtkCudaAverageOutOfROIImageFilter.cxx
-    rtkCudaConstantVolumeSeriesSource.cxx
-    rtkCudaConstantVolumeSource.cxx
-    rtkCudaCropImageFilter.cxx
-    rtkCudaCyclicDeformationImageFilter.cxx
-    rtkCudaDisplacedDetectorImageFilter.cxx
-    rtkCudaFDKBackProjectionImageFilter.cxx
-    rtkCudaFDKConeBeamReconstructionFilter.cxx
-    rtkCudaFDKWeightProjectionFilter.cxx
-    rtkCudaForwardWarpImageFilter.cxx
-    rtkCudaInterpolateImageFilter.cxx
-    rtkCudaIterativeFDKConeBeamReconstructionFilter.cxx
-    rtkCudaLagCorrectionImageFilter.cxx
-    rtkCudaLaplacianImageFilter.cxx
-    rtkCudaLastDimensionTVDenoisingImageFilter.cxx
-    rtkCudaParkerShortScanImageFilter.cxx
-    rtkCudaPolynomialGainCorrectionImageFilter.cxx
-    rtkCudaRayCastBackProjectionImageFilter.cxx
-    rtkCudaSplatImageFilter.cxx
-    rtkCudaTotalVariationDenoisingBPDQImageFilter.cxx
-    rtkCudaWarpBackProjectionImageFilter.cxx
-    rtkCudaWarpForwardProjectionImageFilter.cxx
-    rtkCudaWarpImageFilter.cxx
-    ${RTK_CUDA_WRAPPERS}
-    ${RTK_CUDA_FILES})
 endif()
 #=========================================================
 
@@ -137,5 +131,8 @@ itk_module_add_library(RTK ${RTK_SRCS})
 target_link_libraries(RTK LINK_PUBLIC lpsolve55)
 
 if (RTK_USE_CUDA)
-  target_link_libraries( RTK LINK_PUBLIC ITKCudaCommon ${CUDA_LIBRARIES} ${CUDA_CUDA_LIBRARY} ${CUDA_cufft_LIBRARY} ${CUDA_CUBLAS_LIBRARIES} )
+  target_link_libraries(RTK LINK_PUBLIC CUDA::cuda_driver)
+  target_link_libraries(RTK LINK_PUBLIC CUDA::cufft)
+  target_link_libraries(RTK LINK_PUBLIC CUDA::cublas)
+  set_property(TARGET RTK PROPERTY CUDA_STANDARD ${CMAKE_CXX_STANDARD})
 endif ()
diff --git a/utilities/ITKCudaCommon/CMakeLists.txt b/utilities/ITKCudaCommon/CMakeLists.txt
index 45a8a75bb..dcfdbc55b 100644
--- a/utilities/ITKCudaCommon/CMakeLists.txt
+++ b/utilities/ITKCudaCommon/CMakeLists.txt
@@ -2,15 +2,14 @@ project(ITKCudaCommon)
 
 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/CMake)
 
-find_package(CUDA REQUIRED)
-if(NOT ${CUDA_FOUND})
-     message(FATAL "Could not find CUDA")
-endif()
+enable_language(CUDA)
+find_package(CUDAToolkit REQUIRED)
+include_directories(${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES})
+set(CMAKE_CUDA_RUNTIME_LIBRARY Static)
 
 set(ITKCudaCommon_LIBRARIES ITKCudaCommon)
 set(ITKCudaCommon_SYSTEM_INCLUDE_DIRS ${CUDA_INCLUDE_DIRS})
 set(ITKCudaCommon_SYSTEM_LIBRARY_DIRS ${CUDA_LIBRARIES})
-
 set(ITKCudaCommon_INCLUDE_DIRS ${ITKCudaCommon_SYSTEM_INCLUDE_DIRS}
   ${ITKCudaCommon_SOURCE_DIR}/include PARENT_SCOPE)
 
diff --git a/utilities/ITKCudaCommon/src/CMakeLists.txt b/utilities/ITKCudaCommon/src/CMakeLists.txt
index 97cc1a86a..efaa35963 100644
--- a/utilities/ITKCudaCommon/src/CMakeLists.txt
+++ b/utilities/ITKCudaCommon/src/CMakeLists.txt
@@ -5,16 +5,10 @@ set(ITKCudaCommon_SRC
     itkCudaMemoryProbe.cxx
   )
 
-include_directories(${CUDA_INCLUDE_DIRS})
 include_directories(${ITKCudaCommon_SOURCE_DIR}/include)
 include_directories(${ITK_INCLUDE_DIRS})
 add_library(ITKCudaCommon ${ITK_LIBRARY_BUILD_TYPE} ${ITKCudaCommon_SRC})
-target_link_libraries(ITKCudaCommon LINK_PUBLIC ${ITKCommon_LIBRARIES} ${CUDA_CUDA_LIBRARY} ${CUDA_LIBRARIES})
-
-# if(ITK_SOURCE_DIR)
-#   itk_module_link_dependencies()
-#   itk_module_target(ITKCudaCommon)
-# endif()
+target_link_libraries(ITKCudaCommon LINK_PUBLIC ${ITKCommon_LIBRARIES} CUDA::cudart CUDA::cuda_driver)
 
 if(NOT RTK_INSTALL_NO_LIBRARIES)
   target_include_directories(ITKCudaCommon PUBLIC $<INSTALL_INTERFACE:${ITKCudaCommon_INSTALL_INCLUDE_DIR}>)


Test patch:
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index e5dc6e3ac..760e2dae9 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -28,7 +28,7 @@ endfunction()
 # rtk_add_cuda_test(testname testfile [DATA{}])
 # Add test depending on CUDA
 function(rtk_add_cuda_test testname testfile)
-  if(RTK_USE_CUDA AND CUDA_HAVE_GPU)
+  if(RTK_USE_CUDA)
     add_executable(${testname} ${testfile})
     target_link_libraries( ${testname} ${RTK_LIBRARIES} ${ITK_LIBRARIES})
     itk_add_test(NAME ${testname}