[Cmake-commits] CMake branch, next, updated. v3.6.2-2497-g519b317
Brad King
brad.king at kitware.com
Mon Sep 26 13:19:26 EDT 2016
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 519b3173245cc53bd33b22e0b6bfe3780faf9160 (commit)
via 7bfd5b7fa568862ec4b31539b1ba705f1c9f6bd0 (commit)
from 5e2813bc7a5fc95e09da993384bad8801df476ee (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 -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=519b3173245cc53bd33b22e0b6bfe3780faf9160
commit 519b3173245cc53bd33b22e0b6bfe3780faf9160
Merge: 5e2813b 7bfd5b7
Author: Brad King <brad.king at kitware.com>
AuthorDate: Mon Sep 26 13:19:24 2016 -0400
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Mon Sep 26 13:19:24 2016 -0400
Merge topic 'ninja-include-dir' into next
7bfd5b7f Ninja: Add source location as include directory for preprocessed files
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7bfd5b7fa568862ec4b31539b1ba705f1c9f6bd0
commit 7bfd5b7fa568862ec4b31539b1ba705f1c9f6bd0
Author: Nils Gladitz <nilsgladitz at gmail.com>
AuthorDate: Fri Sep 23 22:59:37 2016 +0200
Commit: Nils Gladitz <nilsgladitz at gmail.com>
CommitDate: Mon Sep 26 17:57:11 2016 +0200
Ninja: Add source location as include directory for preprocessed files
Fortran INCLUDE statements are not handled by the preprocessor.
Since the location of the preprocessed file is distinct from the
original source file explicitly add the source file's directory
as an include path in the actual compile step (not the preprocessing step)
so INCLUDE can find it.
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index b418ce3..f88eb7b 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -841,6 +841,18 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement(
// directive.
ppVars["INCLUDES"] = vars["INCLUDES"];
+ // Prepend source file's original directory as an include directory
+ // so e.g. Fortran INCLUDE statements can look for files in it.
+ std::vector<std::string> sourceDirectory;
+ sourceDirectory.push_back(
+ cmSystemTools::GetParentDirectory(source->GetFullPath()));
+
+ std::string sourceDirectoryFlag = this->LocalGenerator->GetIncludeFlags(
+ sourceDirectory, this->GeneratorTarget, language, false, false,
+ this->GetConfigName());
+
+ vars["INCLUDES"] = sourceDirectoryFlag + " " + vars["INCLUDES"];
+
// Explicit preprocessing always uses a depfile.
ppVars["DEP_FILE"] =
cmGlobalNinjaGenerator::EncodeDepfileSpace(ppFileName + ".d");
diff --git a/Tests/FortranModules/CMakeLists.txt b/Tests/FortranModules/CMakeLists.txt
index ff12771..3996600 100644
--- a/Tests/FortranModules/CMakeLists.txt
+++ b/Tests/FortranModules/CMakeLists.txt
@@ -52,6 +52,8 @@ add_definitions(-DFOO -DBAR=1)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
add_executable(test_preprocess test_preprocess.F90 test_preprocess_module.F90)
+add_executable(test_non_pp_include test_non_pp_include_main.f90)
+
# Build the external project separately using a custom target.
# Make sure it uses the same build configuration as this test.
if(CMAKE_CONFIGURATION_TYPES)
diff --git a/Tests/FortranModules/non_pp_include.f90 b/Tests/FortranModules/non_pp_include.f90
new file mode 100644
index 0000000..7eb1725
--- /dev/null
+++ b/Tests/FortranModules/non_pp_include.f90
@@ -0,0 +1,3 @@
+SUBROUTINE NON_PP_INCLUDE_SUBROUTINE
+ PRINT *, "Hello World!"
+END SUBROUTINE NON_PP_INCLUDE_SUBROUTINE
diff --git a/Tests/FortranModules/test_non_pp_include_main.f90 b/Tests/FortranModules/test_non_pp_include_main.f90
new file mode 100644
index 0000000..8a04fbd
--- /dev/null
+++ b/Tests/FortranModules/test_non_pp_include_main.f90
@@ -0,0 +1,5 @@
+INCLUDE "non_pp_include.f90"
+
+PROGRAM MAINF90
+ CALL NON_PP_INCLUDE_SUBROUTINE
+END PROGRAM MAINF90
-----------------------------------------------------------------------
Summary of changes:
Source/cmNinjaTargetGenerator.cxx | 12 ++++++++++++
Tests/FortranModules/CMakeLists.txt | 2 ++
Tests/FortranModules/non_pp_include.f90 | 3 +++
Tests/FortranModules/test_non_pp_include_main.f90 | 5 +++++
4 files changed, 22 insertions(+)
create mode 100644 Tests/FortranModules/non_pp_include.f90
create mode 100644 Tests/FortranModules/test_non_pp_include_main.f90
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list