Skip to content

Commit

Permalink
Use the host executable suffix for generators
Browse files Browse the repository at this point in the history
Since the generators are run at build-time, we should not use CMAKE_EXECUTABLE_SUFFIX,
which is the suffix for the target platform.
Instead, define CMAKE_HOST_EXECUTABLE_SUFFIX as appropriate, and use that suffix instead.

This helps to address issue shader-slang#5115.
  • Loading branch information
aleino-nv committed Sep 25, 2024
1 parent 8c35e50 commit e34a253
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,13 @@ add_custom_target(
all-generators
COMMENT "meta target which depends on all generators"
)

if(CMAKE_HOST_WIN32)
set(CMAKE_HOST_EXECUTABLE_SUFFIX ".exe")
else()
set(CMAKE_HOST_EXECUTABLE_SUFFIX "")
endif()

set_target_properties(all-generators PROPERTIES FOLDER generators)
function(generator dir)
if(SLANG_GENERATORS_PATH)
Expand All @@ -267,7 +274,7 @@ function(generator dir)
TARGET ${target}
PROPERTY
IMPORTED_LOCATION
"${SLANG_GENERATORS_PATH}/${target}${CMAKE_EXECUTABLE_SUFFIX}"
"${SLANG_GENERATORS_PATH}/${target}${CMAKE_HOST_EXECUTABLE_SUFFIX}"
)
else()
slang_add_target(
Expand Down

0 comments on commit e34a253

Please sign in to comment.