Skip to content

Commit b3b2d7f

Browse files
authored
Call custom macro set_msvc_crt_flags if users set CRT flags (#405)
Same CRT compile option are reqiured to avoid link errors on Windows. MD and MDd are choosed by default for release and debug build in LLVM. If users set MT or MTd flags, they also need to add the flags for opencl-clang sources using a custom macro set_msvc_crt_flags.
1 parent 98d206e commit b3b2d7f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,14 @@ add_library(${TARGET_NAME} SHARED
298298
$<TARGET_OBJECTS:cl_headers>
299299
)
300300

301+
# Same CRT compile option are reqiured to avoid link errors on Windows.
302+
# MD and MDd are choosed by default for release and debug build in LLVM.
303+
# If users set MT or MTd flags, they also need to add the flags for
304+
# opencl-clang sources using a custom macro set_msvc_crt_flags.
305+
if(COMMAND set_msvc_crt_flags)
306+
set_msvc_crt_flags(${TARGET_NAME})
307+
endif()
308+
301309
add_dependencies(${TARGET_NAME} CClangCompileOptions)
302310

303311
if (WIN32)

0 commit comments

Comments
 (0)