[Cmake-commits] CMake branch, next, updated. v2.8.6-2236-g950c9c1

Brad King brad.king at kitware.com
Thu Dec 15 11:43:29 EST 2011


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  950c9c1d7522120f33ba3b28683f009a3b317602 (commit)
       via  b03ac6d0cf1d2f18fa634a1f495b3a8f863b8c48 (commit)
       via  e19be21f620de693a56519a343b51139b704422d (commit)
       via  bf5e1908376ebd13eec1a8cb7352f786f46c0ec5 (commit)
       via  a1c71baae06717d17ad8fb7e4bd545a0cd7fb026 (commit)
       via  490b750c80bda9694f1802aa50bd92f85d940baf (commit)
      from  35cb1ce43316532bb4c358e9705fd44d89e7a8ac (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=950c9c1d7522120f33ba3b28683f009a3b317602
commit 950c9c1d7522120f33ba3b28683f009a3b317602
Merge: 35cb1ce b03ac6d
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu Dec 15 11:43:27 2011 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Thu Dec 15 11:43:27 2011 -0500

    Merge topic 'cmake_add_fortran_subdirectory' into next
    
    b03ac6d cmake_add_fortran_subdirectory: Validate gfortran architecture
    e19be21 cmake_add_fortran_subdirectory: Find gfortran in PATH
    bf5e190 cmake_add_fortran_subdirectory: Do not hard-code 'lapack'
    a1c71ba cmake_add_fortran_subdirectory: Fix documentation format and typos
    490b750 cmake_add_fortran_subdirectory: Allow full paths to directories


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b03ac6d0cf1d2f18fa634a1f495b3a8f863b8c48
commit b03ac6d0cf1d2f18fa634a1f495b3a8f863b8c48
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu Dec 15 11:39:42 2011 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu Dec 15 11:42:11 2011 -0500

    cmake_add_fortran_subdirectory: Validate gfortran architecture
    
    Verify that MINGW_GFORTRAN not only points to a MinGW gfortran but also
    one that compiles for the target architecture.  This prevents using a
    32-bit gfortran in a 64-bit MSVC build.

diff --git a/Modules/CMakeAddFortranSubdirectory.cmake b/Modules/CMakeAddFortranSubdirectory.cmake
index 7116d96..ac40efd 100644
--- a/Modules/CMakeAddFortranSubdirectory.cmake
+++ b/Modules/CMakeAddFortranSubdirectory.cmake
@@ -57,12 +57,28 @@ function(_setup_mingw_config_and_build source_dir)
       "Or set the cache variable MINGW_GFORTRAN to the full path. "
       " This is required to build")
   endif()
-  execute_process(COMMAND ${MINGW_GFORTRAN} -v ERROR_VARIABLE out)
-  if(NOT "${out}" MATCHES "Target:.*mingw32")
-    message(FATAL_ERROR "Non-MinGW gfortran found: ${MINGW_GFORTRAN}\n"
-      "output from -v [${out}]\n"
-      "set MINGW_GFORTRAN to the path to MinGW fortran.")
+
+  # Validate the MinGW gfortran we found.
+  if(CMAKE_SIZEOF_VOID_P EQUAL 8)
+    set(_mingw_target "Target:.*64.*mingw")
+  else()
+    set(_mingw_target "Target:.*mingw32")
   endif()
+  execute_process(COMMAND "${MINGW_GFORTRAN}" -v
+    ERROR_VARIABLE out ERROR_STRIP_TRAILING_WHITESPACE)
+  if(NOT "${out}" MATCHES "${_mingw_target}")
+    string(REPLACE "\n" "\n  " out "  ${out}")
+    message(FATAL_ERROR
+      "MINGW_GFORTRAN is set to\n"
+      "  ${MINGW_GFORTRAN}\n"
+      "which is not a MinGW gfortran for this architecture.  "
+      "The output from -v does not match \"${_mingw_target}\":\n"
+      "${out}\n"
+      "Set MINGW_GFORTRAN to a proper MinGW gfortran for this architecture."
+      )
+  endif()
+
+  # Configure scripts to run MinGW tools with the proper PATH.
   get_filename_component(MINGW_PATH ${MINGW_GFORTRAN} PATH)
   file(TO_NATIVE_PATH "${MINGW_PATH}" MINGW_PATH)
   string(REPLACE "\\" "\\\\" MINGW_PATH "${MINGW_PATH}")

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e19be21f620de693a56519a343b51139b704422d
commit e19be21f620de693a56519a343b51139b704422d
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu Dec 15 10:50:55 2011 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu Dec 15 11:41:59 2011 -0500

    cmake_add_fortran_subdirectory: Find gfortran in PATH
    
    In the find_program(MINGW_GFORTRAN) call use the PATHS option for
    hard-coded guesses instead of HINTS.  This allows the user environment
    to override the guesses and corrects usage of the command options.

diff --git a/Modules/CMakeAddFortranSubdirectory.cmake b/Modules/CMakeAddFortranSubdirectory.cmake
index e7c23b2..7116d96 100644
--- a/Modules/CMakeAddFortranSubdirectory.cmake
+++ b/Modules/CMakeAddFortranSubdirectory.cmake
@@ -44,10 +44,13 @@ include(ExternalProject)
 include(CMakeParseArguments)
 
 function(_setup_mingw_config_and_build source_dir)
-  find_program(MINGW_GFORTRAN NAMES gfortran
-    HINTS
-    c:/MinGW/bin
-    "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\MinGW;InstallLocation]/bin" )
+  # Look for a MinGW gfortran.
+  find_program(MINGW_GFORTRAN
+    NAMES gfortran
+    PATHS
+      c:/MinGW/bin
+      "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\MinGW;InstallLocation]/bin"
+    )
   if(NOT MINGW_GFORTRAN)
     message(FATAL_ERROR
       "gfortran not found, please install MinGW with the gfortran option."

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=bf5e1908376ebd13eec1a8cb7352f786f46c0ec5
commit bf5e1908376ebd13eec1a8cb7352f786f46c0ec5
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu Dec 15 10:50:00 2011 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu Dec 15 10:51:57 2011 -0500

    cmake_add_fortran_subdirectory: Do not hard-code 'lapack'
    
    Use the ${project_name} instead.

diff --git a/Modules/CMakeAddFortranSubdirectory.cmake b/Modules/CMakeAddFortranSubdirectory.cmake
index 919429f..e7c23b2 100644
--- a/Modules/CMakeAddFortranSubdirectory.cmake
+++ b/Modules/CMakeAddFortranSubdirectory.cmake
@@ -120,7 +120,7 @@ function(cmake_add_fortran_subdirectory subdir)
   externalproject_add_step(${project_name}_build forcebuild
     COMMAND ${CMAKE_COMMAND}
     -E remove
-    ${CMAKE_CURRENT_BUILD_DIR}/${project_name}-prefix/src/${project_name}-stamp/lapack-build
+    ${CMAKE_CURRENT_BUILD_DIR}/${project_name}-prefix/src/${project_name}-stamp/${project_name}-build
     DEPENDEES configure
     DEPENDERS build
     ALWAYS 1

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a1c71baae06717d17ad8fb7e4bd545a0cd7fb026
commit a1c71baae06717d17ad8fb7e4bd545a0cd7fb026
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu Dec 15 10:48:33 2011 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu Dec 15 10:51:46 2011 -0500

    cmake_add_fortran_subdirectory: Fix documentation format and typos
    
    Indent the function signature correctly.  Fix some typos.  Fix the
    copyright year.

diff --git a/Modules/CMakeAddFortranSubdirectory.cmake b/Modules/CMakeAddFortranSubdirectory.cmake
index c206d79..919429f 100644
--- a/Modules/CMakeAddFortranSubdirectory.cmake
+++ b/Modules/CMakeAddFortranSubdirectory.cmake
@@ -7,27 +7,25 @@
 # an external project to build with the MinGW tools.  It will also
 # create imported targets for the libraries created.  This will only
 # work if the fortran code is built into a dll, so BUILD_SHARED_LIBS
-# is turned on in the project.  In addition the GNUtoMS option is set
-# to on, so that the MS .lib files are created.
+# is turned on in the project.  In addition the CMAKE_GNUtoMS option
+# is set to on, so that the MS .lib files are created.
 # Usage is as follows:
-# cmake_add_fortran_subdirectory(
-#   <subdir>                 # name of subdirectory
-#    PROJECT <project_name>  # project name in sbudir toplevel CMakeLists.txt
-#  ARCHIVE_DIR <dir>         # dir where project places .lib files
-#  RUNTIME_DIR <dir>         # dir where project places .dll files
-#  LIBRARIES lib2 lib2    # names of libraries created and exported
-#  LINK_LIBRARIES            # link interface libraries for LIBRARIES
-#   LINK_LIBS <lib1>  <dep1> <dep2> ... <depN>
-#   LINK_LIBS <lib2> <dep1> <dep2> ... <depN>
-#  CMAKE_COMMAND_LINE        # extra command line flags to pass to cmake
+#  cmake_add_fortran_subdirectory(
+#   <subdir>                # name of subdirectory
+#   PROJECT <project_name>  # project name in subdir top CMakeLists.txt
+#   ARCHIVE_DIR <dir>       # dir where project places .lib files
+#   RUNTIME_DIR <dir>       # dir where project places .dll files
+#   LIBRARIES <lib>...      # names of library targets to import
+#   LINK_LIBRARIES          # link interface libraries for LIBRARIES
+#    [LINK_LIBS <lib> <dep>...]...
+#   CMAKE_COMMAND_LINE ...  # extra command line flags to pass to cmake
 #   )
 # Relative paths in ARCHIVE_DIR and RUNTIME_DIR are interpreted with respect
 # to the build directory corresponding to the source directory in which the
 # function is invoked.
-#
 
 #=============================================================================
-# Copyright 2002-2009 Kitware, Inc.
+# Copyright 2011 Kitware, Inc.
 #
 # Distributed under the OSI-approved BSD License (the "License");
 # see accompanying file Copyright.txt for details.

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=490b750c80bda9694f1802aa50bd92f85d940baf
commit 490b750c80bda9694f1802aa50bd92f85d940baf
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu Dec 15 10:19:46 2011 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu Dec 15 10:51:26 2011 -0500

    cmake_add_fortran_subdirectory: Allow full paths to directories
    
    Fix the implementation to allow full paths with spaces.  Change the
    interpretation of relative paths to be with respect to the current binary
    directory.  This matches the convention used in ExternalProject.  Test
    both full and relative paths in the VSGNUFortran test.

diff --git a/Modules/CMakeAddFortranSubdirectory.cmake b/Modules/CMakeAddFortranSubdirectory.cmake
index 99f1ffe..c206d79 100644
--- a/Modules/CMakeAddFortranSubdirectory.cmake
+++ b/Modules/CMakeAddFortranSubdirectory.cmake
@@ -13,14 +13,17 @@
 # cmake_add_fortran_subdirectory(
 #   <subdir>                 # name of subdirectory
 #    PROJECT <project_name>  # project name in sbudir toplevel CMakeLists.txt
-#  ARCHIVE_DIR <dir>         # .lib location relative to root binary tree (lib)
-#  RUNTIME_DIR <dir>         # .dll location relative to root binary tree (bin)
+#  ARCHIVE_DIR <dir>         # dir where project places .lib files
+#  RUNTIME_DIR <dir>         # dir where project places .dll files
 #  LIBRARIES lib2 lib2    # names of libraries created and exported
 #  LINK_LIBRARIES            # link interface libraries for LIBRARIES
 #   LINK_LIBS <lib1>  <dep1> <dep2> ... <depN>
 #   LINK_LIBS <lib2> <dep1> <dep2> ... <depN>
 #  CMAKE_COMMAND_LINE        # extra command line flags to pass to cmake
 #   )
+# Relative paths in ARCHIVE_DIR and RUNTIME_DIR are interpreted with respect
+# to the build directory corresponding to the source directory in which the
+# function is invoked.
 #
 
 #=============================================================================
@@ -97,6 +100,12 @@ function(cmake_add_fortran_subdirectory subdir)
   set(libraries ${ARGS_LIBRARIES})
   # use the same directory that add_subdirectory would have used
   set(build_dir "${CMAKE_CURRENT_BINARY_DIR}/${subdir}")
+  foreach(dir_var library_dir binary_dir)
+    if(NOT IS_ABSOLUTE "${${dir_var}}")
+      get_filename_component(${dir_var}
+        "${CMAKE_CURRENT_BINARY_DIR}/${${dir_var}}" ABSOLUTE)
+    endif()
+  endforeach()
   # create build and configure wrapper scripts
   _setup_mingw_config_and_build(${source_dir})
   # create the external project
@@ -123,10 +132,8 @@ function(cmake_add_fortran_subdirectory subdir)
     add_library(${lib} SHARED IMPORTED)
     set_property(TARGET ${lib} APPEND PROPERTY IMPORTED_CONFIGURATIONS NOCONFIG)
     set_target_properties(${lib} PROPERTIES
-      IMPORTED_IMPLIB_NOCONFIG
-      "${build_dir}/${library_dir}/lib${lib}.lib"
-      IMPORTED_LOCATION_NOCONFIG
-      "${build_dir}/${binary_dir}/lib${lib}.dll"
+      IMPORTED_IMPLIB_NOCONFIG   "${library_dir}/lib${lib}.lib"
+      IMPORTED_LOCATION_NOCONFIG "${binary_dir}/lib${lib}.dll"
       )
     add_dependencies(${lib} ${project_name}_build)
   endforeach()
diff --git a/Modules/config_mingw.cmake.in b/Modules/config_mingw.cmake.in
index 96141da..97f6769 100644
--- a/Modules/config_mingw.cmake.in
+++ b/Modules/config_mingw.cmake.in
@@ -1,8 +1,9 @@
 set(ENV{PATH} "@MINGW_PATH@\;$ENV{PATH}")
+set(CMAKE_COMMAND_LINE "@ARGS_CMAKE_COMMAND_LINE@")
 execute_process(
   COMMAND "@CMAKE_COMMAND@" "-GMinGW Makefiles"
   -DCMAKE_Fortran_COMPILER:PATH=@MINGW_GFORTRAN@
   -DBUILD_SHARED_LIBS=ON
   -DCMAKE_GNUtoMS=ON
-  @ARGS_CMAKE_COMMAND_LINE@
+  ${CMAKE_COMMAND_LINE}
   "@source_dir@")
diff --git a/Tests/VSGNUFortran/CMakeLists.txt b/Tests/VSGNUFortran/CMakeLists.txt
index 2e527f9..422350a 100644
--- a/Tests/VSGNUFortran/CMakeLists.txt
+++ b/Tests/VSGNUFortran/CMakeLists.txt
@@ -1,5 +1,10 @@
 cmake_minimum_required(VERSION 2.8)
 project(VSGNUFortran)
+
+set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin")
+set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib")
+set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib")
+
 # force the executable to be put out of Debug/Release dir
 # because gmake build of fortran will not be in a config
 # directory, and for easier testing we want the exe and .dll
@@ -7,14 +12,9 @@ project(VSGNUFortran)
 if(CMAKE_CONFIGURATION_TYPES)
   foreach(config ${CMAKE_CONFIGURATION_TYPES})
     string(TOUPPER "${config}" config)
-    set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${config}
-      "${PROJECT_BINARY_DIR}/bin")
     set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_${config}
-      "${PROJECT_BINARY_DIR}/bin")
+      ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
   endforeach()
-else()
-  set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
-  set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
 endif()
 
 include(CMakeAddFortranSubdirectory)
@@ -22,11 +22,13 @@ include(CMakeAddFortranSubdirectory)
 # the subdir is fortran, the project is FortranHello
 cmake_add_fortran_subdirectory(fortran
   PROJECT FortranHello  # project name in toplevel CMakeLists.txt
-  ARCHIVE_DIR ../bin # .lib location relative to root binary tree
-  RUNTIME_DIR ../bin # .dll location relative to root binary tree
+  ARCHIVE_DIR ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}
+  RUNTIME_DIR bin # ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
   LIBRARIES hello world # target libraries created
-  CMAKE_COMMAND_LINE -DEXECUTABLE_OUTPUT_PATH=../bin
-                     -DLIBRARY_OUTPUT_PATH=../bin
+  CMAKE_COMMAND_LINE
+    -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
+    -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}
+    -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
   LINK_LIBRARIES  # link interface libraries
    LINK_LIBS hello world  # hello needs world to link
    )

-----------------------------------------------------------------------

Summary of changes:
 Modules/CMakeAddFortranSubdirectory.cmake |   80 +++++++++++++++++++----------
 Modules/config_mingw.cmake.in             |    3 +-
 Tests/VSGNUFortran/CMakeLists.txt         |   22 ++++----
 3 files changed, 66 insertions(+), 39 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list