[Cmake-commits] CMake branch, next, updated. v2.8.7-2689-g7c29e98

Bill Hoffman bill.hoffman at kitware.com
Fri Feb 17 12:48:07 EST 2012


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  7c29e989f39c726546c45c8645d93736f7906b6d (commit)
       via  9090572f5cdde7b30d2c1ad1c0bbf4ab86ddb969 (commit)
      from  0f856c54befc47dc4b9238e5a877435b27135f91 (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=7c29e989f39c726546c45c8645d93736f7906b6d
commit 7c29e989f39c726546c45c8645d93736f7906b6d
Merge: 0f856c5 9090572
Author:     Bill Hoffman <bill.hoffman at kitware.com>
AuthorDate: Fri Feb 17 12:48:06 2012 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Fri Feb 17 12:48:06 2012 -0500

    Merge topic 'inject_code_via_variable' into next
    
    9090572 Add ability to include a file in a project via a cache variable.


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9090572f5cdde7b30d2c1ad1c0bbf4ab86ddb969
commit 9090572f5cdde7b30d2c1ad1c0bbf4ab86ddb969
Author:     Bill Hoffman <bill.hoffman at kitware.com>
AuthorDate: Fri Feb 17 12:41:39 2012 -0500
Commit:     Bill Hoffman <bill.hoffman at kitware.com>
CommitDate: Fri Feb 17 12:41:39 2012 -0500

    Add ability to include a file in a project via a cache variable.
    
    If a variable exists called CMAKE_PROJECT_<projectName>_INCLUDE,
    the file pointed to by that variable will be included as the last step
    of the project command.

diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx
index 6e3b6af..4c1abcf 100644
--- a/Source/cmProjectCommand.cxx
+++ b/Source/cmProjectCommand.cxx
@@ -77,6 +77,24 @@ bool cmProjectCommand
     languages.push_back("CXX");
     }
   this->Makefile->EnableLanguage(languages, false);
+  std::string extraInclude = "CMAKE_PROJECT_" + args[0] + "_INCLUDE";
+  const char* include = this->Makefile->GetDefinition(extraInclude.c_str());
+  if(include)
+    {
+    std::string fullFilePath;
+    bool readit =
+      this->Makefile->ReadListFile( this->Makefile->GetCurrentListFile(),
+                                    include);
+    if(!readit && !cmSystemTools::GetFatalErrorOccured())
+      {
+      std::string m =
+        "could not find load file:\n"
+        "  ";
+      m += include;
+      this->SetError(m.c_str());
+      return false;
+      }
+    }
   return true;
 }
 
diff --git a/Source/cmProjectCommand.h b/Source/cmProjectCommand.h
index fc2b7a2..1e5fc09 100644
--- a/Source/cmProjectCommand.h
+++ b/Source/cmProjectCommand.h
@@ -68,7 +68,10 @@ public:
       "By default C and CXX are enabled.  E.g. if you do not have a "
       "C++ compiler, you can disable the check for it by explicitly listing "
       "the languages you want to support, e.g. C.  By using the special "
-      "language \"NONE\" all checks for any language can be disabled.";
+      "language \"NONE\" all checks for any language can be disabled. "
+      "If a variable exists called CMAKE_PROJECT_<projectName>_INCLUDE_FILE, "
+      "the file pointed to by that variable will be included as the last step "
+      "of the project command.";
     }
   
   cmTypeMacro(cmProjectCommand, cmCommand);
diff --git a/Tests/CMakeOnly/CMakeLists.txt b/Tests/CMakeOnly/CMakeLists.txt
index 4407efb..629f578 100644
--- a/Tests/CMakeOnly/CMakeLists.txt
+++ b/Tests/CMakeOnly/CMakeLists.txt
@@ -22,3 +22,11 @@ add_CMakeOnly_test(CheckLanguage)
 add_CMakeOnly_test(AllFindModules)
 
 add_CMakeOnly_test(TargetScope)
+
+add_CMakeOnly_test(ProjectInclude)
+
+add_test(CMakeOnly.ProjectInclude ${CMAKE_CMAKE_COMMAND}
+  -DTEST=ProjectInclude
+  -DCMAKE_ARGS=-DCMAKE_PROJECT_ProjectInclude_INCLUDE=${CMAKE_CURRENT_SOURCE_DIR}/ProjectInclude/include.cmake
+  -P ${CMAKE_CURRENT_BINARY_DIR}/Test.cmake
+  )
diff --git a/Tests/CMakeOnly/ProjectInclude/CMakeLists.txt b/Tests/CMakeOnly/ProjectInclude/CMakeLists.txt
new file mode 100644
index 0000000..a9abb4a
--- /dev/null
+++ b/Tests/CMakeOnly/ProjectInclude/CMakeLists.txt
@@ -0,0 +1,4 @@
+project(ProjectInclude)
+if(NOT AUTO_INCLUDE)
+  message(FATAL_ERROR "include file not found")
+endif()
diff --git a/Tests/CMakeOnly/ProjectInclude/include.cmake b/Tests/CMakeOnly/ProjectInclude/include.cmake
new file mode 100644
index 0000000..527ebe7
--- /dev/null
+++ b/Tests/CMakeOnly/ProjectInclude/include.cmake
@@ -0,0 +1 @@
+set(AUTO_INCLUDE TRUE)
diff --git a/Tests/CMakeOnly/Test.cmake.in b/Tests/CMakeOnly/Test.cmake.in
index aa2d093..42af068 100644
--- a/Tests/CMakeOnly/Test.cmake.in
+++ b/Tests/CMakeOnly/Test.cmake.in
@@ -3,7 +3,8 @@ set(binary_dir "@CMAKE_CURRENT_BINARY_DIR@/${TEST}-build")
 file(REMOVE_RECURSE "${binary_dir}")
 file(MAKE_DIRECTORY "${binary_dir}")
 execute_process(
-  COMMAND ${CMAKE_COMMAND} "${source_dir}" -G "@CMAKE_TEST_GENERATOR@"
+  COMMAND  ${CMAKE_COMMAND} ${CMAKE_ARGS}
+  "${source_dir}" -G "@CMAKE_TEST_GENERATOR@"
   WORKING_DIRECTORY "${binary_dir}"
   RESULT_VARIABLE result
   )

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

Summary of changes:
 Source/cmProjectCommand.cxx                   |   18 ++++++++++++++++++
 Source/cmProjectCommand.h                     |    5 ++++-
 Tests/CMakeOnly/CMakeLists.txt                |    8 ++++++++
 Tests/CMakeOnly/ProjectInclude/CMakeLists.txt |    4 ++++
 Tests/CMakeOnly/ProjectInclude/include.cmake  |    1 +
 Tests/CMakeOnly/Test.cmake.in                 |    3 ++-
 6 files changed, 37 insertions(+), 2 deletions(-)
 create mode 100644 Tests/CMakeOnly/ProjectInclude/CMakeLists.txt
 create mode 100644 Tests/CMakeOnly/ProjectInclude/include.cmake


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list