Hi Brian, all While I have no experience in building boost and dcmtk at all, I have been writing a cmake based build framework for my own projects for quite some time now ( since cmake 2.2), because I was always using cmake in the same way, and I eventually needed to build different (little) projects with only one cmakelists.txt, use a bunch of convenience libraries, autodetect dependencies of dependencies variables, and so on... In short, things that cmake doesnt do easily right out of the box.
I had problems with variables names clashes between different subprojects, and I ended up with prefixing my variables for each of my projects ( not the compilers one though, as far as I remember... ). Athough now cmake as evolved, ( macro and function have different variable scope), I still use my build framework, and improve it, for new projects since it make things much easier for me. That is especially true when different packages that you need use different naming conventions and other build related specificities... So... to answer your question about building multiple 3d part libraries when you need them and that from only one cmakelist.txt refering its dependencies, I would say cmake doesnt seems to be designed for that in the first place, however it is doable, as long as you keep the compilation and the linkage two separate things ( dependencies dont work in the same way and we tend to shortcut that part too often ). Not really easy to do in a portable way though... Sorry for the bad coding standards and lack of comments, but you can always have a look at https://gna.org/projects/wkcmake/ and check on the few tests to find out how I managed to do that, even if it still imperfect, and there is still almost no documentation... Feel free to ask me anything you want to know about it. Working alone on such a potentially big project, I had to stop to the strict list of my requirements to go on actual C++ coding, and therefore it works better on linux than windows right now... Anyway I hope this helps. -- AlexV 2009/12/22 Brian Davis <bitmi...@gmail.com> > > I am continuing my attempt (latest in the saga) to use cmake to build 3rd > third party libraries and integrate my code and hopefully build only what I > need. > > The two libraries I am building currently are dcmtk (DICOM library) and > boost. > > I am trying to use cmake to create a project which includes dcmtk and > boost (and other 3rdParty libs) and projects I am creating > > I have a CMakeLists.txt file which has the following line removed > > #add_subdirectory( ${THIRD_PARTY_SRC_DIR}/boost-cmake-1_41_0 ./boost ) > > When I use this I see in my CMakeCache.txt (and ultimaetly MSVS project > files) the following (using grep): > > > build/dvip4-Win64/CMakeCache.txt:CMAKE_MODULE_LINKER_FLAGS:STRING=/machine:x64 > build/dvip4-Win64/CMakeCache.txt:CMAKE_MODULE_LINKER_FLAGS_DEBUG:STRING=/debug > /INCREMENTAL:YES > > build/dvip4-Win64/CMakeCache.txt:CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL:STRING=/INCREMENTAL:NO > > build/dvip4-Win64/CMakeCache.txt:CMAKE_MODULE_LINKER_FLAGS_RELEASE:STRING=/INCREMENTAL:NO > build/dvip4-Win64/CMakeCache.txt:CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO:STRING=/debug > /INCREMENTAL:YES > build/dvip4-Win64/CMakeCache.txt://ADVANCED property for variable: > CMAKE_MODULE_LINKER_FLAGS > > build/dvip4-Win64/CMakeCache.txt:CMAKE_MODULE_LINKER_FLAGS-ADVANCED:INTERNAL=1 > build/dvip4-Win64/CMakeCache.txt://ADVANCED property for variable: > CMAKE_MODULE_LINKER_FLAGS_DEBUG > > build/dvip4-Win64/CMakeCache.txt:CMAKE_MODULE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 > build/dvip4-Win64/CMakeCache.txt://ADVANCED property for variable: > CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL > > build/dvip4-Win64/CMakeCache.txt:CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 > build/dvip4-Win64/CMakeCache.txt://ADVANCED property for variable: > CMAKE_MODULE_LINKER_FLAGS_RELEASE > > build/dvip4-Win64/CMakeCache.txt:CMAKE_MODULE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 > build/dvip4-Win64/CMakeCache.txt://ADVANCED property for variable: > CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO > > build/dvip4-Win64/CMakeCache.txt:CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 > > When I add the line > > add_subdirectory( ${THIRD_PARTY_SRC_DIR}/boost-cmake-1_41_0 ./boost ) > > I get the following (using grep): > > build/test-Win64/CMakeCache.txt://ADVANCED property for variable: > CMAKE_MODULE_LINKER_FLAGS > > build/test-Win64/CMakeCache.txt:CMAKE_MODULE_LINKER_FLAGS-ADVANCED:INTERNAL=1 > > build/test-Win64/CMakeCache.txt:CMAKE_MODULE_LINKER_FLAGS:INTERNAL=/machine:x64 > build/test-Win64/CMakeCache.txt://ADVANCED property for variable: > CMAKE_MODULE_LINKER_FLAGS_DEBUG > > build/test-Win64/CMakeCache.txt:CMAKE_MODULE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 > build/test-Win64/CMakeCache.txt:CMAKE_MODULE_LINKER_FLAGS_DEBUG:INTERNAL= > build/test-Win64/CMakeCache.txt://ADVANCED property for variable: > CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL > > build/test-Win64/CMakeCache.txt:CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 > > build/test-Win64/CMakeCache.txt:CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL:INTERNAL= > build/test-Win64/CMakeCache.txt://ADVANCED property for variable: > CMAKE_MODULE_LINKER_FLAGS_RELEASE > > build/test-Win64/CMakeCache.txt:CMAKE_MODULE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 > build/test-Win64/CMakeCache.txt:CMAKE_MODULE_LINKER_FLAGS_RELEASE:INTERNAL= > build/test-Win64/CMakeCache.txt://ADVANCED property for variable: > CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO > > build/test-Win64/CMakeCache.txt:CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 > > build/test-Win64/CMakeCache.txt:CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO:INTERNAL= > > Notice the change from CMAKE_MODULE_LINKER_FLAGS:STRING to > CMAKE_MODULE_LINKER_FLAGS:INTERNAL. When this happens it appears as though > any calls I have in my CMakeLists.txt file containing: > > SET( CMAKE_EXE_LINKER_FLAGS /machine:x64 CACHE STRING "" FORCE ) > SET( CMAKE_MODULE_LINKER_FLAGS /machine:x64 CACHE STRING "" FORCE ) > SET( CMAKE_SHARED_LINKER_FLAGS /machine:x64 CACHE STRING "" FORCE ) > > Have no effect. > > Looking at boost for the CMAKE vars in question I get: > > source/cpp/lib/3rdParty/Win32/boost-cmake-1_41_0/CMakeLists.txt:list(APPEND > CMAKE_MODULE_PATH ${Boost_SOURCE_DIR}/tools/build/CMake) > source/cpp/lib/3rdParty/Win32/boost-cmake-1_41_0/tools/build/CMake/BoostConfig.cmake:set(CMAKE_MODULE_LINKER_FLAGS_DEBUG > "" CACHE INTERNAL "Unused by Boost") > source/cpp/lib/3rdParty/Win32/boost-cmake-1_41_0/tools/build/CMake/BoostConfig.cmake:set(CMAKE_MODULE_LINKER_FLAGS_RELEASE > "" CACHE INTERNAL "Unused by Boost") > source/cpp/lib/3rdParty/Win32/boost-cmake-1_41_0/tools/build/CMake/BoostConfig.cmake:set(CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL > "" CACHE INTERNAL "Unused by Boost") > source/cpp/lib/3rdParty/Win32/boost-cmake-1_41_0/tools/build/CMake/BoostConfig.cmake:set(CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO > "" CACHE INTERNAL "Unused by Boost") > source/cpp/lib/3rdParty/Win32/vtk-5.4.2/CMake/vtkDetermineCompilerFlags.cmake:SET(CMAKE_MODULE_LINKER_FLAGS > "${CMAKE_MODULE_LINKER_FLAGS} ${VTK_REQUIRED_MODULE_LINKER_FLAGS}") > > > Which shows CACHE INTERNAL. > > Is boost forceably overriding these and keeping user from changing or is > there a way I can change these. > > > At this point I also have a very basic question in the use case of CMAKE: > Is the cmake user suppoed to point cmake-gui separately to each individual > project, dcmk, boost, vtk, itk, etc or can I do what I am attempting: Create > one CMakeLists.txt file which references multiple separate project files > from multiple 3rdParty vendors then point cmake to 1 CMakeLists.txt file > (mine) and have cmake build all my code and whatever third party libs my > apps depend on. Currently, if I understand what is happening and I am not > saying I do, it seems as though each 3rdParty vendor can override global > CMakeVariables and keep an upper level CMakeList.txt file from setting the > variables. This gets to my namespace/project resolution question/problem > with CMake. Was CMake designed for this use case? I have also been having > the problem of the chicken-and-the-egg with the use of > > add_subdirectory( ${THIRD_PARTY_SRC_DIR}/boost-cmake-1_41_0 ./boost ) > > and > > find( boost ) > > i.e. How can I find boost if I have not build it yet (fresh checkout).... > awesome. > > > my current CMakeLists.txt file contains: > > > SET( PLATFORM_DIR platform/3rdParty/Win32 ) > SET( THIRD_PARTY_PACKAGE_DIR source/cpp/lib/3rdParty/Win32 ) > SET( THIRD_PARTY_SRC_DIR lib/3rdParty/Win32/ ) > SET( APP_SRC_DIR source/cpp/app ) > > > #Unpack the source - this function I wrote myself to unpack 3rdParty source > zip files into the source tree. > unpack( ${PLATFORM_DIR}/boost/boost-cmake-1_41_0.zip > ${THIRD_PARTY_PACKAGE_DIR} ) > #~ unpack( ${PLATFORM_DIR}/ITK/InsightApplications-3.16.0.zip > ${THIRD_PARTY_PACKAGE_DIR} ) > #~ unpack( ${PLATFORM_DIR}/ITK/InsightToolkit-3.16.0.zip > ${THIRD_PARTY_PACKAGE_DIR} ) > unpack( ${PLATFORM_DIR}/VTK/vtk-5.4.2.zip > ${THIRD_PARTY_PACKAGE_DIR}/vtk-5.4.2 ) > > add_subdirectory( ${THIRD_PARTY_SRC_DIR}/dcmtk-3.5.4 ./dcmtk-3.5.4 ) > #~ add_subdirectory( ${THIRD_PARTY_SRC_DIR}/vtk-5.4.2 ./vtk-5.4.2 ) > > add_subdirectory( ${THIRD_PARTY_SRC_DIR}/boost-cmake-1_41_0 ./boost ) > > add_subdirectory( app/testing/dicomserver ./dicomserver ) > > > SET( Boost_INCLUDE_DIR ${THIRD_PARTY_SRC_DIR}/boost-cmake-1_41_0 CACHE > STRING "" FORCE ) > > #add_subdirectory( ${THIRD_PARTY_SRC_DIR}/InsightToolkit-3.16.0 > ./InsightToolkit-3.16.0 ) > #add_subdirectory( ${THIRD_PARTY_SRC_DIR}/InsightApplications-3.16.0 > ./InsightApplications-3.16.0 ) > > #~ find_package( cuda 2.3 ) > #~ find_package( boost ) > find_package( dcmtk ) > > > There has been some conflicts adding in certain packages into this file > (boost and vtk) with dcmtk. > > Am I in uncharted shark invested waters on a leaky inflatable raft covered > in cheese bait, with what I am attempting or has anyone tried what I am > trying to do. Is this normal or just some form of crazy? > > > Brian > > > > > _______________________________________________ > 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 >
_______________________________________________ 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