[Cmake-commits] CMake branch, next, updated. v2.8.6-2133-g086ee2c

Brad King brad.king at kitware.com
Mon Dec 5 18:42:53 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  086ee2cb14b1744f8914f98d923ee9e43fbd4c08 (commit)
       via  ae62a1cd35fcd9be8d1beb11c864fbe417de429e (commit)
       via  afb00fef193b1000aa76e3a523899712065d53d0 (commit)
       via  61e862986ae56e111533c21759a4e01a41968d1e (commit)
       via  a603250a132d3a38428b6c3e2f425c1a0b2c3878 (commit)
       via  ecd8414757368f45152f6e3e4841a5b3715fa2d3 (commit)
      from  9150657a9684191df98f222c829dcc5ca45ad305 (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=086ee2cb14b1744f8914f98d923ee9e43fbd4c08
commit 086ee2cb14b1744f8914f98d923ee9e43fbd4c08
Merge: 9150657 ae62a1c
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Mon Dec 5 18:42:51 2011 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Mon Dec 5 18:42:51 2011 -0500

    Merge topic 'GNU-to-MS' into next
    
    ae62a1c Test CMAKE_GNUtoMS option in ExportImport on MinGW and MSys
    afb00fe Add CMAKE_GNUtoMS option to convert GNU .dll.a to MS .lib
    61e8629 Factor makefile generator link rule lookup into helper function
    a603250 Load platform files that need to know the ABI when possible
    ecd8414 Fortran: Detect pointer size in gfortran on MinGW


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ae62a1cd35fcd9be8d1beb11c864fbe417de429e
commit ae62a1cd35fcd9be8d1beb11c864fbe417de429e
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Mon Dec 5 16:49:10 2011 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Mon Dec 5 18:20:35 2011 -0500

    Test CMAKE_GNUtoMS option in ExportImport on MinGW and MSys

diff --git a/Tests/ExportImport/CMakeLists.txt b/Tests/ExportImport/CMakeLists.txt
index 2e01c50..ccfb894 100644
--- a/Tests/ExportImport/CMakeLists.txt
+++ b/Tests/ExportImport/CMakeLists.txt
@@ -22,6 +22,11 @@ else(CMAKE_CONFIGURATION_TYPES)
   endif(CMAKE_BUILD_TYPE)
 endif(CMAKE_CONFIGURATION_TYPES)
 
+if(MINGW OR MSYS)
+  # Test CMAKE_GNUtoMS whether we have VS or not.
+  set(ExportImport_GNUtoMS 1)
+endif()
+
 configure_file(${ExportImport_SOURCE_DIR}/InitialCache.cmake.in
                ${ExportImport_BINARY_DIR}/InitialCache.cmake @ONLY)
 
diff --git a/Tests/ExportImport/InitialCache.cmake.in b/Tests/ExportImport/InitialCache.cmake.in
index f920b1f..4893f70 100644
--- a/Tests/ExportImport/InitialCache.cmake.in
+++ b/Tests/ExportImport/InitialCache.cmake.in
@@ -12,3 +12,4 @@ SET(CMAKE_CXX_FLAGS_MINSIZEREL "@CMAKE_CXX_FLAGS_MINSIZEREL@" CACHE STRING "C++
 SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "@CMAKE_CXX_FLAGS_RELWITHDEBINFO@" CACHE STRING "C++ Flags")
 SET(CMAKE_INSTALL_PREFIX "@ExportImport_BINARY_DIR@/Root" CACHE STRING "Installation Prefix")
 SET(CMAKE_SKIP_RPATH ON CACHE BOOL "No RPATH")
+SET(CMAKE_GNUtoMS "@ExportImport_GNUtoMS@" CACHE BOOL "CMAKE_GNUtoMS")

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=afb00fef193b1000aa76e3a523899712065d53d0
commit afb00fef193b1000aa76e3a523899712065d53d0
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Mon Dec 5 16:39:07 2011 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Mon Dec 5 18:13:49 2011 -0500

    Add CMAKE_GNUtoMS option to convert GNU .dll.a to MS .lib
    
    Teach the Windows-GNU.cmake platform file to look for Visual Studio
    tools matching the target ABI.  Add an extra step to the link command
    for shared libraries and executables that export symbols and on which a
    new GNUtoMS property is set (initialized by the CMAKE_GNUtoMS option).
    Tell the GNU linker to output a module definition (.def) file listing
    exported symbols in addition to the GNU-format import library (.dll.a).
    Pass the .def file to the MS "lib" tool to construct a MS-format DLL
    import library (.lib).
    
    Teach the install(TARGETS) command to install the MS import library next
    to the GNU one.  Teach the install(EXPORT) and export() command to set
    the IMPORTED_IMPLIB property pointing at the import library to use the
    import library matching the tools in the importing project.

diff --git a/.gitattributes b/.gitattributes
index d9d64d6..d21f1dd 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -8,6 +8,7 @@ configure        crlf=input
 *.sh.in          crlf=input
 
 *.bat           -crlf
+*.bat.in        -crlf
 *.dsp           -crlf
 *.dsptemplate   -crlf
 *.dsw           -crlf
diff --git a/Modules/Platform/GNUtoMS_lib.bat.in b/Modules/Platform/GNUtoMS_lib.bat.in
new file mode 100644
index 0000000..2da920a
--- /dev/null
+++ b/Modules/Platform/GNUtoMS_lib.bat.in
@@ -0,0 +1,3 @@
+ at echo off
+call "@CMAKE_GNUtoMS_BAT@"
+lib /machine:"@CMAKE_GNUtoMS_ARCH@" %*
diff --git a/Modules/Platform/GNUtoMS_lib.cmake b/Modules/Platform/GNUtoMS_lib.cmake
new file mode 100644
index 0000000..ca9b0f8
--- /dev/null
+++ b/Modules/Platform/GNUtoMS_lib.cmake
@@ -0,0 +1,10 @@
+# Usage: cmake -Dlib=lib.bat -Ddef=out.def -Ddll=out.dll -Dimp=out.dll.a -P GNUtoMS_lib.cmake
+get_filename_component(name ${dll} NAME) # .dll file name
+string(REGEX REPLACE "\\.dll\\.a$" ".lib" out "${imp}") # .dll.a -> .lib
+execute_process(
+  COMMAND ${lib} /def:${def} /name:${name} /out:${out}
+  RESULT_VARIABLE res
+  )
+if(res)
+  message(FATAL_ERROR "lib failed: ${res}")
+endif()
diff --git a/Modules/Platform/Windows-GNU-C-ABI.cmake b/Modules/Platform/Windows-GNU-C-ABI.cmake
new file mode 100644
index 0000000..1189263
--- /dev/null
+++ b/Modules/Platform/Windows-GNU-C-ABI.cmake
@@ -0,0 +1 @@
+__windows_compiler_gnu_abi(C)
diff --git a/Modules/Platform/Windows-GNU-CXX-ABI.cmake b/Modules/Platform/Windows-GNU-CXX-ABI.cmake
new file mode 100644
index 0000000..f3c701c
--- /dev/null
+++ b/Modules/Platform/Windows-GNU-CXX-ABI.cmake
@@ -0,0 +1 @@
+__windows_compiler_gnu_abi(CXX)
diff --git a/Modules/Platform/Windows-GNU-Fortran-ABI.cmake b/Modules/Platform/Windows-GNU-Fortran-ABI.cmake
new file mode 100644
index 0000000..179280b
--- /dev/null
+++ b/Modules/Platform/Windows-GNU-Fortran-ABI.cmake
@@ -0,0 +1 @@
+__windows_compiler_gnu_abi(Fortran)
diff --git a/Modules/Platform/Windows-GNU.cmake b/Modules/Platform/Windows-GNU.cmake
index 1d3e4b5..c255d6b 100644
--- a/Modules/Platform/Windows-GNU.cmake
+++ b/Modules/Platform/Windows-GNU.cmake
@@ -108,6 +108,8 @@ macro(__windows_compiler_gnu lang)
   set(CMAKE_${lang}_LINK_EXECUTABLE
     "<CMAKE_${lang}_COMPILER> <FLAGS> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <OBJECTS>  -o <TARGET> -Wl,--out-implib,<TARGET_IMPLIB> ${CMAKE_GNULD_IMAGE_VERSION} <LINK_LIBRARIES>")
 
+  list(APPEND CMAKE_${lang}_ABI_FILES "Platform/Windows-GNU-${lang}-ABI")
+
   # Support very long lists of object files.
   if("${CMAKE_${lang}_RESPONSE_FILE_LINK_FLAG}" STREQUAL "@")
     foreach(rule CREATE_SHARED_MODULE CREATE_SHARED_LIBRARY LINK_EXECUTABLE)
@@ -125,3 +127,55 @@ macro(__windows_compiler_gnu lang)
     endforeach()
   endif()
 endmacro()
+
+macro(__windows_compiler_gnu_abi lang)
+  if(CMAKE_NO_GNUtoMS)
+    set(CMAKE_GNUtoMS 0)
+  else()
+    option(CMAKE_GNUtoMS "Convert GNU import libraries to MS format (requires Visual Studio)" OFF)
+  endif()
+
+  if(CMAKE_GNUtoMS AND NOT CMAKE_GNUtoMS_LIB)
+    # Find MS development environment setup script for this architecture.
+    if("${CMAKE_SIZEOF_VOID_P}" EQUAL 4)
+      find_program(CMAKE_GNUtoMS_VCVARS NAMES vcvars32.bat
+        DOC "Visual Studio vcvars32.bat"
+        PATHS
+        "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\11.0\\Setup\\VC;ProductDir]/bin"
+        "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0\\Setup\\VC;ProductDir]/bin"
+        "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\9.0\\Setup\\VC;ProductDir]/bin"
+        "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\Setup\\VC;ProductDir]/bin"
+        "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\7.1\\Setup\\VC;ProductDir]/bin"
+        "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\6.0\\Setup\\Microsoft Visual C++;ProductDir]/bin"
+        )
+      set(CMAKE_GNUtoMS_ARCH x86)
+    elseif("${CMAKE_SIZEOF_VOID_P}" EQUAL 8)
+      find_program(CMAKE_GNUtoMS_VCVARS NAMES vcvarsamd64.bat
+        DOC "Visual Studio vcvarsamd64.bat"
+        PATHS
+        "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\11.0\\Setup\\VC;ProductDir]/bin/amd64"
+        "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0\\Setup\\VC;ProductDir]/bin/amd64"
+        "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\9.0\\Setup\\VC;ProductDir]/bin/amd64"
+        "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\Setup\\VC;ProductDir]/bin/amd64"
+        )
+      set(CMAKE_GNUtoMS_ARCH amd64)
+    endif()
+    set_property(CACHE CMAKE_GNUtoMS_VCVARS PROPERTY ADVANCED 1)
+    if(CMAKE_GNUtoMS_VCVARS)
+      # Create helper script to run lib.exe from MS environment.
+      string(REPLACE "/" "\\" CMAKE_GNUtoMS_BAT "${CMAKE_GNUtoMS_VCVARS}")
+      set(CMAKE_GNUtoMS_LIB ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeGNUtoMS_lib.bat)
+      configure_file(${CMAKE_ROOT}/Modules/Platform/GNUtoMS_lib.bat.in ${CMAKE_GNUtoMS_LIB})
+    else()
+      message(WARNING "Disabling CMAKE_GNUtoMS option because CMAKE_GNUtoMS_VCVARS is not set.")
+      set(CMAKE_GNUtoMS 0)
+    endif()
+  endif()
+
+  if(CMAKE_GNUtoMS)
+    # Teach CMake how to create a MS import library at link time.
+    set(CMAKE_${lang}_GNUtoMS_RULE " -Wl,--output-def,<TARGET_NAME>.def"
+      "<CMAKE_COMMAND> -Dlib=\"${CMAKE_GNUtoMS_LIB}\" -Ddef=\"<TARGET_NAME>.def\" -Ddll=\"<TARGET>\" -Dimp=\"<TARGET_IMPLIB>\" -P \"${CMAKE_ROOT}/Modules/Platform/GNUtoMS_lib.cmake\""
+      )
+  endif()
+endmacro()
diff --git a/Source/cmDocumentVariables.cxx b/Source/cmDocumentVariables.cxx
index 7da07f8..c8c83b9 100644
--- a/Source/cmDocumentVariables.cxx
+++ b/Source/cmDocumentVariables.cxx
@@ -1112,6 +1112,15 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
      "Variables that Control the Build");
 
   cm->DefineProperty
+    ("CMAKE_GNUtoMS", cmProperty::VARIABLE,
+     "Convert GNU import libraries (.dll.a) to MS format (.lib).",
+     "This variable is used to initialize the GNUtoMS property on targets "
+     "when they are created.  "
+     "See that target property for additional information.",
+     false,
+     "Variables that Control the Build");
+
+  cm->DefineProperty
     ("CMAKE_DEBUG_POSTFIX", cmProperty::VARIABLE,
      "See variable CMAKE_<CONFIG>_POSTFIX.",
      "This variable is a special case of the more-general "
diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx
index 7e73e36..32595ee 100644
--- a/Source/cmExportBuildFileGenerator.cxx
+++ b/Source/cmExportBuildFileGenerator.cxx
@@ -125,6 +125,8 @@ cmExportBuildFileGenerator
     std::string prop = "IMPORTED_IMPLIB";
     prop += suffix;
     std::string value = target->GetFullPath(config, true);
+    target->GetImplibGNUtoMS(value, value,
+                             "${CMAKE_IMPORT_LIBRARY_SUFFIX}");
     properties[prop] = value;
     }
 }
diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx
index 33ffbfb..ac1c949 100644
--- a/Source/cmInstallTargetGenerator.cxx
+++ b/Source/cmInstallTargetGenerator.cxx
@@ -101,6 +101,13 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os,
       std::string to1 = toDir + targetNameImport;
       filesFrom.push_back(from1);
       filesTo.push_back(to1);
+      std::string targetNameImportLib;
+      if(this->Target->GetImplibGNUtoMS(targetNameImport,
+                                        targetNameImportLib))
+        {
+        filesFrom.push_back(fromDirConfig + targetNameImportLib);
+        filesTo.push_back(toDir + targetNameImportLib);
+        }
 
       // An import library looks like a static library.
       type = cmTarget::STATIC_LIBRARY;
@@ -157,6 +164,13 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os,
       std::string to1 = toDir + targetNameImport;
       filesFrom.push_back(from1);
       filesTo.push_back(to1);
+      std::string targetNameImportLib;
+      if(this->Target->GetImplibGNUtoMS(targetNameImport,
+                                        targetNameImportLib))
+        {
+        filesFrom.push_back(fromDirConfig + targetNameImportLib);
+        filesTo.push_back(toDir + targetNameImportLib);
+        }
 
       // An import library looks like a static library.
       type = cmTarget::STATIC_LIBRARY;
@@ -314,7 +328,11 @@ std::string cmInstallTargetGenerator::GetInstallFilename(cmTarget* target,
     if(nameType == NameImplib)
       {
       // Use the import library name.
-      fname = targetNameImport;
+      if(!target->GetImplibGNUtoMS(targetNameImport, fname,
+                                   "${CMAKE_IMPORT_LIBRARY_SUFFIX}"))
+        {
+        fname = targetNameImport;
+        }
       }
     else if(nameType == NameReal)
       {
@@ -339,7 +357,11 @@ std::string cmInstallTargetGenerator::GetInstallFilename(cmTarget* target,
     if(nameType == NameImplib)
       {
       // Use the import library name.
-      fname = targetNameImport;
+      if(!target->GetImplibGNUtoMS(targetNameImport, fname,
+                                   "${CMAKE_IMPORT_LIBRARY_SUFFIX}"))
+        {
+        fname = targetNameImport;
+        }
       }
     else if(nameType == NameSO)
       {
diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx
index 0fcd269..78278cb 100644
--- a/Source/cmMakefileExecutableTargetGenerator.cxx
+++ b/Source/cmMakefileExecutableTargetGenerator.cxx
@@ -241,6 +241,13 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
     exeCleanFiles.push_back(this->Convert(targetFullPathImport.c_str(),
                                           cmLocalGenerator::START_OUTPUT,
                                           cmLocalGenerator::UNCHANGED));
+    std::string implib;
+    if(this->Target->GetImplibGNUtoMS(targetFullPathImport, implib))
+      {
+      exeCleanFiles.push_back(this->Convert(implib.c_str(),
+                                            cmLocalGenerator::START_OUTPUT,
+                                            cmLocalGenerator::UNCHANGED));
+      }
     }
 
   // List the PDB for cleaning only when the whole target is
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx
index 337b286..b4174cc 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -512,6 +512,13 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
     libCleanFiles.push_back(this->Convert(targetFullPathImport.c_str(),
         cmLocalGenerator::START_OUTPUT,
         cmLocalGenerator::UNCHANGED));
+    std::string implib;
+    if(this->Target->GetImplibGNUtoMS(targetFullPathImport, implib))
+      {
+      libCleanFiles.push_back(this->Convert(implib.c_str(),
+                                            cmLocalGenerator::START_OUTPUT,
+                                            cmLocalGenerator::UNCHANGED));
+      }
     }
 
   // List the PDB for cleaning only when the whole target is
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 004e780..a3a832b 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -1637,6 +1637,16 @@ void cmMakefileTargetGenerator
 std::string cmMakefileTargetGenerator::GetLinkRule(const char* linkRuleVar)
 {
   std::string linkRule = this->Makefile->GetRequiredDefinition(linkRuleVar);
+  if(this->Target->HasImplibGNUtoMS())
+    {
+    std::string ruleVar = "CMAKE_";
+    ruleVar += this->Target->GetLinkerLanguage(this->ConfigName);
+    ruleVar += "_GNUtoMS_RULE";
+    if(const char* rule = this->Makefile->GetDefinition(ruleVar.c_str()))
+      {
+      linkRule += rule;
+      }
+    }
   return linkRule;
 }
 
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index dad0353..48368de 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -980,6 +980,23 @@ void cmTarget::DefineProperties(cmake *cm)
      "is created its value is used to initialize this property.");
 
   cm->DefineProperty
+    ("GNUtoMS", cmProperty::TARGET,
+     "Convert GNU import library (.dll.a) to MS format (.lib).",
+     "When linking a shared library or executable that exports symbols "
+     "using GNU tools on Windows (MinGW/MSYS) with Visual Studio installed "
+     "convert the import library (.dll.a) from GNU to MS format (.lib).  "
+     "Both import libraries will be installed by install(TARGETS) and "
+     "exported by install(EXPORT) and export() to be linked by applications "
+     "with either GNU- or MS-compatible tools."
+     "\n"
+     "If the variable CMAKE_GNUtoMS is set when a target "
+     "is created its value is used to initialize this property.  "
+     "The variable must be set prior to the first command that enables "
+     "a language such as project() or enable_language().  "
+     "CMake provides the variable as an option to the user automatically "
+     "when configuring on Windows with GNU tools.");
+
+  cm->DefineProperty
     ("XCODE_ATTRIBUTE_<an-attribute>", cmProperty::TARGET,
      "Set Xcode target attributes directly.",
      "Tell the Xcode generator to set '<an-attribute>' to a given value "
@@ -1195,6 +1212,7 @@ void cmTarget::SetMakefile(cmMakefile* mf)
   this->SetPropertyDefault("RUNTIME_OUTPUT_DIRECTORY", 0);
   this->SetPropertyDefault("Fortran_FORMAT", 0);
   this->SetPropertyDefault("Fortran_MODULE_DIRECTORY", 0);
+  this->SetPropertyDefault("GNUtoMS", 0);
   this->SetPropertyDefault("OSX_ARCHITECTURES", 0);
   this->SetPropertyDefault("AUTOMOC", 0);
   this->SetPropertyDefault("AUTOMOC_MOC_OPTIONS", 0);
@@ -3457,6 +3475,26 @@ void cmTarget::GetExecutableNames(std::string& name,
 }
 
 //----------------------------------------------------------------------------
+bool cmTarget::HasImplibGNUtoMS()
+{
+  return this->HasImportLibrary() && this->GetPropertyAsBool("GNUtoMS");
+}
+
+//----------------------------------------------------------------------------
+bool cmTarget::GetImplibGNUtoMS(std::string const& gnuName,
+                                std::string& out, const char* newExt)
+{
+  if(this->HasImplibGNUtoMS() &&
+     gnuName.size() > 6 && gnuName.substr(gnuName.size()-6) == ".dll.a")
+    {
+    out = gnuName.substr(0, gnuName.size()-6);
+    out += newExt? newExt : ".lib";
+    return true;
+    }
+  return false;
+}
+
+//----------------------------------------------------------------------------
 void cmTarget::GenerateTargetManifest(const char* config)
 {
   cmMakefile* mf = this->Makefile;
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 0abdddb..09fee6c 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -369,6 +369,14 @@ public:
                           std::string& impName,
                           std::string& pdbName, const char* config);
 
+  /** Does this target have a GNU implib to convert to MS format?  */
+  bool HasImplibGNUtoMS();
+
+  /** Convert the given GNU import library name (.dll.a) to a name with a new
+      extension (.lib or ${CMAKE_IMPORT_LIBRARY_SUFFIX}).  */
+  bool GetImplibGNUtoMS(std::string const& gnuName, std::string& out,
+                        const char* newExt = 0);
+
   /** Add the target output files to the global generator manifest.  */
   void GenerateTargetManifest(const char* config);
 

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=61e862986ae56e111533c21759a4e01a41968d1e
commit 61e862986ae56e111533c21759a4e01a41968d1e
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Mon Dec 5 16:28:03 2011 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Mon Dec 5 16:37:43 2011 -0500

    Factor makefile generator link rule lookup into helper function
    
    This provides a place in the makefile generators to adjust the link
    rules for both libraries and executables.

diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx
index cd75d79..0fcd269 100644
--- a/Source/cmMakefileExecutableTargetGenerator.cxx
+++ b/Source/cmMakefileExecutableTargetGenerator.cxx
@@ -270,8 +270,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
   std::string linkRuleVar = "CMAKE_";
   linkRuleVar += linkLanguage;
   linkRuleVar += "_LINK_EXECUTABLE";
-  std::string linkRule =
-    this->Makefile->GetRequiredDefinition(linkRuleVar.c_str());
+  std::string linkRule = this->GetLinkRule(linkRuleVar.c_str());
   std::vector<std::string> commands1;
   cmSystemTools::ExpandListArgument(linkRule, real_link_commands);
   if(this->Target->IsExecutableWithExports())
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx
index 31f7be5..337b286 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -772,7 +772,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
   else
     {
     // Get the set of commands.
-    std::string linkRule = this->Makefile->GetRequiredDefinition(linkRuleVar);
+    std::string linkRule = this->GetLinkRule(linkRuleVar);
     cmSystemTools::ExpandListArgument(linkRule, real_link_commands);
 
     // Expand placeholders.
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 8b91194..004e780 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -1634,6 +1634,13 @@ void cmMakefileTargetGenerator
 }
 
 //----------------------------------------------------------------------------
+std::string cmMakefileTargetGenerator::GetLinkRule(const char* linkRuleVar)
+{
+  std::string linkRule = this->Makefile->GetRequiredDefinition(linkRuleVar);
+  return linkRule;
+}
+
+//----------------------------------------------------------------------------
 void cmMakefileTargetGenerator
 ::CloseFileStreams()
 {
diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h
index 674cd13..8fba13f 100644
--- a/Source/cmMakefileTargetGenerator.h
+++ b/Source/cmMakefileTargetGenerator.h
@@ -120,6 +120,9 @@ protected:
   // Append link rule dependencies (objects, etc.).
   void AppendLinkDepends(std::vector<std::string>& depends);
 
+  // Lookup the link rule for this target.
+  std::string GetLinkRule(const char* linkRuleVar);
+
   /** In order to support parallel builds for custom commands with
       multiple outputs the outputs are given a serial order, and only
       the first output actually has the build rule.  Other outputs

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a603250a132d3a38428b6c3e2f425c1a0b2c3878
commit a603250a132d3a38428b6c3e2f425c1a0b2c3878
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Tue Nov 29 15:17:06 2011 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Mon Dec 5 16:35:42 2011 -0500

    Load platform files that need to know the ABI when possible
    
    Load platform files named in CMAKE_<lang>_ABI_FILES for each language
    once the ABI sizeof(void*) is known.  During the first configuration
    this is after the test for working compiler and ABI detection checks.
    During later configurations the ABI information is immediately available
    because it has been saved in CMake<lang>Compiler.cmake.

diff --git a/Modules/CMakeCInformation.cmake b/Modules/CMakeCInformation.cmake
index 9285fef..6b5efba 100644
--- a/Modules/CMakeCInformation.cmake
+++ b/Modules/CMakeCInformation.cmake
@@ -68,6 +68,12 @@ IF (NOT _INCLUDED_FILE)
   INCLUDE(Platform/${CMAKE_SYSTEM_NAME} OPTIONAL)
 ENDIF (NOT _INCLUDED_FILE)
 
+IF(CMAKE_C_SIZEOF_DATA_PTR)
+  FOREACH(f ${CMAKE_C_ABI_FILES})
+    INCLUDE(${f})
+  ENDFOREACH()
+  UNSET(CMAKE_C_ABI_FILES)
+ENDIF()
 
 # This should be included before the _INIT variables are
 # used to initialize the cache.  Since the rule variables 
diff --git a/Modules/CMakeCXXInformation.cmake b/Modules/CMakeCXXInformation.cmake
index 620de63..b97a69c 100644
--- a/Modules/CMakeCXXInformation.cmake
+++ b/Modules/CMakeCXXInformation.cmake
@@ -67,6 +67,12 @@ IF (NOT _INCLUDED_FILE)
   INCLUDE(Platform/${CMAKE_SYSTEM_NAME} OPTIONAL)
 ENDIF (NOT _INCLUDED_FILE)
 
+IF(CMAKE_CXX_SIZEOF_DATA_PTR)
+  FOREACH(f ${CMAKE_CXX_ABI_FILES})
+    INCLUDE(${f})
+  ENDFOREACH()
+  UNSET(CMAKE_CXX_ABI_FILES)
+ENDIF()
 
 # This should be included before the _INIT variables are
 # used to initialize the cache.  Since the rule variables 
diff --git a/Modules/CMakeFortranInformation.cmake b/Modules/CMakeFortranInformation.cmake
index dc15e55..aed1fd2 100644
--- a/Modules/CMakeFortranInformation.cmake
+++ b/Modules/CMakeFortranInformation.cmake
@@ -44,6 +44,12 @@ IF (NOT _INCLUDED_FILE)
   INCLUDE(Platform/${CMAKE_SYSTEM_NAME} OPTIONAL)
 ENDIF (NOT _INCLUDED_FILE)
 
+IF(CMAKE_Fortran_SIZEOF_DATA_PTR)
+  FOREACH(f ${CMAKE_Fortran_ABI_FILES})
+    INCLUDE(${f})
+  ENDFOREACH()
+  UNSET(CMAKE_Fortran_ABI_FILES)
+ENDIF()
 
 # This should be included before the _INIT variables are
 # used to initialize the cache.  Since the rule variables 
diff --git a/Modules/CMakeTestCCompiler.cmake b/Modules/CMakeTestCCompiler.cmake
index 038c2fd..4d4e35f 100644
--- a/Modules/CMakeTestCCompiler.cmake
+++ b/Modules/CMakeTestCCompiler.cmake
@@ -76,5 +76,11 @@ ELSE(NOT CMAKE_C_COMPILER_WORKS)
       )
     INCLUDE(${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeCCompiler.cmake)
   ENDIF(CMAKE_C_COMPILER_FORCED)
+  IF(CMAKE_C_SIZEOF_DATA_PTR)
+    FOREACH(f ${CMAKE_C_ABI_FILES})
+      INCLUDE(${f})
+    ENDFOREACH()
+    UNSET(CMAKE_C_ABI_FILES)
+  ENDIF()
 ENDIF(NOT CMAKE_C_COMPILER_WORKS)
 
diff --git a/Modules/CMakeTestCXXCompiler.cmake b/Modules/CMakeTestCXXCompiler.cmake
index c1a3b3a..494add3 100644
--- a/Modules/CMakeTestCXXCompiler.cmake
+++ b/Modules/CMakeTestCXXCompiler.cmake
@@ -69,4 +69,10 @@ ELSE(NOT CMAKE_CXX_COMPILER_WORKS)
       )
     INCLUDE(${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeCXXCompiler.cmake)
   ENDIF(CMAKE_CXX_COMPILER_FORCED)
+  IF(CMAKE_CXX_SIZEOF_DATA_PTR)
+    FOREACH(f ${CMAKE_CXX_ABI_FILES})
+      INCLUDE(${f})
+    ENDFOREACH()
+    UNSET(CMAKE_CXX_ABI_FILES)
+  ENDIF()
 ENDIF(NOT CMAKE_CXX_COMPILER_WORKS)
diff --git a/Modules/CMakeTestFortranCompiler.cmake b/Modules/CMakeTestFortranCompiler.cmake
index 33f62eb..b4dcea6 100644
--- a/Modules/CMakeTestFortranCompiler.cmake
+++ b/Modules/CMakeTestFortranCompiler.cmake
@@ -92,4 +92,10 @@ ELSE(NOT CMAKE_Fortran_COMPILER_WORKS)
       )
     INCLUDE(${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeFortranCompiler.cmake)
   ENDIF(CMAKE_Fortran_COMPILER_FORCED)
+  IF(CMAKE_Fortran_SIZEOF_DATA_PTR)
+    FOREACH(f ${CMAKE_Fortran_ABI_FILES})
+      INCLUDE(${f})
+    ENDFOREACH()
+    UNSET(CMAKE_Fortran_ABI_FILES)
+  ENDIF()
 ENDIF(NOT CMAKE_Fortran_COMPILER_WORKS)
diff --git a/Source/cmDocumentVariables.cxx b/Source/cmDocumentVariables.cxx
index ed303c9..7da07f8 100644
--- a/Source/cmDocumentVariables.cxx
+++ b/Source/cmDocumentVariables.cxx
@@ -1515,6 +1515,8 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
                      cmProperty::VARIABLE,0,0);
   cm->DefineProperty("CMAKE_<LANG>_COMPILER_ID_RUN",
                      cmProperty::VARIABLE,0,0);
+  cm->DefineProperty("CMAKE_<LANG>_ABI_FILES",
+                     cmProperty::VARIABLE,0,0);
   cm->DefineProperty("CMAKE_<LANG>_CREATE_ASSEMBLY_SOURCE",
                      cmProperty::VARIABLE,0,0);
   cm->DefineProperty("CMAKE_<LANG>_CREATE_PREPROCESSED_SOURCE",

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ecd8414757368f45152f6e3e4841a5b3715fa2d3
commit ecd8414757368f45152f6e3e4841a5b3715fa2d3
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Tue Nov 29 15:13:47 2011 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Mon Dec 5 16:32:29 2011 -0500

    Fortran: Detect pointer size in gfortran on MinGW
    
    Use __SIZEOF_POINTER__ which the GNU Fortran compiler defines at least
    on 64-bit MinGW.  Assume default size 4 on MinGW if gfortran does not
    define the size.

diff --git a/Modules/CMakeDetermineCompilerABI.cmake b/Modules/CMakeDetermineCompilerABI.cmake
index a808a28..1c9899e 100644
--- a/Modules/CMakeDetermineCompilerABI.cmake
+++ b/Modules/CMakeDetermineCompilerABI.cmake
@@ -57,6 +57,8 @@ FUNCTION(CMAKE_DETERMINE_COMPILER_ABI lang src)
 
       IF(ABI_SIZEOF_DPTR)
         SET(CMAKE_${lang}_SIZEOF_DATA_PTR "${ABI_SIZEOF_DPTR}" PARENT_SCOPE)
+      ELSEIF(CMAKE_${lang}_SIZEOF_DATA_PTR_DEFAULT)
+        SET(CMAKE_${lang}_SIZEOF_DATA_PTR "${CMAKE_${lang}_SIZEOF_DATA_PTR_DEFAULT}" PARENT_SCOPE)
       ENDIF(ABI_SIZEOF_DPTR)
 
       IF(ABI_NAME)
diff --git a/Modules/CMakeFortranCompilerABI.F b/Modules/CMakeFortranCompilerABI.F
index b8efb42..7e24553 100644
--- a/Modules/CMakeFortranCompilerABI.F
+++ b/Modules/CMakeFortranCompilerABI.F
@@ -15,6 +15,11 @@
         PRINT *, 'INFO:sizeof_dptr[4]'
 #elif defined(_M_IX86)
         PRINT *, 'INFO:sizeof_dptr[4]'
+
+#elif defined(__SIZEOF_POINTER__) && __SIZEOF_POINTER__ == 8
+        PRINT *, 'INFO:sizeof_dptr[8]'
+#elif defined(__SIZEOF_POINTER__) && __SIZEOF_POINTER__ == 4
+        PRINT *, 'INFO:sizeof_dptr[4]'
 #endif
 
 #if 0
diff --git a/Modules/Platform/Windows-GNU-Fortran.cmake b/Modules/Platform/Windows-GNU-Fortran.cmake
index c66feed..b81b796 100644
--- a/Modules/Platform/Windows-GNU-Fortran.cmake
+++ b/Modules/Platform/Windows-GNU-Fortran.cmake
@@ -1,2 +1,5 @@
 include(Platform/Windows-GNU)
 __windows_compiler_gnu(Fortran)
+
+# gfortran on 64-bit MinGW defines __SIZEOF_POINTER__
+set(CMAKE_Fortran_SIZEOF_DATA_PTR_DEFAULT 4)

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

Summary of changes:
 .gitattributes                                 |    1 +
 Modules/CMakeCInformation.cmake                |    6 +++
 Modules/CMakeCXXInformation.cmake              |    6 +++
 Modules/CMakeDetermineCompilerABI.cmake        |    2 +
 Modules/CMakeFortranCompilerABI.F              |    5 ++
 Modules/CMakeFortranInformation.cmake          |    6 +++
 Modules/CMakeTestCCompiler.cmake               |    6 +++
 Modules/CMakeTestCXXCompiler.cmake             |    6 +++
 Modules/CMakeTestFortranCompiler.cmake         |    6 +++
 Modules/Platform/GNUtoMS_lib.bat.in            |    3 +
 Modules/Platform/GNUtoMS_lib.cmake             |   10 ++++
 Modules/Platform/Windows-GNU-C-ABI.cmake       |    1 +
 Modules/Platform/Windows-GNU-CXX-ABI.cmake     |    1 +
 Modules/Platform/Windows-GNU-Fortran-ABI.cmake |    1 +
 Modules/Platform/Windows-GNU-Fortran.cmake     |    3 +
 Modules/Platform/Windows-GNU.cmake             |   54 ++++++++++++++++++++++++
 Source/cmDocumentVariables.cxx                 |   11 +++++
 Source/cmExportBuildFileGenerator.cxx          |    2 +
 Source/cmInstallTargetGenerator.cxx            |   26 ++++++++++-
 Source/cmMakefileExecutableTargetGenerator.cxx |   10 ++++-
 Source/cmMakefileLibraryTargetGenerator.cxx    |    9 ++++-
 Source/cmMakefileTargetGenerator.cxx           |   17 +++++++
 Source/cmMakefileTargetGenerator.h             |    3 +
 Source/cmTarget.cxx                            |   38 +++++++++++++++++
 Source/cmTarget.h                              |    8 ++++
 Tests/ExportImport/CMakeLists.txt              |    5 ++
 Tests/ExportImport/InitialCache.cmake.in       |    1 +
 27 files changed, 242 insertions(+), 5 deletions(-)
 create mode 100644 Modules/Platform/GNUtoMS_lib.bat.in
 create mode 100644 Modules/Platform/GNUtoMS_lib.cmake
 create mode 100644 Modules/Platform/Windows-GNU-C-ABI.cmake
 create mode 100644 Modules/Platform/Windows-GNU-CXX-ABI.cmake
 create mode 100644 Modules/Platform/Windows-GNU-Fortran-ABI.cmake


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list