summaryrefslogtreecommitdiffstats
path: root/Modules/FortranCInterface
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2011-09-08 21:42:49 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2011-09-08 21:42:49 (GMT)
commit555f589a5a3e9387956d451dc253fa1e3f35adff (patch)
treecbc1f8942da0b0d901032eebeddc43c73338e073 /Modules/FortranCInterface
parent71402eb25244e5805df54c2f6e62ddd36201dbd6 (diff)
downloadCMake-555f589a5a3e9387956d451dc253fa1e3f35adff.zip
CMake-555f589a5a3e9387956d451dc253fa1e3f35adff.tar.gz
CMake-555f589a5a3e9387956d451dc253fa1e3f35adff.tar.bz2
For VS Intel Fortran IDE builds, add a check to find the Fortran library PATH.
To use VS C and Fotran in the same solution, it is required that VS be able to find the Fortran run time libraries as they will be implicitly linked by any Fortran library used by VS C programs. This adds a check into CMakeDetermineCompilerABI using a try-compile to find the correct PATH.
Diffstat (limited to 'Modules/FortranCInterface')
-rw-r--r--Modules/FortranCInterface/IntelVSImplicitPath/CMakeLists.txt11
-rw-r--r--Modules/FortranCInterface/IntelVSImplicitPath/extract.cmake12
-rw-r--r--Modules/FortranCInterface/IntelVSImplicitPath/hello.f0
3 files changed, 23 insertions, 0 deletions
diff --git a/Modules/FortranCInterface/IntelVSImplicitPath/CMakeLists.txt b/Modules/FortranCInterface/IntelVSImplicitPath/CMakeLists.txt
new file mode 100644
index 0000000..e2a4b3f
--- /dev/null
+++ b/Modules/FortranCInterface/IntelVSImplicitPath/CMakeLists.txt
@@ -0,0 +1,11 @@
+cmake_minimum_required (VERSION 2.8)
+project(IntelFortranImplicit Fortran)
+add_custom_command(OUTPUT ${IntelFortranImplicit_BINARY_DIR}/env.txt
+ COMMAND set > ${IntelFortranImplicit_BINARY_DIR}/env.txt)
+add_library(FortranLib hello.f
+ ${IntelFortranImplicit_BINARY_DIR}/env.txt)
+add_custom_target(ExtractLibPath ALL
+ COMMAND ${CMAKE_COMMAND} -P ${IntelFortranImplicit_SOURCE_DIR}/extract.cmake
+ WORKING_DIRECTORY ${IntelFortranImplicit_BINARY_DIR}
+)
+add_dependencies(ExtractLibPath FortranLib)
diff --git a/Modules/FortranCInterface/IntelVSImplicitPath/extract.cmake b/Modules/FortranCInterface/IntelVSImplicitPath/extract.cmake
new file mode 100644
index 0000000..055247c
--- /dev/null
+++ b/Modules/FortranCInterface/IntelVSImplicitPath/extract.cmake
@@ -0,0 +1,12 @@
+file(STRINGS env.txt LIB REGEX "^LIB=.*$")
+string(REPLACE "LIB=" "" LIB "${LIB}" )
+# change LIB from a string to a ; separated list of paths
+set(LIB ${LIB})
+# look at each path and try to find ifconsol.lib
+foreach( dir ${LIB})
+ file(TO_CMAKE_PATH "${dir}" dir)
+ if(EXISTS "${dir}/ifconsol.lib")
+ file(WRITE implict_link.txt ${dir})
+ return()
+ endif()
+endforeach()
diff --git a/Modules/FortranCInterface/IntelVSImplicitPath/hello.f b/Modules/FortranCInterface/IntelVSImplicitPath/hello.f
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Modules/FortranCInterface/IntelVSImplicitPath/hello.f