From ce28796d6c3f105495dde3a430d8c34ee6f9ee29 Mon Sep 17 00:00:00 2001 From: shawnz Date: Wed, 11 Jun 2025 16:25:22 +0800 Subject: [PATCH] Bug 5189457: Disable -no-pie for hpc --- Samples/0_Introduction/matrixMulDynlinkJIT/CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Samples/0_Introduction/matrixMulDynlinkJIT/CMakeLists.txt b/Samples/0_Introduction/matrixMulDynlinkJIT/CMakeLists.txt index 70296afc..3058893e 100644 --- a/Samples/0_Introduction/matrixMulDynlinkJIT/CMakeLists.txt +++ b/Samples/0_Introduction/matrixMulDynlinkJIT/CMakeLists.txt @@ -31,7 +31,12 @@ set_target_properties(matrixMulDynlinkJIT PROPERTIES CUDA_SEPARABLE_COMPILATION ON POSITION_INDEPENDENT_CODE OFF ) -set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -no-pie") + +# Only add -no-pie for GCC or Clang +if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -no-pie") +endif() + target_link_libraries(matrixMulDynlinkJIT PUBLIC CUDA::cudart CUDA::cuda_driver