-
-
Notifications
You must be signed in to change notification settings - Fork 204
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Why override for static runtime library with MSVC? #200
Comments
Sorry, I'm not too familiar with building for Windows, so I'm not 100% sure what you mean. I also don't know what this |
I was refering to https://github.com/arrayfire/arrayfire/blame/master/CMakeModules/build_CLBlast.cmake The problem is caused by dynamic vs. static linking of the MSVC runtime. This behavior is not affected by BUILD_SHARED_LIBS but by the added "/MT" in https://github.com/CNugteren/CLBlast/blob/master/cmake/cxx_flag_overrides.cmake. The problem is if one is static linking against ClBlast from e.g. arrayfire, both have to use the same type of runtime-linking (either MT or MD). Arrayfire is currently using MD/dynamic linking so one has to do same ugly overwriting of the overwritten CXX_Flags like
to undo what https://github.com/CNugteren/CLBlast/blob/master/cmake/cxx_flag_overrides.cmake does. It would be nice if there was a way to disable the cxx_flags-overwrite. For example there could be an additional option MSVC_LINK_MD that is checked before the overwrite |
Hmmm, yes, that piece of code. It got in by request of a user in #59. It is a bit of a strange bit of code, as it has to go all the way at the start of the CMakeLists.txt, but apparently this is what the recommended way is according to the CMake documentation What I can do is indeed add a CMake option to disable these overrides. Would that solve it for you? (slightly related perhaps is also #115 from another ArrayFire contributor) |
Thanks, that would definitively solve the issue for me, it seems like there is no more elegant way (quite surprising) |
I've added the |
*Fix link error on windows, see CNugteren/CLBlast#200 *Fix name of CLBlas library on windows *Fix include, see arrayfire#1956
*Fix link error on windows, see CNugteren/CLBlast#200 *Fix name of CLBlas library on windows *Fix include, see arrayfire#1956
*Fix link error on windows, see CNugteren/CLBlast#200 *Fix name of CLBlas library on windows *Fix include, see #1956
*Fix link error on windows, see CNugteren/CLBlast#200 *Fix name of CLBlas library on windows *Fix include, see arrayfire#1956
*Fix link error on windows, see CNugteren/CLBlast#200 *Fix name of CLBlas library on windows *Fix include, see arrayfire#1956
*Fix link error on windows, see CNugteren/CLBlast#200 *Fix name of CLBlas library on windows *Fix include, see arrayfire#1956
*Fix link error on windows, see CNugteren/CLBlast#200 *Fix name of CLBlas library on windows *Fix include, see #1956
*Fix link error on windows, see CNugteren/CLBlast#200 *Fix name of CLBlas library on windows *Fix include, see arrayfire#1956
Hey,
I am trying to get arrayfire to compile using clBLast and stumbled upon linker errors because clblast is compiled with a static runtime library (MT) and arrayfire with a dynamic runtime (MD)
What is the reasoning for the override of the CXX flags?
Did you test this change with your build_clblast.cmake over at arrayfire?
Do you know how I can "override the override"? ;)
The text was updated successfully, but these errors were encountered: