Simplify IntelVSImplicitPath detection project
Use the ENV{LIB} variable directly instead of parsing the output of the whole environment from "set". Store the output in a .cmake script and include it from CMakeDetermineCompilerABI instead of using file(READ).
This commit is contained in:
parent
a7ce26d837
commit
67fcc838d9
|
@ -98,13 +98,10 @@ FUNCTION(CMAKE_DETERMINE_COMPILER_ABI lang src)
|
||||||
CMAKE_FLAGS
|
CMAKE_FLAGS
|
||||||
"-DCMAKE_Fortran_FLAGS:STRING=${CMAKE_Fortran_FLAGS}"
|
"-DCMAKE_Fortran_FLAGS:STRING=${CMAKE_Fortran_FLAGS}"
|
||||||
OUTPUT_VARIABLE _output)
|
OUTPUT_VARIABLE _output)
|
||||||
FILE(READ
|
|
||||||
${CMAKE_BINARY_DIR}/CMakeFiles/IntelVSImplicitPath/implict_link.txt
|
|
||||||
dir)
|
|
||||||
LIST(APPEND implicit_dirs "${dir}")
|
|
||||||
FILE(WRITE
|
FILE(WRITE
|
||||||
"${CMAKE_BINARY_DIR}/CMakeFiles/IntelVSImplicitPath/output.txt"
|
"${CMAKE_BINARY_DIR}/CMakeFiles/IntelVSImplicitPath/output.txt"
|
||||||
"${_output}")
|
"${_output}")
|
||||||
|
INCLUDE(${CMAKE_BINARY_DIR}/CMakeFiles/IntelVSImplicitPath/output.cmake OPTIONAL)
|
||||||
SET(_desc "Determine Intel Fortran Compiler Implicit Link Path -- done")
|
SET(_desc "Determine Intel Fortran Compiler Implicit Link Path -- done")
|
||||||
MESSAGE(STATUS "${_desc}")
|
MESSAGE(STATUS "${_desc}")
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
|
@ -1,11 +1,7 @@
|
||||||
cmake_minimum_required (VERSION 2.8)
|
cmake_minimum_required (VERSION 2.8)
|
||||||
project(IntelFortranImplicit Fortran)
|
project(IntelFortranImplicit Fortran)
|
||||||
add_custom_command(OUTPUT ${IntelFortranImplicit_BINARY_DIR}/env.txt
|
add_custom_command(
|
||||||
COMMAND set > ${IntelFortranImplicit_BINARY_DIR}/env.txt)
|
OUTPUT output.cmake
|
||||||
add_library(FortranLib hello.f
|
COMMAND ${CMAKE_COMMAND} -P ${IntelFortranImplicit_SOURCE_DIR}/detect.cmake
|
||||||
${IntelFortranImplicit_BINARY_DIR}/env.txt)
|
)
|
||||||
add_custom_target(ExtractLibPath ALL
|
add_library(FortranLib hello.f output.cmake)
|
||||||
COMMAND ${CMAKE_COMMAND} -P ${IntelFortranImplicit_SOURCE_DIR}/extract.cmake
|
|
||||||
WORKING_DIRECTORY ${IntelFortranImplicit_BINARY_DIR}
|
|
||||||
)
|
|
||||||
add_dependencies(ExtractLibPath FortranLib)
|
|
||||||
|
|
|
@ -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()
|
|
@ -1,12 +0,0 @@
|
||||||
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()
|
|
Loading…
Reference in New Issue