[Cmake-commits] CMake branch, next, updated. v3.1.0-rc1-337-g702768c

Brad King brad.king at kitware.com
Wed Nov 5 14:48:40 EST 2014


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  702768c84b8622cf1dd1cf1a8ce526d7c0ba4a3e (commit)
       via  038749405a410561763fef18fb6e7060ba586bc2 (commit)
      from  72374d85246e15e99bf4d15936e2d22f977750d5 (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=702768c84b8622cf1dd1cf1a8ce526d7c0ba4a3e
commit 702768c84b8622cf1dd1cf1a8ce526d7c0ba4a3e
Merge: 72374d8 0387494
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Nov 5 14:48:39 2014 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Wed Nov 5 14:48:39 2014 -0500

    Merge topic 'make-fortran-preprocessor-assembly-targets' into next
    
    03874940 Revert topic 'make-fortran-preprocessor-assembly-targets'


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=038749405a410561763fef18fb6e7060ba586bc2
commit 038749405a410561763fef18fb6e7060ba586bc2
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Nov 5 14:48:24 2014 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Nov 5 14:48:24 2014 -0500

    Revert topic 'make-fortran-preprocessor-assembly-targets'

diff --git a/Modules/Compiler/GNU-Fortran.cmake b/Modules/Compiler/GNU-Fortran.cmake
index dfd7927..313ccbd 100644
--- a/Modules/Compiler/GNU-Fortran.cmake
+++ b/Modules/Compiler/GNU-Fortran.cmake
@@ -8,5 +8,10 @@ set(CMAKE_Fortran_FORMAT_FREE_FLAG "-ffree-form")
 set(CMAKE_Fortran_FLAGS_MINSIZEREL_INIT "-Os")
 set(CMAKE_Fortran_FLAGS_RELEASE_INIT "-O3")
 
+# We require updates to CMake C++ code to support preprocessing rules
+# for Fortran.
+set(CMAKE_Fortran_CREATE_PREPROCESSED_SOURCE)
+set(CMAKE_Fortran_CREATE_ASSEMBLY_SOURCE)
+
 # Fortran-specific feature flags.
 set(CMAKE_Fortran_MODDIR_FLAG -J)
diff --git a/Modules/Compiler/HP-Fortran.cmake b/Modules/Compiler/HP-Fortran.cmake
index ad821ab..cc56b46 100644
--- a/Modules/Compiler/HP-Fortran.cmake
+++ b/Modules/Compiler/HP-Fortran.cmake
@@ -1,6 +1,3 @@
 set(CMAKE_Fortran_VERBOSE_FLAG "-v")
 set(CMAKE_Fortran_FORMAT_FIXED_FLAG "+source=fixed")
 set(CMAKE_Fortran_FORMAT_FREE_FLAG "+source=free")
-
-set(CMAKE_Fortran_CREATE_ASSEMBLY_SOURCE "<CMAKE_Fortran_COMPILER> <DEFINES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
-set(CMAKE_Fortran_CREATE_PREPROCESSED_SOURCE "<CMAKE_Fortran_COMPILER> <DEFINES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
diff --git a/Modules/Compiler/Intel-Fortran.cmake b/Modules/Compiler/Intel-Fortran.cmake
index 9ebac5a..84f6182 100644
--- a/Modules/Compiler/Intel-Fortran.cmake
+++ b/Modules/Compiler/Intel-Fortran.cmake
@@ -7,6 +7,3 @@ set(CMAKE_Fortran_MODDIR_FLAG "-module ")
 set(CMAKE_Fortran_VERBOSE_FLAG "-v")
 set(CMAKE_Fortran_FORMAT_FIXED_FLAG "-fixed")
 set(CMAKE_Fortran_FORMAT_FREE_FLAG "-free")
-
-set(CMAKE_Fortran_CREATE_PREPROCESSED_SOURCE "<CMAKE_Fortran_COMPILER> <DEFINES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
-set(CMAKE_Fortran_CREATE_ASSEMBLY_SOURCE "<CMAKE_Fortran_COMPILER> <DEFINES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
diff --git a/Modules/Compiler/PGI-Fortran.cmake b/Modules/Compiler/PGI-Fortran.cmake
index 2866254..264c23e 100644
--- a/Modules/Compiler/PGI-Fortran.cmake
+++ b/Modules/Compiler/PGI-Fortran.cmake
@@ -7,4 +7,9 @@ set(CMAKE_Fortran_FORMAT_FREE_FLAG "-Mfreeform")
 set(CMAKE_Fortran_FLAGS_INIT "${CMAKE_Fortran_FLAGS_INIT} -Mpreprocess -Kieee")
 set(CMAKE_Fortran_FLAGS_DEBUG_INIT "${CMAKE_Fortran_FLAGS_DEBUG_INIT} -Mbounds")
 
+# We require updates to CMake C++ code to support preprocessing rules
+# for Fortran.
+set(CMAKE_Fortran_CREATE_PREPROCESSED_SOURCE)
+set(CMAKE_Fortran_CREATE_ASSEMBLY_SOURCE)
+
 set(CMAKE_Fortran_MODDIR_FLAG "-module ")
diff --git a/Modules/Compiler/SunPro-Fortran.cmake b/Modules/Compiler/SunPro-Fortran.cmake
index c38d5a5..18e75b9 100644
--- a/Modules/Compiler/SunPro-Fortran.cmake
+++ b/Modules/Compiler/SunPro-Fortran.cmake
@@ -16,6 +16,3 @@ set(CMAKE_Fortran_FLAGS_RELEASE_INIT "-xO3 -DNDEBUG")
 set(CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT "-g -xO2 -DNDEBUG")
 set(CMAKE_Fortran_MODDIR_FLAG "-moddir=")
 set(CMAKE_Fortran_MODPATH_FLAG "-M")
-
-set(CMAKE_Fortran_CREATE_PREPROCESSED_SOURCE "<CMAKE_Fortran_COMPILER> <DEFINES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
-set(CMAKE_Fortran_CREATE_ASSEMBLY_SOURCE "<CMAKE_Fortran_COMPILER> <DEFINES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
diff --git a/Modules/Compiler/XL-Fortran.cmake b/Modules/Compiler/XL-Fortran.cmake
index dfe2166..f1c9158 100644
--- a/Modules/Compiler/XL-Fortran.cmake
+++ b/Modules/Compiler/XL-Fortran.cmake
@@ -11,3 +11,7 @@ set(CMAKE_Fortran_DEFINE_FLAG "-WF,-D")
 # -qthreaded     = Ensures that all optimizations will be thread-safe
 # -qhalt=e       = Halt on error messages (rather than just severe errors)
 set(CMAKE_Fortran_FLAGS_INIT "-qthreaded -qhalt=e")
+
+# We require updates to CMake C++ code to support preprocessing rules for Fortran.
+set(CMAKE_Fortran_CREATE_PREPROCESSED_SOURCE)
+set(CMAKE_Fortran_CREATE_ASSEMBLY_SOURCE)
diff --git a/Modules/Platform/HP-UX-HP-Fortran.cmake b/Modules/Platform/HP-UX-HP-Fortran.cmake
index e5c5d10..30acab8 100644
--- a/Modules/Platform/HP-UX-HP-Fortran.cmake
+++ b/Modules/Platform/HP-UX-HP-Fortran.cmake
@@ -1,5 +1,2 @@
 include(Platform/HP-UX-HP)
 __hpux_compiler_hp(Fortran)
-
-set(CMAKE_Fortran_CREATE_PREPROCESSED_SOURCE "<CMAKE_Fortran_COMPILER> <DEFINES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
-set(CMAKE_Fortran_CREATE_ASSEMBLY_SOURCE "<CMAKE_Fortran_COMPILER> <DEFINES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
diff --git a/Modules/Platform/IRIX.cmake b/Modules/Platform/IRIX.cmake
index 12b0f37..03e98cc 100644
--- a/Modules/Platform/IRIX.cmake
+++ b/Modules/Platform/IRIX.cmake
@@ -31,14 +31,6 @@ if(NOT CMAKE_COMPILER_IS_GNUCXX)
     )
 endif()
 
-if(NOT CMAKE_COMPILER_IS_GNUG77)
-  set (CMAKE_Fortran_CREATE_PREPROCESSED_SOURCE "<CMAKE_Fortran_COMPILER> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
-  set (CMAKE_Fortran_CREATE_ASSEMBLY_SOURCE
-    "<CMAKE_Fortran_COMPILER> <FLAGS> -S <SOURCE>"
-    "mv `basename \"<SOURCE>\" | sed 's/\\.[^./]*$$//'`.s <ASSEMBLY_SOURCE>"
-    )
-endif()
-
 # Initialize C link type selection flags.  These flags are used when
 # building a shared library, shared module, or executable that links
 # to other libraries to select whether to use the static or shared
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index ff8ba8b..c18e027 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -315,43 +315,36 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefile()
 
     // Check whether preprocessing and assembly rules make sense.
     // They make sense only for C and C++ sources.
-    bool lang_has_preprocessor = false;
-    bool lang_has_assembly = false;
-
+    bool lang_is_c_or_cxx = false;
     for(std::vector<LocalObjectEntry>::const_iterator ei =
           lo->second.begin(); ei != lo->second.end(); ++ei)
       {
-      if(ei->Language == "C" ||
-         ei->Language == "CXX" ||
-         ei->Language == "Fortran")
+      if(ei->Language == "C" || ei->Language == "CXX")
         {
-        // Right now, C, C++ and Fortran have both a preprocessor and the
-        // ability to generate assembly code
-        lang_has_preprocessor = true;
-        lang_has_assembly = true;
+        lang_is_c_or_cxx = true;
         break;
         }
       }
 
     // Add convenience rules for preprocessed and assembly files.
-    if(lang_has_preprocessor && do_preprocess_rules)
-      {
-      std::string::size_type dot_pos = lo->first.rfind(".");
-      std::string base = lo->first.substr(0, dot_pos);
-      this->WriteObjectConvenienceRule(
-        ruleFileStream, "target to preprocess a source file",
-       (base + ".i").c_str(), lo->second);
-      lo->second.HasPreprocessRule = true;
-      }
-
-    if(lang_has_assembly && do_assembly_rules)
+    if(lang_is_c_or_cxx && (do_preprocess_rules || do_assembly_rules))
       {
       std::string::size_type dot_pos = lo->first.rfind(".");
       std::string base = lo->first.substr(0, dot_pos);
-      this->WriteObjectConvenienceRule(
-       ruleFileStream, "target to generate assembly for a file",
-       (base + ".s").c_str(), lo->second);
-      lo->second.HasAssembleRule = true;
+      if(do_preprocess_rules)
+        {
+        this->WriteObjectConvenienceRule(
+          ruleFileStream, "target to preprocess a source file",
+          (base + ".i").c_str(), lo->second);
+          lo->second.HasPreprocessRule = true;
+        }
+      if(do_assembly_rules)
+        {
+        this->WriteObjectConvenienceRule(
+          ruleFileStream, "target to generate assembly for a file",
+          (base + ".s").c_str(), lo->second);
+          lo->second.HasAssembleRule = true;
+        }
       }
     }
 
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 1e01f11..1adcb8a 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -702,14 +702,7 @@ cmMakefileTargetGenerator
 
   vars.Defines = definesString.c_str();
 
-  // At the moment, it is assumed that C, C++, and Fortran have both
-  // assembly and preprocessor capabilities. The same is true for the
-  // ability to export compile commands
-  bool lang_has_preprocessor = ((lang == "C") ||
-                                (lang == "CXX") ||
-                                (lang == "Fortran"));
-  bool const lang_has_assembly = lang_has_preprocessor;
-  bool const lang_can_export_cmds = lang_has_preprocessor;
+  bool lang_is_c_or_cxx = ((lang == "C") || (lang == "CXX"));
 
   // Construct the compile rules.
   {
@@ -722,7 +715,7 @@ cmMakefileTargetGenerator
   cmSystemTools::ExpandListArgument(compileRule, compileCommands);
 
   if (this->Makefile->IsOn("CMAKE_EXPORT_COMPILE_COMMANDS") &&
-      lang_can_export_cmds && compileCommands.size() == 1)
+      lang_is_c_or_cxx && compileCommands.size() == 1)
     {
     std::string compileCommand = compileCommands[0];
     this->LocalGenerator->ExpandRuleVariables(compileCommand, vars);
@@ -778,9 +771,9 @@ cmMakefileTargetGenerator
       }
     }
 
-  bool do_preprocess_rules = lang_has_preprocessor &&
+  bool do_preprocess_rules = lang_is_c_or_cxx &&
     this->LocalGenerator->GetCreatePreprocessedSourceRules();
-  bool do_assembly_rules = lang_has_assembly &&
+  bool do_assembly_rules = lang_is_c_or_cxx &&
     this->LocalGenerator->GetCreateAssemblySourceRules();
   if(do_preprocess_rules || do_assembly_rules)
     {
diff --git a/Tests/FortranOnly/CMakeLists.txt b/Tests/FortranOnly/CMakeLists.txt
index 46a12b4..f55e727 100644
--- a/Tests/FortranOnly/CMakeLists.txt
+++ b/Tests/FortranOnly/CMakeLists.txt
@@ -66,27 +66,3 @@ if(NOT CMAKE_Fortran_COMPILER_ID STREQUAL XL)
       "${err}")
   endif()
 endif()
-
-# Test generation of preprocessed sources.
-if("${CMAKE_GENERATOR}" MATCHES "Makefile" AND CMAKE_MAKE_PROGRAM)
-  if(CMAKE_Fortran_CREATE_PREPROCESSED_SOURCE)
-    # Skip running this part of the test on certain platforms
-    # until they are fixed.
-    set(MAYBE_ALL ALL)
-    list(LENGTH CMAKE_OSX_ARCHITECTURES ARCH_COUNT)
-    if(ARCH_COUNT GREATER 1)
-      # OSX does not support preprocessing more than one architecture.
-      set(MAYBE_ALL)
-    endif()
-
-    add_executable(preprocess preprocess.F)
-
-    # Custom target to try preprocessing invocation.
-    add_custom_target(test_preprocess ${MAYBE_ALL}
-      COMMAND ${CMAKE_COMMAND} -E remove CMakeFiles/preprocess.dir/preprocess.F.i
-      COMMAND ${CMAKE_MAKE_PROGRAM} preprocess.i
-      COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/test_preprocess.cmake
-      WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
-      )
-  endif()
-endif()
diff --git a/Tests/FortranOnly/preprocess.F b/Tests/FortranOnly/preprocess.F
deleted file mode 100644
index f7df457..0000000
--- a/Tests/FortranOnly/preprocess.F
+++ /dev/null
@@ -1,5 +0,0 @@
-       PROGRAM PREPRO
-#ifndef TEST_PREPROCESSOR
-       PRINT *, 'Hello'
-#endif
-       END
diff --git a/Tests/FortranOnly/test_preprocess.cmake b/Tests/FortranOnly/test_preprocess.cmake
deleted file mode 100644
index 29ebdac..0000000
--- a/Tests/FortranOnly/test_preprocess.cmake
+++ /dev/null
@@ -1,7 +0,0 @@
-set(TEST_FILE CMakeFiles/preprocess.dir/preprocess.F.i)
-file(READ ${TEST_FILE} CONTENTS)
-if("${CONTENTS}" MATCHES "PRINT *")
-  message(STATUS "${TEST_FILE} created successfully!")
-else()
-  message(FATAL_ERROR "${TEST_FILE} creation failed!")
-endif()

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

Summary of changes:
 Modules/Compiler/GNU-Fortran.cmake       |    5 ++++
 Modules/Compiler/HP-Fortran.cmake        |    3 ---
 Modules/Compiler/Intel-Fortran.cmake     |    3 ---
 Modules/Compiler/PGI-Fortran.cmake       |    5 ++++
 Modules/Compiler/SunPro-Fortran.cmake    |    3 ---
 Modules/Compiler/XL-Fortran.cmake        |    4 +++
 Modules/Platform/HP-UX-HP-Fortran.cmake  |    3 ---
 Modules/Platform/IRIX.cmake              |    8 ------
 Source/cmLocalUnixMakefileGenerator3.cxx |   43 +++++++++++++-----------------
 Source/cmMakefileTargetGenerator.cxx     |   15 +++--------
 Tests/FortranOnly/CMakeLists.txt         |   24 -----------------
 Tests/FortranOnly/preprocess.F           |    5 ----
 Tests/FortranOnly/test_preprocess.cmake  |    7 -----
 13 files changed, 36 insertions(+), 92 deletions(-)
 delete mode 100644 Tests/FortranOnly/preprocess.F
 delete mode 100644 Tests/FortranOnly/test_preprocess.cmake


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list