[Insight-developers] problem building ITK using CMake 2.8 ExternalProject_add

kent williams norman-k-williams at uiowa.edu
Wed Apr 14 10:35:24 EDT 2010


Hans discovered the fix for this.

I was, in fact, trying to figure out how to build ITK using the
ExternalProject Module in CMake.

The problem 
The fix is to use this when you configure:

  -DLIBRARY_OUTPUT_PATH:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
  -DEXECUTABLE_OUTPUT_PATH:PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}

The problem ‹ which we¹ve run into before is that ITK still, in places, uses
the Œold¹ variables LIBRARY_OUTPUT_PATH/EXECUTABLE_OUTPUT_PATH instead of
the Œnew¹ property system to locate things.

If it happens (as in our case) that the CMAKE_...DIRECTORY variables are
set, such that they override the stock properties, then built programs no
longer go to EXECUTABLE_PATH...

On 4/13/10 4:16 PM, "Luis Ibanez" <luis.ibanez at kitware.com> wrote:

> 
> Hi Kent,
> 
> I'm a bit lost with the error that you are reporting...
> 
> Is this happening when building ITK out of the box,
> with CMake 2.8 ?
> 
> Or is this happening when you build ITK as a subproject
> of a larger project ?
> 
> 
>   Thanks for any hint,
> 
> 
>       Luis
> 
> 
> ------------------------------------------------------------------------------
> --------------
> On Tue, Apr 13, 2010 at 2:56 PM, kent williams <norman-k-williams at uiowa.edu>
> wrote:
>> 
>> I think that something is haywire with ITK builds in this context.   The
>> problem comes after checkout, where it tries to run itkmkg3states program.
>> 
>> cvs diff Utilities/itktiff/CMakeLists.txt
>> Index: Utilities/itktiff/CMakeLists.txt
>> ===================================================================
>> RCS file: /cvsroot/Insight/Insight/Utilities/itktiff/CMakeLists.txt,v
>> retrieving revision 1.6
>> diff -r1.6 CMakeLists.txt
>> 75c75
>> <     COMMAND
>> ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/itkmkg3states${EXE_EXTENSION}
>> ---
>>> >    COMMAND  ${CMAKE_CURRENT_BINARY_DIR}/itkmkg3states${EXE_EXTENSION}
>> 
>> --------------------------------------ERROR MESSAGE----------------------
>> 
>> Scanning dependencies of target itkpng
>> [ 17%] Building C object Utilities/itkpng/CMakeFiles/itkpng.dir/pngget.o
>> [ 17%] Building C object Utilities/itkpng/CMakeFiles/itkpng.dir/pngrio.o
>> [ 17%] Building C object Utilities/itkpng/CMakeFiles/itkpng.dir/pngwrite.o
>> [ 17%] Building C object Utilities/itkpng/CMakeFiles/itkpng.dir/png.o
>> [ 17%] Building C object Utilities/itkpng/CMakeFiles/itkpng.dir/pngmem.o
>> [ 17%] Building C object Utilities/itkpng/CMakeFiles/itkpng.dir/pngrtran.o
>> [ 18%] Building C object Utilities/itkpng/CMakeFiles/itkpng.dir/pngtrans.o
>> [ 18%] Building C object Utilities/itkpng/CMakeFiles/itkpng.dir/pngwtran.o
>> [ 18%] Building C object Utilities/itkpng/CMakeFiles/itkpng.dir/pngerror.o
>> [ 18%] Building C object Utilities/itkpng/CMakeFiles/itkpng.dir/pngpread.o
>> [ 18%] Building C object Utilities/itkpng/CMakeFiles/itkpng.dir/pngrutil.o
>> [ 18%] Building C object Utilities/itkpng/CMakeFiles/itkpng.dir/pngwutil.o
>> [ 18%] Building C object Utilities/itkpng/CMakeFiles/itkpng.dir/pngread.o
>> [ 18%] Building C object Utilities/itkpng/CMakeFiles/itkpng.dir/pngset.o
>> [ 18%] Building C object Utilities/itkpng/CMakeFiles/itkpng.dir/pngwio.o
>> Linking C static library libitkpng.a
>> [ 18%] Built target itkpng
>> Scanning dependencies of target itkmkg3states
>> [ 18%] Building C object
>> Utilities/itktiff/CMakeFiles/itkmkg3states.dir/mkg3states.o
>> Linking C executable itkmkg3states
>> [ 18%] Built target itkmkg3states
>> [ 18%] Generating tif_fax3sm.c
>> /bin/sh: ../../bin/itkmkg3states: No such file or directory
>> make[5]: *** [Utilities/itktiff/tif_fax3sm.c] Error 127
>> make[4]: *** [Utilities/itktiff/CMakeFiles/itktiff.dir/all] Error 2
>> make[3]: *** [all] Error 2
>> make[2]: *** [ITK-prefix/src/ITK-stamp/ITK-build] Error 2
>> make[1]: *** [CMakeFiles/ITK.dir/all] Error 2
>> make: *** [all] Error 2
>> 
>> 
>> ----------------CMakeLists.txt---------------------------------
>> 
>> project(build_itk_external)
>> cmake_policy(VERSION 2.8)
>> include(ExternalProject)
>> 
>> SET(LOCAL_CMAKE_BUILD_OPTIONS
>>   -DMAKECOMMAND:STRING=${MAKECOMMAND}
>>   -DCMAKE_SKIP_RPATH:BOOL=ON
>>   -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
>>   -DCMAKE_CXX_FLAGS_RELEASE:STRING=${CMAKE_CXX_FLAGS_RELEASE}
>>   -DCMAKE_CXX_FLAGS_DEBUG:STRING=${CMAKE_CXX_FLAGS_DEBUG}
>>   -DCMAKE_CXX_FLAGS:STRING=${CMAKE_CXX_FLAGS}
>>   -DCMAKE_C_FLAGS_RELEASE:STRING=${CMAKE_C_FLAGS_RELEASE}
>>   -DCMAKE_C_FLAGS_DEBUG:STRING=${CMAKE_C_FLAGS_DEBUG}
>>   -DCMAKE_C_FLAGS:STRING=${CMAKE_C_FLAGS}
>>   -DBUILD_EXAMPLES:BOOL=OFF
>>   -DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS}
>>   -DBUILD_TESTING:BOOL=OFF
>>   -DCMAKE_GENERATOR:STRING=${CMAKE_GENERATOR}
>>   -DCMAKE_EXTRA_GENERATOR:STRING=${CMAKE_EXTRA_GENERATOR}
>>   -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX}
>>   -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
>>   -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}
>>   -DCMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
>>   -DCMAKE_BUNDLE_OUTPUT_DIRECTORY:PATH=${CMAKE_BUNDLE_OUTPUT_DIRECTORY}
>>   -DDART_TESTING_TIMEOUT:STRING=${DART_TESTING_TIMEOUT}
>>   -DMEMORYCHECK_COMMAND_OPTIONS:STRING=${MEMORYCHECK_COMMAND_OPTIONS}
>>   -DMEMORYCHECK_COMMAND:PATH=${MEMORYCHECK_COMMAND}
>>   -DCMAKE_SHARED_LINKER_FLAGS:STRING=${CMAKE_SHARED_LINKER_FLAGS}
>>   -DCMAKE_EXE_LINKER_FLAGS:STRING=${CMAKE_EXE_LINKER_FLAGS}
>>   -DCMAKE_MODULE_LINKER_FLAGS:STRING=${CMAKE_MODULE_LINKER_FLAGS}
>>   -DSITE:STRING=${SITE}
>>   -DBUILDNAME:STRING=${BUILDNAME}
>>   ${QT_CMAKE_FLAGS}
>> )
>> #
>> # build ITK
>> set(ITK_DEPEND ITK)
>> set(proj ITK)
>> ExternalProject_add(${proj}
>> CVS_REPOSITORY ":pserver:anoncvs at www.vtk.org:/cvsroot/Insight"
>> CVS_TAG -r ITK-3-16
>> CVS_MODULE "Insight"
>> CMAKE_ARGS ${LOCAL_CMAKE_BUILD_OPTIONS}
>> INSTALL_DIR ${CMAKE_INSTALL_PREFIX}
>> UPDATE_COMMAND ""
>> )
>> 
>> 
>> 
>> _______________________________________________
>> Powered by www.kitware.com <http://www.kitware.com>
>> 
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>> 
>> Kitware offers ITK Training Courses, for more information visit:
>> http://kitware.com/products/protraining.html
>> 
>> Please keep messages on-topic and check the ITK FAQ at:
>> http://www.itk.org/Wiki/ITK_FAQ
>> 
>> Follow this link to subscribe/unsubscribe:
>> http://www.itk.org/mailman/listinfo/insight-developers
> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20100414/460cf3ca/attachment.htm>


More information about the Insight-developers mailing list