CMake/Modules/Platform/Linux-PGI.cmake
Christian Pfeiffer fb31229e99 Linux-PGI: Prevent -rdynamic ending up in flags
Ensure that PGI on Linux keeps its
CMAKE_SHARED_LIBRARY_LINK_<LANG>_FLAGS empty, especially of -rdynamic.
In CMakeFortranInformation a lot of flags will be copied from their C
equivalents if they're not defined. By using a combination of GCC and
PGFortran, this will lead to -rdynamic ending up in the PGI flags and
none of the PGI compilers understand that flag, crashing with a fatal
error.
2017-05-05 17:30:11 +02:00

19 lines
625 B
CMake

# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
if(__LINUX_COMPILER_PGI)
return()
endif()
set(__LINUX_COMPILER_PGI 1)
macro(__linux_compiler_pgi lang)
# Shared library compile and link flags.
set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "-fPIC")
set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "")
set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-fPIC")
set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-shared")
set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS " ")
endmacro()