Patch provided by the kitware team on Aug 5th (Brad King and Bill Hoffman)
[platform/upstream/lapack.git] / CMakeLists.txt
1 cmake_minimum_required(VERSION 2.6)
2 project(LAPACK Fortran)
3 if (UNIX)
4    if ( "${CMAKE_Fortran_COMPILER}" MATCHES "ifort" )
5   set( CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fltconsistency -fp_port" )
6    endif ()
7 endif ()
8
9 macro(lapack_install_library lib)
10   install(TARGETS ${lib} EXPORT lapack-targets
11     ARCHIVE DESTINATION lib
12     LIBRARY DESTINATION lib
13     RUNTIME DESTINATION bin
14     )
15 endmacro()
16
17 # --------------------------------------------------
18 # Testing
19
20 enable_testing()
21 include(CTest)
22 enable_testing()
23 # --------------------------------------------------
24
25 set(CMAKE_MODULE_PATH ${LAPACK_SOURCE_DIR} ${CMAKE_MODULE_PATH})
26
27 # --------------------------------------------------
28 # Check second function
29
30 include(CheckTimeFunction)
31 set(TIME_FUNC NONE ${TIME_FUNC})
32 CHECK_TIME_FUNCTION(NONE TIME_FUNC)
33 CHECK_TIME_FUNCTION(INT_CPU_TIME TIME_FUNC)
34 CHECK_TIME_FUNCTION(EXT_ETIME TIME_FUNC)
35 CHECK_TIME_FUNCTION(EXT_ETIME_ TIME_FUNC)
36 CHECK_TIME_FUNCTION(INT_ETIME TIME_FUNC)
37 message(STATUS "--> Will use second_${TIME_FUNC}.f and dsecnd_${TIME_FUNC}.f as timing function.")
38
39 set(SECOND_SRC  ${LAPACK_SOURCE_DIR}/INSTALL/second_${TIME_FUNC}.f)
40 set(DSECOND_SRC  ${LAPACK_SOURCE_DIR}/INSTALL/dsecnd_${TIME_FUNC}.f)
41
42 # --------------------------------------------------
43 # Subdirectories that need to be processed
44
45 add_subdirectory(BLAS)
46 add_subdirectory(SRC)
47 add_subdirectory(TESTING)
48
49 # --------------------------------------------------
50 # CPACK Packaging 
51
52 SET(CPACK_PACKAGE_NAME "LAPACK")
53 SET(CPACK_PACKAGE_VENDOR "University of Tennessee, Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd")
54 SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "LAPACK- Linear Algebra Package")
55 set(LAPACK_VERSION 3.2.2)
56 set(CPACK_PACKAGE_VERSION_MAJOR 3)
57 set(CPACK_PACKAGE_VERSION_MINOR 2)
58 set(CPACK_PACKAGE_VERSION_PATCH 2)
59 set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
60 SET(CPACK_PACKAGE_INSTALL_DIRECTORY "LAPACK")
61 IF(WIN32 AND NOT UNIX)
62   # There is a bug in NSI that does not handle full unix paths properly. Make
63   # sure there is at least one set of four (4) backlasshes.
64   SET(CPACK_NSIS_HELP_LINK "http:\\\\\\\\http://icl.cs.utk.edu/lapack-forum")
65   SET(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\www.netlib.org/lapack")
66   SET(CPACK_NSIS_CONTACT "lapack@eecs.utk.edu")
67   SET(CPACK_NSIS_MODIFY_PATH ON)
68   SET(CPACK_NSIS_DISPLAY_NAME "LAPACK-${LAPACK_VERSION}")
69   set(CPACK_PACKAGE_RELOCATABLE "true")
70 ELSE(WIN32 AND NOT UNIX)
71   SET(CPACK_GENERATOR "TGZ")
72   SET(CPACK_SOURCE_GENERATOR TGZ)
73   SET(CPACK_SOURCE_PACKAGE_FILE_NAME "lapack-${LAPACK_VERSION}" )
74   SET(CPACK_SOURCE_IGNORE_FILES ~$ .svn ${CPACK_SOURCE_IGNORE_FILES} )
75 ENDIF(WIN32 AND NOT UNIX)
76 INCLUDE(CPack)
77
78
79 # --------------------------------------------------
80 # By default static library
81 OPTION(BUILD_SHARED_LIBS "Build shared libraries" OFF )
82 #OPTION(BUILD_SHARED_LIBS "Build shared libraries" ON )
83
84 export(TARGETS blas lapack FILE lapack-targets.cmake)
85 configure_file(${LAPACK_SOURCE_DIR}/lapack-config-version.cmake.in
86   ${LAPACK_BINARY_DIR}/lapack-config-version.cmake @ONLY)
87 configure_file(${LAPACK_SOURCE_DIR}/lapack-config.cmake.in
88   ${LAPACK_BINARY_DIR}/lapack-config.cmake @ONLY)
89
90 configure_file(${LAPACK_SOURCE_DIR}/lapack-config-install.cmake.in
91   ${LAPACK_BINARY_DIR}/CMakeFiles/lapack-config.cmake @ONLY)
92 install(FILES
93   ${LAPACK_BINARY_DIR}/CMakeFiles/lapack-config.cmake
94   ${LAPACK_BINARY_DIR}/lapack-config-version.cmake
95   DESTINATION lib/cmake/lapack-${LAPACK_VERSION}
96   )
97 install(EXPORT lapack-targets
98   DESTINATION lib/cmake/lapack-${LAPACK_VERSION})