Part 1 - Being resent in brokendown form due to 40kb limit on mail list Continuing on with my attempt to build a project with includes 3rdParty Libs I have run into a problem when adding library (using add_subdirectory( pathtowherever/dcmtk dcmtk ) dcmtk (Dicom Toolkit) and building a CUDA test application (nbody - from NVIDA SDK) as test to verity I could build both using CMake.
I have the following line in one of my CMakeLists.txt files which I have traced the issue down to. add_subdirectory( ${THIRD_PARTY_SRC_DIR}/dcmtk-3.5.4 ./dcmtk-3.5.4 ) When I include this line the nbody app fails to build. When I remove it the NBody app compiles. The link error created when dcmtk is included in the project is: 1>Linking... 1>bodysystemcuda.obj : error LNK2019: unresolved external symbol allocateNBodyArrays referenced in function "protected: virtual void __cdecl BodySystemCUDA::_initialize( int)" (?_initial...@bodysystemcuda@@mea...@z) 1>bodysystemcuda.obj : error LNK2019: unresolved external symbol registerGLBufferObject referenced in function "protected: virtual void __cdecl BodySystemCUDA::_initialize(int)" (?_initial...@bodysystemcuda @@mea...@z) 1>bodysystemcuda.obj : error LNK2019: unresolved external symbol unregisterGLBufferObject referenced in function "protected: virtual void __cdecl BodySystemCUDA::_finalize(void)" (?_final...@bodysystemcuda @@MEAAXXZ) 1>bodysystemcuda.obj : error LNK2019: unresolved external symbol deleteNBodyArrays referenced in function "protected: virtual void __cdecl BodySystemCUDA::_finalize(void)" (?_final...@bodysystemcuda@@MEAAXXZ) 1>bodysystemcuda.obj : error LNK2019: unresolved external symbol setDeviceSoftening referenced in function "public: virtual void __cdecl BodySystemCUDA::setSoftening(float)" (?setsoften...@bodysystemcuda@@uea...@z ) 1>bodysystemcuda.obj : error LNK2019: unresolved external symbol integrateNbodySystem referenced in function "public: virtual void __cdecl BodySystemCUDA::update(float)" (?upd...@bodysystemcuda@@uea...@z) 1>bodysystemcuda.obj : error LNK2019: unresolved external symbol copyArrayFromDevice referenced in function "public: virtual float * __cdecl BodySystemCUDA::getArray(enum BodySystem::BodyArray)" (?getar...@bodysystemcuda@@ueaapeamw4bodyar...@bodysystem@@@Z) 1>bodysystemcuda.obj : error LNK2019: unresolved external symbol copyArrayToDevice referenced in function "public: virtual void __cdecl BodySystemCUDA::setArray(enum BodySystem::BodyArray,float const *)" (?setar...@bodysystemcuda@@ueaaxw4bodyar...@bodysystem@@p...@z) 1>bodysystemcuda.obj : error LNK2019: unresolved external symbol threadSync referenced in function "public: virtual void __cdecl BodySystemCUDA::synchronizeThreads(void)const " (?synchronizethre...@bodysystemcuda@@UEBAXXZ) 1>C:\projects\NIH2009\source\branches\brian\build\Windows-6.1\ouput\bin\Debug\nbody.exe : fatal error LNK1120: 9 unresolved externals 1>Build log was saved at "file://c:\projects\NIH2009\source\branches\brian\build\dvip4-Win64-broken\cpp_source\app\nbody\nbody.dir\Debug\BuildLog.htm" 1>nbody - 10 error(s), 0 warning(s) Which is a linker error where extern "C" files cannot be found. The inclusion of a third party lib affects the project globally. Now conversations above imply that CMake was never designed for this type of use case. I have already had to change boost cmake build and will be submitting my patch to that mailing list. It appears as though now dcmtk does not play nice either. There are differences in the files... some I expect and others I did not. A simple file diff showing the files affected between just the project with nbody (only nbody) and the project with dcmtk (nbody and dcmtk) included are: Files dvip4-Win64-working/ALL_BUILD.vcproj and dvip4-Win64-broken/ALL_BUILD.vcproj differ Files dvip4-Win64-working/CMakeCache.txt and dvip4-Win64-broken/CMakeCache.txt differ Files dvip4-Win64-working/CMakeFiles/CMakeDetermineCompilerABI_C.bin and dvip4-Win64-broken/CMakeFiles/CMakeDetermineCompilerABI_C.bin differ Files dvip4-Win64-working/CMakeFiles/CMakeDetermineCompilerABI_CXX.bin and dvip4-Win64-broken/CMakeFiles/CMakeDetermineCompilerABI_CXX.bin differ Files dvip4-Win64-working/CMakeFiles/generate.stamp.list and dvip4-Win64-broken/CMakeFiles/generate.stamp.list differ Only in dvip4-Win64-broken/CMakeFiles: INSTALL_force.rule Files dvip4-Win64-working/CMakeFiles/TargetDirectories.txt and dvip4-Win64-broken/CMakeFiles/TargetDirectories.txt differ Files dvip4-Win64-working/cpp_source/ALL_BUILD.vcproj and dvip4-Win64-broken/cpp_source/ALL_BUILD.vcproj differ Only in dvip4-Win64-broken/cpp_source/app/CMakeFiles: INSTALL_force.rule Only in dvip4-Win64-broken/cpp_source/app/dicomserver/CMakeFiles: INSTALL_force.rule Only in dvip4-Win64-broken/cpp_source/app/dicomserver: INSTALL.vcproj Only in dvip4-Win64-broken/cpp_source/app: INSTALL.vcproj Only in dvip4-Win64-working/cpp_source/app/nbody: bodysystemcuda.linkinfo Files dvip4-Win64-working/cpp_source/app/nbody/CMakeFiles/generate.stamp.depend and dvip4-Win64-broken/cpp_source/app/nbody/CMakeFiles/generate.stamp.depend differ Only in dvip4-Win64-broken/cpp_source/app/nbody/CMakeFiles: INSTALL_force.rule Files dvip4-Win64-working/cpp_source/app/nbody/CMakeFiles/nbody_generated_bodysystemcuda.cu.obj.cmake and dvip4-Win64-broken/cpp_source/app/nbody/CMakeFiles/nbody_generated_bodysystemcuda.cu.obj.cmake differ Files dvip4-Win64-working/cpp_source/app/nbody/CMakeFiles/nbody_generated_bodysystemcuda.cu.obj.depend and dvip4-Win64-broken/cpp_source/app/nbody/CMakeFiles/nbody_generated_bodysystemcuda.cu.obj.depend differ Files dvip4-Win64-working/cpp_source/app/nbody/Debug/nbody_generated_bodysystemcuda.cu.obj and dvip4-Win64-broken/cpp_source/app/nbody/Debug/nbody_generated_bodysystemcuda.cu.obj differ Files dvip4-Win64-working/cpp_source/app/nbody/Debug/nbody_generated_nbody_kernel.cu.obj and dvip4-Win64-broken/cpp_source/app/nbody/Debug/nbody_generated_nbody_kernel.cu.obj differ Only in dvip4-Win64-broken/cpp_source/app/nbody: INSTALL.vcproj Files dvip4-Win64-working/cpp_source/app/nbody/nbody.dir/Debug/bodysystemcpu.obj and dvip4-Win64-broken/cpp_source/app/nbody/nbody.dir/Debug/bodysystemcpu.obj differ Files dvip4-Win64-working/cpp_source/app/nbody/nbody.dir/Debug/bodysystemcuda.obj and dvip4-Win64-broken/cpp_source/app/nbody/nbody.dir/Debug/bodysystemcuda.obj differ Files dvip4-Win64-working/cpp_source/app/nbody/nbody.dir/Debug/BuildLog.htm and dvip4-Win64-broken/cpp_source/app/nbody/nbody.dir/Debug/BuildLog.htm differ Only in dvip4-Win64-working/cpp_source/app/nbody/nbody.dir/Debug: mt.dep Files dvip4-Win64-working/cpp_source/app/nbody/nbody.dir/Debug/nbody.exe.embed.manifest and dvip4-Win64-broken/cpp_source/app/nbody/nbody.dir/Debug/nbody.exe.embed.manifest differ Files dvip4-Win64-working/cpp_source/app/nbody/nbody.dir/Debug/nbody.exe.embed.manifest.res and dvip4-Win64-broken/cpp_source/app/nbody/nbody.dir/Debug/nbody.exe.embed.manifest.res differ Files dvip4-Win64-working/cpp_source/app/nbody/nbody.dir/Debug/nbody.obj and dvip4-Win64-broken/cpp_source/app/nbody/nbody.dir/Debug/nbody.obj differ Files dvip4-Win64-working/cpp_source/app/nbody/nbody.dir/Debug/nbody_gold.obj and dvip4-Win64-broken/cpp_source/app/nbody/nbody.dir/Debug/nbody_gold.obj differ Files dvip4-Win64-working/cpp_source/app/nbody/nbody.dir/Debug/param.obj and dvip4-Win64-broken/cpp_source/app/nbody/nbody.dir/Debug/param.obj differ Files dvip4-Win64-working/cpp_source/app/nbody/nbody.dir/Debug/paramgl.obj and dvip4-Win64-broken/cpp_source/app/nbody/nbody.dir/Debug/paramgl.obj differ Files dvip4-Win64-working/cpp_source/app/nbody/nbody.dir/Debug/render_particles.obj and dvip4-Win64-broken/cpp_source/app/nbody/nbody.dir/Debug/render_particles.obj differ Files dvip4-Win64-working/cpp_source/app/nbody/nbody.vcproj and dvip4-Win64-broken/cpp_source/app/nbody/nbody.vcproj differ Files dvip4-Win64-working/cpp_source/app/nbody/vc90.pdb and dvip4-Win64-broken/cpp_source/app/nbody/vc90.pdb differ Only in dvip4-Win64-broken/cpp_source/CMakeFiles: INSTALL_force.rule Files dvip4-Win64-working/cpp_source/dvip4src.sln and dvip4-Win64-broken/cpp_source/dvip4src.sln differ Only in dvip4-Win64-broken/cpp_source: INSTALL.vcproj Files dvip4-Win64-working/cpp_source/lib/cmake_install.cmake and dvip4-Win64-broken/cpp_source/lib/cmake_install.cmake differ Only in dvip4-Win64-broken/cpp_source/lib/CMakeFiles: INSTALL_force.rule Only in dvip4-Win64-broken/cpp_source/lib: dcmtk-3.5.4 Only in dvip4-Win64-broken/cpp_source/lib: INSTALL.vcproj Files dvip4-Win64-working/dvip4.ncb and dvip4-Win64-broken/dvip4.ncb differ Files dvip4-Win64-working/dvip4.sln and dvip4-Win64-broken/dvip4.sln differ Files dvip4-Win64-working/dvip4.suo and dvip4-Win64-broken/dvip4.suo differ Only in dvip4-Win64-broken: INSTALL.vcproj Only in dvip4-Win64-broken: INSTALL.vcproj.MEDPHYSICS.bdavis.user Files dvip4-Win64-working/ZERO_CHECK.vcproj and dvip4-Win64-broken/ZERO_CHECK.vcproj differ The differences I was not expecting relate to the dvip4-Win64-working/cpp_source/app/nbody directory. There are differences due to changes in the GUID for visual studio and random batch file names which I expect. Changes which affect the build settings I did not. I put a line feeds above between the section (nbody) I was expecting no changes (other than GUIDS and file names for batch files etc) I sent an email which further details the process to build nbody titled: "CUDA, CMAKE, and an attempt to build nbody" but it is awaiting moderator approval due to it's size. There is some good stuff in this email relating to building nbody and my experience in doing so. This is email is meant to document the issues when including a 3rdParty library and having global build setting craziness ensue. This was one of the issues encountered when building nbody. Some files are missing? Which I did not expect: bodysystemcuda.linkinfo INSTALL_force.rule (Artificial dependency for a custom command.) - of course what else would it be? INSTALL.vcproj (Contains actual project configuration, but this seems to shift around in the project based on where actual projects are) mt.dep ... to be continued
_______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake