cmake to download and compile fftw library

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

cmake to download and compile fftw library

aishwarya selvaraj
Hi all,
I have written the below cmakelist.txt .



CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
PROJECT(PROSE)
################################################################

include(ExternalProject)
MESSAGE(STATUS "Trying to install fftw...")

ExternalProject_Add(project_fftw
  #GIT_REPOSITORY  https://github.com/FFTW/fftw3
  PREFIX ${CMAKE_CURRENT_BINARY_DIR}/fftw
  CONFIGURE_COMMAND ""
    #--Build step-----------------
  BUILD_COMMAND ""
    #--Install step---------------
  UPDATE_COMMAND "" # Skip annoying updates for every build
  INSTALL_COMMAND ""
 )

ADD_LIBRARY(fftw INTERFACE) 


TARGET_INCLUDE_DIRECTORIES(fftw INTERFACE "${install_dir}/src/project_fftw/api/")    

​ADD_EXECUTABLE(prose ${PROJECT_SOURCE_DIR}/src/read.cpp)
TARGET_LINK_LIBRARIES(prose fftw  )


​But when I run it in cygwin (windows) I get the following error:
Scanning dependencies of target prose
[ 94%] Building CXX object CMakeFiles/prose.dir/src/read.cpp.o
/home/computing7/prose/src/read.cpp:17:19: fatal error: fftw3.h: No such file or                                         directory
compilation terminated.
make[2]: *** [CMakeFiles/prose.dir/build.make:63: CMakeFiles/prose.dir/src/read.                                        cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:142: CMakeFiles/prose.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
​Could anyone please tell me on how to solve this problem .​

--
Regards,
Aishwarya Selvaraj

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: cmake to download and compile fftw library

Jorge Perez
Hi, here you have a working example for your requirement. Attached also a zip file to test.

CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
PROJECT(PROSE)
################################################################

include(ExternalProject)

MESSAGE(STATUS "Trying to install fftw...")

ExternalProject_Add(project_fftw
  #GIT_REPOSITORY  https://github.com/FFTW/fftw3
  PREFIX ${CMAKE_CURRENT_BINARY_DIR}/fftw
  CONFIGURE_COMMAND ${CMAKE_CURRENT_BINARY_DIR}/fftw/src/project_fftw/configure --prefix=${CMAKE_CURRENT_BINARY_DIR}/fftw/install
  INSTALL_DIR ${CMAKE_CURRENT_BINARY_DIR}/fftw/install
  )

add_library(fftw STATIC IMPORTED)
set(lib_fftw_name ${CMAKE_STATIC_LIBRARY_PREFIX}fftw3${CMAKE_STATIC_LIBRARY_SUFFIX})
set_target_properties(fftw PROPERTIES IMPORTED_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/fftw/install/lib/${lib_fftw_name})

INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/fftw/install/include)    

add_executable(prose src/read.cpp)
add_dependencies(prose project_fftw)

TARGET_LINK_LIBRARIES(prose fftw)

HTH

Jorge


2017-05-19 7:06 GMT+02:00 aishwarya selvaraj <[hidden email]>:
Hi all,
I have written the below cmakelist.txt .



CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
PROJECT(PROSE)
################################################################

include(ExternalProject)
MESSAGE(STATUS "Trying to install fftw...")

ExternalProject_Add(project_fftw
  #GIT_REPOSITORY  https://github.com/FFTW/fftw3
  PREFIX ${CMAKE_CURRENT_BINARY_DIR}/fftw
  CONFIGURE_COMMAND ""
    #--Build step-----------------
  BUILD_COMMAND ""
    #--Install step---------------
  UPDATE_COMMAND "" # Skip annoying updates for every build
  INSTALL_COMMAND ""
 )

ADD_LIBRARY(fftw INTERFACE) 


TARGET_INCLUDE_DIRECTORIES(fftw INTERFACE "${install_dir}/src/project_fftw/api/")    

​ADD_EXECUTABLE(prose ${PROJECT_SOURCE_DIR}/src/read.cpp)
TARGET_LINK_LIBRARIES(prose fftw  )


​But when I run it in cygwin (windows) I get the following error:
Scanning dependencies of target prose
[ 94%] Building CXX object CMakeFiles/prose.dir/src/read.cpp.o
/home/computing7/prose/src/read.cpp:17:19: fatal error: fftw3.h: No such file or                                         directory
compilation terminated.
make[2]: *** [CMakeFiles/prose.dir/build.make:63: CMakeFiles/prose.dir/src/read.                                        cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:142: CMakeFiles/prose.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
​Could anyone please tell me on how to solve this problem .​

--
Regards,
Aishwarya Selvaraj

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake


--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

fftw_imported.zip (1K) Download Attachment