summaryrefslogtreecommitdiffstats
path: root/Tests/Fortran
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2009-07-27 16:43:42 (GMT)
committerBrad King <brad.king@kitware.com>2009-07-27 16:43:42 (GMT)
commit2b849a77a6e108100cae8d1ae59be2a7727a66ec (patch)
tree75304fec96220ca657523ca12377099ab4ece647 /Tests/Fortran
parent1c98cdf2243313932eec329efcad5180591e177b (diff)
downloadCMake-2b849a77a6e108100cae8d1ae59be2a7727a66ec.zip
CMake-2b849a77a6e108100cae8d1ae59be2a7727a66ec.tar.gz
CMake-2b849a77a6e108100cae8d1ae59be2a7727a66ec.tar.bz2
ENH: Test Fortran and C++ in one executable
This extends the Fortran-to-C interface test to add a C++ source file. The executable can only link with the C++ linker and with the proper Fortran runtime libraries. These libraries should be detected by CMake automatically, so this tests verifies the detection functionality.
Diffstat (limited to 'Tests/Fortran')
-rw-r--r--Tests/Fortran/CMakeLists.txt4
-rw-r--r--Tests/Fortran/foo.c2
-rw-r--r--Tests/Fortran/foo.cxx6
3 files changed, 9 insertions, 3 deletions
diff --git a/Tests/Fortran/CMakeLists.txt b/Tests/Fortran/CMakeLists.txt
index d11d299..91390e9 100644
--- a/Tests/Fortran/CMakeLists.txt
+++ b/Tests/Fortran/CMakeLists.txt
@@ -1,5 +1,5 @@
cmake_minimum_required (VERSION 2.6)
-project(testf Fortran C)
+project(testf Fortran C CXX)
message("CTEST_FULL_OUTPUT ")
set(CMAKE_VERBOSE_MAKEFILE 1)
message("ENV_FLAGS = $ENV{FFLAGS}")
@@ -30,7 +30,7 @@ function(test_fortran_c_interface_module)
endif(FORTRAN_C_MODULE_MANGLING_FOUND)
endif()
set(FORTRAN_FUNCTIONS ${FORTRAN_FUNCTIONS} my_sub mysub )
- set(srcs ${srcs} mysub.f foo.c)
+ set(srcs ${srcs} mysub.f foo.c foo.cxx)
create_fortran_c_interface("F_" FORTRAN_FUNCTIONS
"${testf_BINARY_DIR}/foo.h")
include_directories("${testf_BINARY_DIR}")
diff --git a/Tests/Fortran/foo.c b/Tests/Fortran/foo.c
index f03aec1..7837534 100644
--- a/Tests/Fortran/foo.c
+++ b/Tests/Fortran/foo.c
@@ -1,7 +1,7 @@
#include "foo.h"
extern F_test_mod_sub();
extern F_mysub();
-int main()
+int foo()
{
F_mysub();
F_my_sub();
diff --git a/Tests/Fortran/foo.cxx b/Tests/Fortran/foo.cxx
new file mode 100644
index 0000000..bb3117f
--- /dev/null
+++ b/Tests/Fortran/foo.cxx
@@ -0,0 +1,6 @@
+extern "C" int foo(void);
+int main()
+{
+ delete new int;
+ return foo();
+}