Use try_compile to look for the timing routine
authorjulie <julielangou@users.noreply.github.com>
Wed, 12 Aug 2009 19:36:19 +0000 (19:36 +0000)
committerjulie <julielangou@users.noreply.github.com>
Wed, 12 Aug 2009 19:36:19 +0000 (19:36 +0000)
CMakeLists.txt
CheckTimeFunction.cmake
INSTALL/CMakeLists.txt [new file with mode: 0644]
cmake_install.cmake [deleted file]

index c71473b0ccdab31bd1ecb94a03454e2838a1caa5..ab31134acb4cf6e6fac7b7a22f6d4a2d3710fda8 100644 (file)
@@ -1,13 +1,15 @@
 cmake_minimum_required(VERSION 2.6)
 project(LAPACK Fortran)
-set(SECOND_SRC  ${LAPACK_SOURCE_DIR}/INSTALL/second_INT_ETIME.f)
-set(DSECOND_SRC  ${LAPACK_SOURCE_DIR}/INSTALL/dsecnd_INT_ETIME.f)
+if ( "${CMAKE_Fortran_COMPILER}" MATCHES "ifort" )
+  set( CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fltconsistency -fp_port" )
+endif ()
 enable_testing()
 include(CTest)
 enable_testing()
 set(CMAKE_MODULE_PATH ${LAPACK_SOURCE_DIR} ${CMAKE_MODULE_PATH})
 include(CheckTimeFunction)
 set(TIME_FUNC NONE ${TIME_FUNC})
+CHECK_TIME_FUNCTION(NONE TIME_FUNC)
 CHECK_TIME_FUNCTION(INT_CPU_TIME TIME_FUNC)
 CHECK_TIME_FUNCTION(EXT_ETIME TIME_FUNC)
 CHECK_TIME_FUNCTION(EXT_ETIME_ TIME_FUNC)
@@ -17,7 +19,6 @@ message(STATUS "--> Will use second_${TIME_FUNC}.f and dsecnd_${TIME_FUNC}.f as
 set(SECOND_SRC  ${LAPACK_SOURCE_DIR}/INSTALL/second_${TIME_FUNC}.f)
 set(DSECOND_SRC  ${LAPACK_SOURCE_DIR}/INSTALL/dsecnd_${TIME_FUNC}.f)
 
-
 add_subdirectory(BLAS)
 add_subdirectory(SRC)
 add_subdirectory(TESTING)
index 22d73b27bbe5a1fc0624119eb1d970608b90ecf7..ba7e6e86952a65d079f464cde3ac233766d4374e 100644 (file)
@@ -7,21 +7,22 @@
 
 macro(CHECK_TIME_FUNCTION FUNCTION VARIABLE)
 
-    execute_process(COMMAND ${CMAKE_Fortran_COMPILER} -o secondtst second_${FUNCTION}.f secondtst.f
-    WORKING_DIRECTORY ${LAPACK_SOURCE_DIR}/INSTALL
-    RESULT_VARIABLE RES
-    OUTPUT_VARIABLE OUT
-    ERROR_VARIABLE  ERR
-    )
+    try_compile(${VARIABLE}
+    ${PROJECT_BINARY_DIR}/INSTALL
+    ${PROJECT_SOURCE_DIR}/INSTALL
+    TIMING secondtst_${FUNCTION}
+    OUTPUT_VARIABLE OUTPUT)
 
-    if(${RES} EQUAL 0)
+    if(${VARIABLE})
       set(${VARIABLE} ${FUNCTION} CACHE INTERNAL "Have Fortran function ${FUNCTION}")
       message(STATUS "Looking for Fortran ${FUNCTION} - found")
       file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log 
-        "Fortran ${FUNCTION} exists. ${OUT} \n\n")
-    else(${RES} EQUAL 0)
+        "Fortran ${FUNCTION} exists. ${OUTPUT} \n\n")
+    else(${VARIABLE})
       message(STATUS "Looking for Fortran ${FUNCTION} - not found")
       file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log 
-        "Fortran ${FUNCTION} does not exist. \n ${ERR} \n")
-    endif(${RES} EQUAL 0)
+        "Fortran ${FUNCTION} does not exist. \n ${OUTPUT} \n")
+    endif(${VARIABLE})
 endmacro(CHECK_TIME_FUNCTION)
+
+
diff --git a/INSTALL/CMakeLists.txt b/INSTALL/CMakeLists.txt
new file mode 100644 (file)
index 0000000..a1a457d
--- /dev/null
@@ -0,0 +1,7 @@
+cmake_minimum_required(VERSION 2.6)
+project(TIMING Fortran)
+add_executable(secondtst_NONE second_NONE.f secondtst.f)
+add_executable(secondtst_EXT_ETIME second_EXT_ETIME.f secondtst.f)
+add_executable(secondtst_EXT_ETIME_ second_EXT_ETIME_.f secondtst.f)
+add_executable(secondtst_INT_ETIME second_INT_ETIME.f secondtst.f)
+add_executable(secondtst_INT_CPU_TIME second_INT_CPU_TIME.f secondtst.f)
diff --git a/cmake_install.cmake b/cmake_install.cmake
deleted file mode 100644 (file)
index 0317b84..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-# Install script for directory: /Users/julie/Documents/Boulot/lapack-dev/lapack/trunk
-
-# Set the install prefix
-IF(NOT DEFINED CMAKE_INSTALL_PREFIX)
-  SET(CMAKE_INSTALL_PREFIX "/usr/local")
-ENDIF(NOT DEFINED CMAKE_INSTALL_PREFIX)
-STRING(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
-
-# Set the install configuration name.
-IF(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)
-  IF(BUILD_TYPE)
-    STRING(REGEX REPLACE "^[^A-Za-z0-9_]+" ""
-           CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}")
-  ELSE(BUILD_TYPE)
-    SET(CMAKE_INSTALL_CONFIG_NAME "")
-  ENDIF(BUILD_TYPE)
-  MESSAGE(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"")
-ENDIF(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)
-
-# Set the component getting installed.
-IF(NOT CMAKE_INSTALL_COMPONENT)
-  IF(COMPONENT)
-    MESSAGE(STATUS "Install component: \"${COMPONENT}\"")
-    SET(CMAKE_INSTALL_COMPONENT "${COMPONENT}")
-  ELSE(COMPONENT)
-    SET(CMAKE_INSTALL_COMPONENT)
-  ENDIF(COMPONENT)
-ENDIF(NOT CMAKE_INSTALL_COMPONENT)
-
-IF(CMAKE_INSTALL_COMPONENT)
-  SET(CMAKE_INSTALL_MANIFEST "install_manifest_${CMAKE_INSTALL_COMPONENT}.txt")
-ELSE(CMAKE_INSTALL_COMPONENT)
-  SET(CMAKE_INSTALL_MANIFEST "install_manifest.txt")
-ENDIF(CMAKE_INSTALL_COMPONENT)
-
-FILE(WRITE "/Users/julie/Documents/Boulot/lapack-dev/lapack/trunk/${CMAKE_INSTALL_MANIFEST}" "")
-FOREACH(file ${CMAKE_INSTALL_MANIFEST_FILES})
-  FILE(APPEND "/Users/julie/Documents/Boulot/lapack-dev/lapack/trunk/${CMAKE_INSTALL_MANIFEST}" "${file}\n")
-ENDFOREACH(file)