[Insight-developers] FFTW as an external project?
kent williams
norman-k-williams at uiowa.edu
Fri Dec 17 12:12:03 EST 2010
1. I don't know what this would do:
install(DIRECTORY ${CMAKE_BINARY_DIR}/FFTW DESTINATION .)
but I suspect it wouldn't be good.
${CMAKE_BINARY_DIR}/FFTW is the ExternalProject prefix, meaning it contains
the source, build directory, install dirs (lib,include), and
ExternalProject's overhead (stamp directory, the downloaded tar file).
It's definitely the case that we want to cherry-pick just the files from the
include and lib directories.
2. INSTALL(CODE) is a possibility; or INSTALL(SCRIPT) since I'm punting on
Windows by requiring an external FFTW installation.
3. Is there a CMake variable/variables to get the system-appropriate
extensions for libraries?
On 12/17/10 10:52 AM, "Brad King" <brad.king at kitware.com> wrote:
> On 12/17/2010 11:39 AM, kent williams wrote:
>> Not sure on how to do the install step CMake-wise. would this be
>> sufficient?
>>
>> install(FILES ${CMAKE_BINARY_DIR}/FFTW/lib/libfftw3.a
>> DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
>> install(FILES ${CMAKE_BINARY_DIR}/FFTW/include/fftw3.h
>> DESTINATION ${CMAKE_INSTALL_PREFIX}/include)
>
> Something like this might work:
>
> install(DIRECTORY ${CMAKE_BINARY_DIR}/FFTW DESTINATION .)
>
> but it will install stale files from that directory if any
> exist.
>
> A better approach might be to invoke the FFTW installation
> during the ITK installation by using install(SCRIPT) or
> install(CODE) to add code to the ITK installation that
> includes cmake_install.cmake from the top of the FFTW
> build tree.
>
>> 2. I don't know how to make the Algorithms library depend on the FFTW
>> external project. If I do a sequential build, FFTW does get built before
>> everything else, but if I do a parallel build, FFTW builds concurrent with
>> the rest of ITK. This could definitely fail.
>
> add_dependencies(ITKAlgorithms FFTW)
>
> You should also consider bringing libfftw3 in as an imported
> target:
>
> add_external_project(FFTW ...)
> add_library(fftw3 STATIC IMPORTED)
> set_property(TARGET fftw3 PROPERTY
> IMPORTED_LOCATION
> ${CMAKE_BINARY_DIR}/FFTW/lib/${CMAKE_STATIC_LIBRARY_PREFIX}fft23${CMAKE_STATIC
> _LIBRARY_SUFFIX}
> )
>
> Then you can write just
>
> target_link_libraries(ITKAlgorithms fftw3)
>
> With (the future) CMake 2.8.4 you will also be able to do
>
> add_dependencies(fftw3 FFTW)
>
> so that anything that links to the library automatically depends
> on the FFTW external project target.
>
> -Brad
More information about the Insight-developers
mailing list