summaryrefslogtreecommitdiffstats
path: root/Modules/Platform/Linux-NVHPC.cmake
diff options
context:
space:
mode:
authorRobert Maynard <rmaynard@nvidia.com>2021-02-25 17:58:47 (GMT)
committerRobert Maynard <rmaynard@nvidia.com>2022-08-15 17:39:30 (GMT)
commit52dc49deb955bf4b4805354ea270eff6ecd9e198 (patch)
treee19d1fa9a477a316ea329d349f74916fad873e08 /Modules/Platform/Linux-NVHPC.cmake
parent5d0685aa3ee20be4553eacfdc144d63e6ad2fcd5 (diff)
downloadCMake-52dc49deb955bf4b4805354ea270eff6ecd9e198.zip
CMake-52dc49deb955bf4b4805354ea270eff6ecd9e198.tar.gz
CMake-52dc49deb955bf4b4805354ea270eff6ecd9e198.tar.bz2
NVHPC: Enable PIE support on linux
Diffstat (limited to 'Modules/Platform/Linux-NVHPC.cmake')
-rw-r--r--Modules/Platform/Linux-NVHPC.cmake16
1 files changed, 9 insertions, 7 deletions
diff --git a/Modules/Platform/Linux-NVHPC.cmake b/Modules/Platform/Linux-NVHPC.cmake
index aad17f1..602b417 100644
--- a/Modules/Platform/Linux-NVHPC.cmake
+++ b/Modules/Platform/Linux-NVHPC.cmake
@@ -3,13 +3,15 @@
# This module is shared by multiple languages; use include blocker.
-if(__LINUX_COMPILER_NVIDIA)
- return()
-endif()
-set(__LINUX_COMPILER_NVIDIA 1)
-
-include(Platform/Linux-PGI)
+include_guard()
macro(__linux_compiler_nvhpc lang)
- __linux_compiler_pgi(${lang})
+ set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "-fPIC")
+ set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "-fPIE")
+ set(_CMAKE_${lang}_PIE_MAY_BE_SUPPORTED_BY_LINKER YES)
+ set(CMAKE_${lang}_LINK_OPTIONS_PIE "-fPIE")
+ set(CMAKE_${lang}_LINK_OPTIONS_NO_PIE "")
+ set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-fPIC")
+ set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-shared")
+ set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "")
endmacro()