mirror of
https://github.com/reactos/CMake.git
synced 2024-11-23 19:49:51 +00:00
Add NAG Fortran compiler information files
On Linux the NAG Fortran compiler uses gcc under the hood to link. Use "-Wl,-v" to pass "-v" to the underlying gcc compiler to get verbose link output. Detect the NAG Fortran directory (using -dryrun) and then honor object files in the directory referenced in the implicit link line. Pass real linker options with "-Wl,-Xlinker,". The -Wl, gets through the NAG front-end and the -Xlinker gets through the gcc front-end.
This commit is contained in:
parent
24cc3d4817
commit
af2ad90991
32
Modules/Compiler/NAG-Fortran.cmake
Normal file
32
Modules/Compiler/NAG-Fortran.cmake
Normal file
@ -0,0 +1,32 @@
|
||||
# Help CMAKE_PARSE_IMPLICIT_LINK_INFO detect NAG Fortran object files.
|
||||
if(NOT CMAKE_Fortran_COMPILER_WORKS AND NOT CMAKE_Fortran_COMPILER_FORCED)
|
||||
message(STATUS "Detecting NAG Fortran directory")
|
||||
# Run with -dryrun to see sample "link" line.
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_Fortran_COMPILER} dummy.o -dryrun
|
||||
OUTPUT_VARIABLE _dryrun
|
||||
ERROR_VARIABLE _dryrun
|
||||
)
|
||||
# Match an object file.
|
||||
string(REGEX MATCH "/[^ ]*/[^ /][^ /]*\\.o" _nag_obj "${_dryrun}")
|
||||
if(_nag_obj)
|
||||
# Parse object directory and convert to a regex.
|
||||
string(REGEX REPLACE "/[^/]*$" "" _nag_dir "${_nag_obj}")
|
||||
string(REGEX REPLACE "([][+.*()^])" "\\\\\\1" _nag_regex "${_nag_dir}")
|
||||
set(CMAKE_Fortran_IMPLICIT_OBJECT_REGEX "^${_nag_regex}/")
|
||||
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
|
||||
"Detecting NAG Fortran directory with -dryrun found\n"
|
||||
" object: ${_nag_obj}\n"
|
||||
" directory: ${_nag_dir}\n"
|
||||
" regex: ${CMAKE_Fortran_IMPLICIT_OBJECT_REGEX}\n"
|
||||
"from output:\n${_dryrun}\n\n")
|
||||
message(STATUS "Detecting NAG Fortran directory - ${_nag_dir}")
|
||||
else()
|
||||
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
|
||||
"Detecting NAG Fortran directory with -dryrun failed:\n${_dryrun}\n\n")
|
||||
message(STATUS "Detecting NAG Fortran directory - failed")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(CMAKE_Fortran_MODDIR_FLAG "-mdir ")
|
||||
set(CMAKE_SHARED_LIBRARY_Fortran_FLAGS "-PIC")
|
5
Modules/Platform/Darwin-NAG-Fortran.cmake
Normal file
5
Modules/Platform/Darwin-NAG-Fortran.cmake
Normal file
@ -0,0 +1,5 @@
|
||||
set(CMAKE_Fortran_VERBOSE_FLAG "-Wl,-v") # Runs gcc under the hood.
|
||||
|
||||
# Need -fpp explicitly on case-insensitive filesystem.
|
||||
set(CMAKE_Fortran_COMPILE_OBJECT
|
||||
"<CMAKE_Fortran_COMPILER> -fpp -o <OBJECT> <DEFINES> <FLAGS> -c <SOURCE>")
|
10
Modules/Platform/Linux-NAG-Fortran.cmake
Normal file
10
Modules/Platform/Linux-NAG-Fortran.cmake
Normal file
@ -0,0 +1,10 @@
|
||||
set(CMAKE_Fortran_VERBOSE_FLAG "-Wl,-v") # Runs gcc under the hood.
|
||||
|
||||
# Need one "-Wl," level to send flag through to gcc.
|
||||
# Use "-Xlinker" to get through gcc to real linker.
|
||||
set(CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS "-Wl,-shared")
|
||||
set(CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG "-Wl,-Xlinker,-rpath,-Xlinker,")
|
||||
set(CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG_SEP ":")
|
||||
set(CMAKE_SHARED_LIBRARY_RPATH_LINK_Fortran_FLAG "-Wl,-Xlinker,-rpath-link,-Xlinker,")
|
||||
set(CMAKE_SHARED_LIBRARY_SONAME_Fortran_FLAG "-Wl,-Xlinker,-soname,-Xlinker,")
|
||||
set(CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS "-Wl,-rdynamic")
|
Loading…
Reference in New Issue
Block a user