Skip to content

Commit ffd7b4d

Browse files
david-salinasclaude
andcommitted
[libhipcxx] Fix -x hip scope: use target_compile_options not CMAKE_CXX_FLAGS
CMAKE_CXX_FLAGS=-x hip gets passed to the linker step too, causing amdclang++ to try to parse ELF object files as HIP source: error: expected unqualified-id (reading ELF magic bytes) Move -x hip to target_compile_options on the version_check target so it only applies during compilation, not linking. Remove it from the global cmake_opts passed to the sub-project configure step. Co-Authored-By: Claude Sonnet 4 <noreply@anthropic.com>
1 parent ea95111 commit ffd7b4d

2 files changed

Lines changed: 1 addition & 1 deletion

File tree

cmake/test/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ set(cmake_opts
2525
-D "CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}"
2626
-D "CMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}"
2727
-D "CMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}"
28-
-D "CMAKE_CXX_FLAGS=-x hip"
2928
)
3029

3130
# Temporary installation prefix for tests against installed project:

cmake/test/test_export/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ find_package(hip REQUIRED)
2323
find_package(libhipcxx REQUIRED)
2424

2525
add_executable(version_check version_check.cxx)
26+
target_compile_options(version_check PRIVATE -x hip)
2627
target_link_libraries(version_check PRIVATE libhipcxx::libhipcxx hip::host)
2728
enable_testing()
2829
add_test(NAME version_check COMMAND "$<TARGET_FILE:version_check>")

0 commit comments

Comments
 (0)