From 06038b89c6a9204dda756ae239cf71a37722dd97 Mon Sep 17 00:00:00 2001 From: Anders Leino Date: Thu, 19 Sep 2024 15:19:20 +0300 Subject: [PATCH] Use the host executable suffix for generators 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 #5115. --- CMakeLists.txt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6580e26806..38486b6996 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) @@ -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(