Files
CMake/Tests/HIP/MixedLanguage/CMakeLists.txt
T
Brad King e43918b4ca HIP: Fix linking mixed-lang binary with CXX compiler and Makefile generators
Following commit 6377a43814 (CUDA: Support response files with nvcc,
2022-06-01, v3.25.0-rc1~636^2), while determining the compiler ABI, do
not use response files, so that we can extract implicit link flags.

Fixes: #25272
2023-09-25 16:06:36 -04:00

24 lines
957 B
CMake

cmake_minimum_required(VERSION 3.18)
project (MixedLanguage C CXX HIP)
set(CMAKE_HIP_STANDARD 14)
set(CMAKE_CXX_STANDARD 14)
#Goal for this example:
#make sure that we can build multiple languages into targets
#and have the link language always be HIP
add_library(MixedSharedLib SHARED shared.c)
add_library(MixedObjectLib OBJECT shared.cxx shared.hip)
set_target_properties(MixedObjectLib PROPERTIES POSITION_INDEPENDENT_CODE ON)
target_link_libraries(MixedSharedLib PRIVATE MixedObjectLib)
add_library(MixedStaticLib STATIC static.c static.cxx static.hip)
set_target_properties(MixedStaticLib PROPERTIES POSITION_INDEPENDENT_CODE ON)
add_executable(HIPMixedLanguage main.cxx)
target_link_libraries(HIPMixedLanguage PRIVATE MixedStaticLib MixedSharedLib)
add_executable(HIPMixedLanguageCXX main.cxx)
target_link_libraries(HIPMixedLanguageCXX PRIVATE MixedStaticLib MixedSharedLib)
set_property(TARGET HIPMixedLanguageCXX PROPERTY LINKER_LANGUAGE CXX)