Merge topic 'FortranCInterface-VS'
67fcc83 Simplify IntelVSImplicitPath detection project a7ce26d Move IntelVSImplicitPath project to better location 539a822 Enable Fortran tests for IDE builds. 555f589 For VS Intel Fortran IDE builds, add a check to find the Fortran library PATH. 71402eb FortranCInterface: Compile separate Fortran lib in VerifyC[XX]
This commit is contained in:
commit
bef996852e
@ -83,6 +83,29 @@ FUNCTION(CMAKE_DETERMINE_COMPILER_ABI lang src)
|
|||||||
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
|
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
|
||||||
"Parsed ${lang} implicit link information from above output:\n${log}\n\n")
|
"Parsed ${lang} implicit link information from above output:\n${log}\n\n")
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
# for VS IDE Intel Fortran we have to figure out the
|
||||||
|
# implicit link path for the fortran run time using
|
||||||
|
# a try-compile
|
||||||
|
IF("${lang}" MATCHES "Fortran"
|
||||||
|
AND "${CMAKE_GENERATOR}" MATCHES "Visual Studio")
|
||||||
|
SET(_desc "Determine Intel Fortran Compiler Implicit Link Path")
|
||||||
|
MESSAGE(STATUS "${_desc}")
|
||||||
|
# Build a sample project which reports symbols.
|
||||||
|
TRY_COMPILE(IFORT_LIB_PATH_COMPILED
|
||||||
|
${CMAKE_BINARY_DIR}/CMakeFiles/IntelVSImplicitPath
|
||||||
|
${CMAKE_ROOT}/Modules/IntelVSImplicitPath
|
||||||
|
IntelFortranImplicit
|
||||||
|
CMAKE_FLAGS
|
||||||
|
"-DCMAKE_Fortran_FLAGS:STRING=${CMAKE_Fortran_FLAGS}"
|
||||||
|
OUTPUT_VARIABLE _output)
|
||||||
|
FILE(WRITE
|
||||||
|
"${CMAKE_BINARY_DIR}/CMakeFiles/IntelVSImplicitPath/output.txt"
|
||||||
|
"${_output}")
|
||||||
|
INCLUDE(${CMAKE_BINARY_DIR}/CMakeFiles/IntelVSImplicitPath/output.cmake OPTIONAL)
|
||||||
|
SET(_desc "Determine Intel Fortran Compiler Implicit Link Path -- done")
|
||||||
|
MESSAGE(STATUS "${_desc}")
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
SET(CMAKE_${lang}_IMPLICIT_LINK_LIBRARIES "${implicit_libs}" PARENT_SCOPE)
|
SET(CMAKE_${lang}_IMPLICIT_LINK_LIBRARIES "${implicit_libs}" PARENT_SCOPE)
|
||||||
SET(CMAKE_${lang}_IMPLICIT_LINK_DIRECTORIES "${implicit_dirs}" PARENT_SCOPE)
|
SET(CMAKE_${lang}_IMPLICIT_LINK_DIRECTORIES "${implicit_dirs}" PARENT_SCOPE)
|
||||||
|
|
||||||
|
@ -24,7 +24,9 @@ include(FortranCInterface)
|
|||||||
FortranCInterface_HEADER(VerifyFortran.h SYMBOLS VerifyFortran)
|
FortranCInterface_HEADER(VerifyFortran.h SYMBOLS VerifyFortran)
|
||||||
include_directories(${VerifyFortranC_BINARY_DIR})
|
include_directories(${VerifyFortranC_BINARY_DIR})
|
||||||
|
|
||||||
add_executable(VerifyFortranC main.c VerifyC.c VerifyFortran.f ${VerifyCXX})
|
add_library(VerifyFortran STATIC VerifyFortran.f)
|
||||||
|
add_executable(VerifyFortranC main.c VerifyC.c ${VerifyCXX})
|
||||||
|
target_link_libraries(VerifyFortranC VerifyFortran)
|
||||||
|
|
||||||
if(NOT VERIFY_CXX)
|
if(NOT VERIFY_CXX)
|
||||||
# The entry point (main) is defined in C; link with the C compiler.
|
# The entry point (main) is defined in C; link with the C compiler.
|
||||||
|
7
Modules/IntelVSImplicitPath/CMakeLists.txt
Normal file
7
Modules/IntelVSImplicitPath/CMakeLists.txt
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
cmake_minimum_required (VERSION 2.8)
|
||||||
|
project(IntelFortranImplicit Fortran)
|
||||||
|
add_custom_command(
|
||||||
|
OUTPUT output.cmake
|
||||||
|
COMMAND ${CMAKE_COMMAND} -P ${IntelFortranImplicit_SOURCE_DIR}/detect.cmake
|
||||||
|
)
|
||||||
|
add_library(FortranLib hello.f output.cmake)
|
9
Modules/IntelVSImplicitPath/detect.cmake
Normal file
9
Modules/IntelVSImplicitPath/detect.cmake
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# look at each path and try to find ifconsol.lib
|
||||||
|
set(LIB "$ENV{LIB}")
|
||||||
|
foreach(dir ${LIB})
|
||||||
|
file(TO_CMAKE_PATH "${dir}" dir)
|
||||||
|
if(EXISTS "${dir}/ifconsol.lib")
|
||||||
|
file(WRITE output.cmake "list(APPEND implicit_dirs \"${dir}\")\n")
|
||||||
|
break()
|
||||||
|
endif()
|
||||||
|
endforeach()
|
0
Modules/IntelVSImplicitPath/hello.f
Normal file
0
Modules/IntelVSImplicitPath/hello.f
Normal file
@ -1928,29 +1928,36 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
|
|||||||
ENDIF ("${PREVIOUS_TIMEOUT}" MATCHES NOTFOUND)
|
ENDIF ("${PREVIOUS_TIMEOUT}" MATCHES NOTFOUND)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
# fortran does not work for IDE builds because
|
IF(CMAKE_Fortran_COMPILER)
|
||||||
# CMAKE_STANDARD_LIBRARIES needs to be per language
|
ADD_TEST(Fortran ${CMAKE_CTEST_COMMAND}
|
||||||
IF(CMAKE_TEST_GENERATOR MATCHES "Make|KDevelop")
|
--build-and-test
|
||||||
IF(CMAKE_Fortran_COMPILER)
|
"${CMake_SOURCE_DIR}/Tests/Fortran"
|
||||||
ADD_TEST(Fortran ${CMAKE_CTEST_COMMAND}
|
"${CMake_BINARY_DIR}/Tests/Fortran"
|
||||||
|
--build-generator ${CMAKE_TEST_GENERATOR}
|
||||||
|
--build-project testf
|
||||||
|
--build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
|
||||||
|
--build-two-config
|
||||||
|
--test-command testf)
|
||||||
|
LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Fortran")
|
||||||
|
|
||||||
|
# FortranCInterface tests.
|
||||||
|
IF(UNIX)
|
||||||
|
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/FortranC/Flags.cmake.in
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/FortranC/Flags.cmake @ONLY)
|
||||||
|
ADD_TEST(FortranC.Flags ${CMAKE_CMAKE_COMMAND} -P
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/FortranC/Flags.cmake)
|
||||||
|
LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/FortranC/Flags")
|
||||||
|
ELSE()
|
||||||
|
ADD_TEST(FortranC ${CMAKE_CTEST_COMMAND}
|
||||||
--build-and-test
|
--build-and-test
|
||||||
"${CMake_SOURCE_DIR}/Tests/Fortran"
|
"${CMake_SOURCE_DIR}/Tests/FortranC"
|
||||||
"${CMake_BINARY_DIR}/Tests/Fortran"
|
"${CMake_BINARY_DIR}/Tests/FortranC"
|
||||||
--build-generator ${CMAKE_TEST_GENERATOR}
|
--build-generator ${CMAKE_TEST_GENERATOR}
|
||||||
--build-project testf
|
--build-project FortranC
|
||||||
--build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
|
--build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
|
||||||
--build-two-config
|
--build-two-config
|
||||||
--test-command testf)
|
--test-command CMakeFiles/FortranCInterface/FortranCInterface)
|
||||||
LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Fortran")
|
LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/FortranC")
|
||||||
|
|
||||||
# FortranCInterface tests.
|
|
||||||
IF(UNIX)
|
|
||||||
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/FortranC/Flags.cmake.in
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/FortranC/Flags.cmake @ONLY)
|
|
||||||
ADD_TEST(FortranC.Flags ${CMAKE_CMAKE_COMMAND} -P
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/FortranC/Flags.cmake)
|
|
||||||
LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/FortranC/Flags")
|
|
||||||
ENDIF()
|
|
||||||
ENDIF()
|
ENDIF()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user