[Cmake-commits] CMake branch, next, updated. v2.8.5-1425-g37f7336
Bill Hoffman
bill.hoffman at kitware.com
Wed Aug 3 17:35:05 EDT 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 37f733655d38bae199003a9b7f7d70d5ea69162b (commit)
via 3c53fbb1f0d7276d0ef1f07facb2a1d937fc5153 (commit)
from 68f42779d377e5e6a11c386d12c0de20ce904777 (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=37f733655d38bae199003a9b7f7d70d5ea69162b
commit 37f733655d38bae199003a9b7f7d70d5ea69162b
Merge: 68f4277 3c53fbb
Author: Bill Hoffman <bill.hoffman at kitware.com>
AuthorDate: Wed Aug 3 17:34:53 2011 -0400
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Wed Aug 3 17:34:53 2011 -0400
Merge topic 'intel_fortran_vs2010' into next
3c53fbb Fix custom commands in VS2010 Fortran projects using CFG_INTDIR and test.
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3c53fbb1f0d7276d0ef1f07facb2a1d937fc5153
commit 3c53fbb1f0d7276d0ef1f07facb2a1d937fc5153
Author: Bill Hoffman <bill.hoffman at kitware.com>
AuthorDate: Wed Aug 3 17:24:43 2011 -0400
Commit: Bill Hoffman <bill.hoffman at kitware.com>
CommitDate: Wed Aug 3 17:24:43 2011 -0400
Fix custom commands in VS2010 Fortran projects using CFG_INTDIR and test.
For custom commands in VS2010 Fortran projects the INTDIR variable
is different than in the rest of the solution because Intel
fortran still uses the old VS project files even in VS2010. So,
we replace $(Configuration) directly in the project files. I have also
added a FortranOnly test that tests this feature and is run on any
generator that has Fortran abilities.
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 7a62b9c..d254164 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -1622,6 +1622,10 @@ WriteCustomRule(std::ostream& fout,
}
std::string script = this->ConstructScript(command, i->c_str());
+ if(this->FortranProject)
+ {
+ cmSystemTools::ReplaceString(script, "$(Configuration)", i->c_str());
+ }
fout << "\t\t\t\t\t<Tool\n"
<< "\t\t\t\t\tName=\"" << customTool << "\"\n"
<< "\t\t\t\t\tDescription=\""
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index d710405..183399f 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -1563,6 +1563,13 @@ void cmVisualStudio10TargetGenerator::WriteProjectReferences()
i != depends.end(); ++i)
{
cmTarget* dt = *i;
+ // skip fortran targets as they can not be processed by MSBuild
+ // the only reference will be in the .sln file
+ if(static_cast<cmGlobalVisualStudioGenerator*>(this->GlobalGenerator)
+ ->TargetIsFortranOnly(*dt))
+ {
+ continue;
+ }
this->WriteString("<ProjectReference Include=\"", 2);
cmMakefile* mf = dt->GetMakefile();
std::string name = dt->GetName();
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 2ad9a77..da4eda0 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -16,6 +16,8 @@ MACRO(ADD_TEST_MACRO NAME COMMAND)
LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/${dir}")
ENDMACRO(ADD_TEST_MACRO)
+INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/CheckFortran.cmake)
+
# Fake a user home directory to avoid polluting the real one.
IF(DEFINED ENV{HOME} AND NOT CTEST_NO_TEST_HOME)
SET(TEST_HOME "${CMake_BINARY_DIR}/Tests/CMakeFiles/TestHome")
@@ -155,6 +157,9 @@ IF(BUILD_TESTING)
ADD_TEST_MACRO(MissingSourceFile MissingSourceFile)
SET_TESTS_PROPERTIES(MissingSourceFile PROPERTIES
PASS_REGULAR_EXPRESSION "CMake Error at CMakeLists.txt:3 \\(add_executable\\):[ \r\n]*Cannot find source file:[ \r\n]*DoesNotExist/MissingSourceFile.c")
+ IF(CMAKE_Fortran_COMPILER)
+ ADD_TEST_MACRO(FortranOnly FortranOnly)
+ ENDIF()
ADD_TEST_MACRO(COnly COnly)
ADD_TEST_MACRO(CxxOnly CxxOnly)
ADD_TEST_MACRO(IPO COnly/COnly)
@@ -1879,7 +1884,6 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
# fortran does not work for IDE builds because
# CMAKE_STANDARD_LIBRARIES needs to be per language
IF(CMAKE_TEST_GENERATOR MATCHES "Make|KDevelop")
- INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/CheckFortran.cmake)
IF(CMAKE_Fortran_COMPILER)
ADD_TEST(Fortran ${CMAKE_CTEST_COMMAND}
--build-and-test
diff --git a/Tests/FortranOnly/CMakeLists.txt b/Tests/FortranOnly/CMakeLists.txt
new file mode 100644
index 0000000..3c4f0e7
--- /dev/null
+++ b/Tests/FortranOnly/CMakeLists.txt
@@ -0,0 +1,42 @@
+cmake_minimum_required (VERSION 2.8)
+project(FortranOnly Fortran)
+message("CTEST_FULL_OUTPUT ")
+
+# create a library with hello and world functions
+add_library(FortranOnlylib hello.f world.f)
+# create an executable that calls hello and world
+add_executable(FortranOnly testf.f)
+target_link_libraries(FortranOnly FortranOnlylib)
+
+# create a custom command that runs FortranOnly and puts
+# the output into the file testfhello.txt
+add_custom_command(OUTPUT ${FortranOnly_BINARY_DIR}/testfhello.txt
+ COMMAND ${FortranOnly_BINARY_DIR}/${CMAKE_CFG_INTDIR}/FortranOnly
+ > testfhello.txt)
+# create a second executable FortranOnly2 that has
+# testfhello.txt has an source file so that it will
+# run the above custom command.
+add_executable(FortranOnly2 testfhello.txt testf.f)
+target_link_libraries(FortranOnly2 FortranOnlylib)
+# create a custom target to check the content of testfhello.txt
+# by running the cmake script checktestf2.cmake
+add_custom_target(checktestf2 ALL
+ COMMAND ${CMAKE_COMMAND}
+ -P ${FortranOnly_SOURCE_DIR}/checktestf2.cmake)
+
+# create a custom target that runs FortranOnly exectuable and creates
+# a file out.txt that should have hello world in it.
+add_custom_target(sayhello ALL
+ COMMAND ${FortranOnly_BINARY_DIR}/${CMAKE_CFG_INTDIR}/FortranOnly > out.txt
+)
+# make sure stuff is built in the right order
+add_dependencies(checktestf2 FortranOnly2)
+add_dependencies(sayhello FortranOnly)
+add_dependencies(FortranOnly2 FortranOnly)
+
+# add a custom target that checkes that out.txt has the correct
+# content
+add_custom_target(checksayhello ALL
+ COMMAND ${CMAKE_COMMAND} -P ${FortranOnly_SOURCE_DIR}/checksayhello.cmake
+ )
+add_dependencies(checksayhello sayhello)
diff --git a/Tests/FortranOnly/checksayhello.cmake b/Tests/FortranOnly/checksayhello.cmake
new file mode 100644
index 0000000..5352290
--- /dev/null
+++ b/Tests/FortranOnly/checksayhello.cmake
@@ -0,0 +1,7 @@
+file(READ out.txt IN)
+message("${IN}")
+if(IN MATCHES Hello AND IN MATCHES World)
+ message("Passed")
+else()
+ message(FATAL_ERROR "Hello world not found")
+endif()
diff --git a/Tests/FortranOnly/checktestf2.cmake b/Tests/FortranOnly/checktestf2.cmake
new file mode 100644
index 0000000..f0e6be3
--- /dev/null
+++ b/Tests/FortranOnly/checktestf2.cmake
@@ -0,0 +1,8 @@
+file(READ testfhello.txt IN)
+message("${IN}")
+if(IN MATCHES Hello AND IN MATCHES World)
+ message("Passed")
+else()
+ message(FATAL_ERROR "Hello world not found")
+endif()
+file(WRITE testfhello2.txt ${IN})
diff --git a/Tests/FortranOnly/hello.f b/Tests/FortranOnly/hello.f
new file mode 100644
index 0000000..63e6408
--- /dev/null
+++ b/Tests/FortranOnly/hello.f
@@ -0,0 +1,5 @@
+ SUBROUTINE HELLO
+
+ PRINT *, 'Hello'
+
+ END
diff --git a/Tests/FortranOnly/testf.f b/Tests/FortranOnly/testf.f
new file mode 100644
index 0000000..4909181
--- /dev/null
+++ b/Tests/FortranOnly/testf.f
@@ -0,0 +1,6 @@
+ PROGRAM TESTF
+
+ CALL HELLO()
+ CALL WORLD()
+
+ END
diff --git a/Tests/FortranOnly/world.f b/Tests/FortranOnly/world.f
new file mode 100644
index 0000000..deae3fa
--- /dev/null
+++ b/Tests/FortranOnly/world.f
@@ -0,0 +1,5 @@
+ SUBROUTINE WORLD
+
+ PRINT *, 'World!'
+
+ END
-----------------------------------------------------------------------
Summary of changes:
Source/cmLocalVisualStudio7Generator.cxx | 4 ++
Source/cmVisualStudio10TargetGenerator.cxx | 7 ++++
Tests/CMakeLists.txt | 6 +++-
Tests/FortranOnly/CMakeLists.txt | 42 ++++++++++++++++++++++++++++
Tests/FortranOnly/checksayhello.cmake | 7 ++++
Tests/FortranOnly/checktestf2.cmake | 8 +++++
Tests/{Fortran => FortranOnly}/hello.f | 1 -
Tests/{Fortran => FortranOnly}/testf.f | 1 -
Tests/{Fortran => FortranOnly}/world.f | 1 -
9 files changed, 73 insertions(+), 4 deletions(-)
create mode 100644 Tests/FortranOnly/CMakeLists.txt
create mode 100644 Tests/FortranOnly/checksayhello.cmake
create mode 100644 Tests/FortranOnly/checktestf2.cmake
copy Tests/{Fortran => FortranOnly}/hello.f (97%)
copy Tests/{Fortran => FortranOnly}/testf.f (98%)
copy Tests/{Fortran => FortranOnly}/world.f (97%)
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list