<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>
<br><br>Brian<br><br><br><br>