diff options
author | Ray Molenkamp <github@lazydodo.com> | 2016-07-18 16:16:45 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2016-07-18 16:20:29 +0300 |
commit | 6239afd36f9216f7944d1320fa8f19cc802b3a19 (patch) | |
tree | 8c03b555e8a5f75aca2b64aa323cb4fc762b662c /build_files/cmake | |
parent | 65e7caf950d94496caf3a538ddfc3cc0683fd86d (diff) |
[MSVC/LNK4199/Cleanup] Delay loading is causing linker warnings.
We recently added delay-loading of the openmp dll's so we no longer had to use
the stub loader, we however put these linker flags on the global linker flags
causing any sub projects not using openmp to spit linker warning 4199 while building,
```
Warning LNK4199 /DELAYLOAD:vcomp140.dll ignored; no imports found from vcomp140.dll datatoc k:\BlenderGit\build_windows_2015a\source\blender\datatoc\LINK 1
```
This patch makes the delay-load only apply to the blender project.
Reviewers: sergey
Subscribers: sergey
Tags: #bf_blender
Differential Revision: https://developer.blender.org/D2092
Diffstat (limited to 'build_files/cmake')
-rw-r--r-- | build_files/cmake/macros.cmake | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake index 5ffd6c4e7f4..f57a6952164 100644 --- a/build_files/cmake/macros.cmake +++ b/build_files/cmake/macros.cmake @@ -1547,3 +1547,21 @@ function(print_all_vars) message("${_var}=${${_var}}") endforeach() endfunction() + +macro(openmp_delayload + projectname + ) + if(MSVC) + if(WITH_OPENMP) + if(MSVC_VERSION EQUAL 1800) + set(OPENMP_DLL_NAME "vcomp120") + else() + set(OPENMP_DLL_NAME "vcomp140") + endif() + SET_TARGET_PROPERTIES(${projectname} PROPERTIES LINK_FLAGS_RELEASE "/DELAYLOAD:${OPENMP_DLL_NAME}.dll delayimp.lib") + SET_TARGET_PROPERTIES(${projectname} PROPERTIES LINK_FLAGS_DEBUG "/DELAYLOAD:${OPENMP_DLL_NAME}d.dll delayimp.lib") + SET_TARGET_PROPERTIES(${projectname} PROPERTIES LINK_FLAGS_RELWITHDEBINFO "/DELAYLOAD:${OPENMP_DLL_NAME}.dll delayimp.lib") + SET_TARGET_PROPERTIES(${projectname} PROPERTIES LINK_FLAGS_MINSIZEREL "/DELAYLOAD:${OPENMP_DLL_NAME}.dll delayimp.lib") + endif(WITH_OPENMP) + endif(MSVC) +endmacro() |