Hi Brian, all<br><br>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.<br>
<br>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...<br>
<br>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...<br>
<br>Sorry for the bad coding standards and lack of comments, but you can always have a look at <a href="https://gna.org/projects/wkcmake/">https://gna.org/projects/wkcmake/</a> 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...<br>
<br>Anyway I hope this helps.<br><br>--<br>AlexV<br><br><div class="gmail_quote">2009/12/22 Brian Davis <span dir="ltr">&lt;<a href="mailto:bitminer@gmail.com">bitminer@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>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.<br><br>The two libraries I am building currently are dcmtk (DICOM library) and boost.<br>

<br>I am trying to use cmake to create a project  which includes dcmtk and boost (and other 3rdParty libs) and projects I am creating<br><br>I have a CMakeLists.txt file which has the following line removed<br><br>#add_subdirectory( ${THIRD_PARTY_SRC_DIR}/boost-cmake-1_41_0 ./boost )<br>

<br>When I use this I see in my CMakeCache.txt (and ultimaetly MSVS project files) the following (using grep):<br><br>build/dvip4-Win64/CMakeCache.txt:CMAKE_MODULE_LINKER_FLAGS:STRING=/machine:x64<br>build/dvip4-Win64/CMakeCache.txt:CMAKE_MODULE_LINKER_FLAGS_DEBUG:STRING=/debug /INCREMENTAL:YES<br>

build/dvip4-Win64/CMakeCache.txt:CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL:STRING=/INCREMENTAL:NO<br>build/dvip4-Win64/CMakeCache.txt:CMAKE_MODULE_LINKER_FLAGS_RELEASE:STRING=/INCREMENTAL:NO<br>build/dvip4-Win64/CMakeCache.txt:CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO:STRING=/debug /INCREMENTAL:YES<br>

build/dvip4-Win64/CMakeCache.txt://ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS<br>build/dvip4-Win64/CMakeCache.txt:CMAKE_MODULE_LINKER_FLAGS-ADVANCED:INTERNAL=1<br>build/dvip4-Win64/CMakeCache.txt://ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_DEBUG<br>

build/dvip4-Win64/CMakeCache.txt:CMAKE_MODULE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1<br>build/dvip4-Win64/CMakeCache.txt://ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL<br>build/dvip4-Win64/CMakeCache.txt:CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1<br>

build/dvip4-Win64/CMakeCache.txt://ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_RELEASE<br>build/dvip4-Win64/CMakeCache.txt:CMAKE_MODULE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1<br>build/dvip4-Win64/CMakeCache.txt://ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO<br>

build/dvip4-Win64/CMakeCache.txt:CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1<br><br>When I add the line<br><br>add_subdirectory( ${THIRD_PARTY_SRC_DIR}/boost-cmake-1_41_0 ./boost )<br>
<br>I get the following (using grep):<br><br>build/test-Win64/CMakeCache.txt://ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS<br>build/test-Win64/CMakeCache.txt:CMAKE_MODULE_LINKER_FLAGS-ADVANCED:INTERNAL=1<br>

build/test-Win64/CMakeCache.txt:CMAKE_MODULE_LINKER_FLAGS:INTERNAL=/machine:x64<br>build/test-Win64/CMakeCache.txt://ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_DEBUG<br>build/test-Win64/CMakeCache.txt:CMAKE_MODULE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1<br>

build/test-Win64/CMakeCache.txt:CMAKE_MODULE_LINKER_FLAGS_DEBUG:INTERNAL=<br>build/test-Win64/CMakeCache.txt://ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL<br>build/test-Win64/CMakeCache.txt:CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1<br>

build/test-Win64/CMakeCache.txt:CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL:INTERNAL=<br>build/test-Win64/CMakeCache.txt://ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_RELEASE<br>build/test-Win64/CMakeCache.txt:CMAKE_MODULE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1<br>

build/test-Win64/CMakeCache.txt:CMAKE_MODULE_LINKER_FLAGS_RELEASE:INTERNAL=<br>build/test-Win64/CMakeCache.txt://ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO<br>build/test-Win64/CMakeCache.txt:CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1<br>

build/test-Win64/CMakeCache.txt:CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO:INTERNAL=<br><br>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:<br>

<br>SET( CMAKE_EXE_LINKER_FLAGS /machine:x64 CACHE STRING &quot;&quot; FORCE )<br>SET( CMAKE_MODULE_LINKER_FLAGS /machine:x64 CACHE STRING &quot;&quot; FORCE )<br>SET( CMAKE_SHARED_LINKER_FLAGS /machine:x64 CACHE STRING &quot;&quot; FORCE )<br>

<br>Have no effect.<br><br>Looking at boost for the CMAKE vars in question I get:<br><br>source/cpp/lib/3rdParty/Win32/boost-cmake-1_41_0/CMakeLists.txt:list(APPEND CMAKE_MODULE_PATH ${Boost_SOURCE_DIR}/tools/build/CMake)<br>

source/cpp/lib/3rdParty/Win32/boost-cmake-1_41_0/tools/build/CMake/BoostConfig.cmake:set(CMAKE_MODULE_LINKER_FLAGS_DEBUG &quot;&quot; CACHE INTERNAL &quot;Unused by Boost&quot;)<br>source/cpp/lib/3rdParty/Win32/boost-cmake-1_41_0/tools/build/CMake/BoostConfig.cmake:set(CMAKE_MODULE_LINKER_FLAGS_RELEASE &quot;&quot; CACHE INTERNAL &quot;Unused by Boost&quot;)<br>

source/cpp/lib/3rdParty/Win32/boost-cmake-1_41_0/tools/build/CMake/BoostConfig.cmake:set(CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL &quot;&quot; CACHE INTERNAL &quot;Unused by Boost&quot;)<br>source/cpp/lib/3rdParty/Win32/boost-cmake-1_41_0/tools/build/CMake/BoostConfig.cmake:set(CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO &quot;&quot; CACHE INTERNAL &quot;Unused by Boost&quot;)<br>

source/cpp/lib/3rdParty/Win32/vtk-5.4.2/CMake/vtkDetermineCompilerFlags.cmake:SET(CMAKE_MODULE_LINKER_FLAGS &quot;${CMAKE_MODULE_LINKER_FLAGS} ${VTK_REQUIRED_MODULE_LINKER_FLAGS}&quot;)<br><br><br>Which shows CACHE INTERNAL.<br>

<br>Is boost forceably overriding these and keeping user from changing or is there a way I can change these.<br><br><br>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 <br>

<br>add_subdirectory( ${THIRD_PARTY_SRC_DIR}/boost-cmake-1_41_0 ./boost )<br>

<br>and<br><br>find( boost ) <br><br>i.e. How can I find boost if I have not build it yet (fresh checkout).... awesome.<br><br><br>my current CMakeLists.txt file contains:<br><br><br>SET( PLATFORM_DIR platform/3rdParty/Win32 )<br>

SET( THIRD_PARTY_PACKAGE_DIR source/cpp/lib/3rdParty/Win32 )<br>SET( THIRD_PARTY_SRC_DIR  lib/3rdParty/Win32/ )<br>SET( APP_SRC_DIR source/cpp/app )<br><br><br>#Unpack the source - this function I wrote myself to unpack 3rdParty source zip files into the source tree.<br>

unpack( ${PLATFORM_DIR}/boost/boost-cmake-1_41_0.zip  ${THIRD_PARTY_PACKAGE_DIR} )<br>#~ unpack( ${PLATFORM_DIR}/ITK/InsightApplications-3.16.0.zip ${THIRD_PARTY_PACKAGE_DIR} )<br>#~ unpack( ${PLATFORM_DIR}/ITK/InsightToolkit-3.16.0.zip ${THIRD_PARTY_PACKAGE_DIR} )<br>

unpack( ${PLATFORM_DIR}/VTK/vtk-5.4.2.zip ${THIRD_PARTY_PACKAGE_DIR}/vtk-5.4.2 )<br><br>add_subdirectory( ${THIRD_PARTY_SRC_DIR}/dcmtk-3.5.4 ./dcmtk-3.5.4  )<br>#~ add_subdirectory( ${THIRD_PARTY_SRC_DIR}/vtk-5.4.2 ./vtk-5.4.2  )<br>

<br>add_subdirectory( ${THIRD_PARTY_SRC_DIR}/boost-cmake-1_41_0 ./boost )<br><br>add_subdirectory( app/testing/dicomserver ./dicomserver )<br><br><br>SET( Boost_INCLUDE_DIR ${THIRD_PARTY_SRC_DIR}/boost-cmake-1_41_0 CACHE STRING &quot;&quot; FORCE )<br>

<br>#add_subdirectory( ${THIRD_PARTY_SRC_DIR}/InsightToolkit-3.16.0 ./InsightToolkit-3.16.0  )<br>#add_subdirectory( ${THIRD_PARTY_SRC_DIR}/InsightApplications-3.16.0 ./InsightApplications-3.16.0  )<br><br>#~ find_package( cuda 2.3 )<br>

#~ find_package( boost )<br>find_package( dcmtk )<br><br><br>There has been some conflicts adding in certain packages into this file (boost and vtk) with dcmtk.<br><br>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?<br>
<font color="#888888">
<br><br>Brian<br><br><br><br>
</font><br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br></blockquote></div><br>