diff options
author | Ray Molenkamp <github@lazydodo.com> | 2017-10-29 22:16:22 +0300 |
---|---|---|
committer | Ray Molenkamp <github@lazydodo.com> | 2017-10-29 22:16:22 +0300 |
commit | 475ec5269ae8f7c30795c2e771100e087b5dd315 (patch) | |
tree | 4f67447781f73d88304f767edd52e5e3bbf914b3 /build_files/cmake/macros.cmake | |
parent | 6099b2620d645f4129c42af2272cb6bd8538fc7a (diff) |
CMake: use only absolute linker paths for msvc.
cmake's link_directories will supply forward slashes for the search paths, the msvc linker has some issues with that, while it will search for the needed libs just fine, the incremental linker gets fed forward slashes for some libs, while the previous binary has backward slashes in it's metadata, the linker assumes obj files got added and performs a full link instead of an incremental link. This change brings down the link time with newer msvc versions for a trivial edit down from a few minutes to a few seconds.
Diffstat (limited to 'build_files/cmake/macros.cmake')
-rw-r--r-- | build_files/cmake/macros.cmake | 114 |
1 files changed, 58 insertions, 56 deletions
diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake index 06f47b9402b..7eb3af86985 100644 --- a/build_files/cmake/macros.cmake +++ b/build_files/cmake/macros.cmake @@ -282,65 +282,67 @@ function(SETUP_LIBDIRS) # NOTE: For all new libraries, use absolute library paths. # This should eventually be phased out. - link_directories(${JPEG_LIBPATH} ${PNG_LIBPATH} ${ZLIB_LIBPATH} ${FREETYPE_LIBPATH}) + if (NOT MSVC) + link_directories(${JPEG_LIBPATH} ${PNG_LIBPATH} ${ZLIB_LIBPATH} ${FREETYPE_LIBPATH}) - if(WITH_PYTHON) # AND NOT WITH_PYTHON_MODULE # WIN32 needs - link_directories(${PYTHON_LIBPATH}) - endif() - if(WITH_SDL AND NOT WITH_SDL_DYNLOAD) - link_directories(${SDL_LIBPATH}) - endif() - if(WITH_CODEC_FFMPEG) - link_directories(${FFMPEG_LIBPATH}) - endif() - if(WITH_IMAGE_OPENEXR) - link_directories(${OPENEXR_LIBPATH}) - endif() - if(WITH_IMAGE_TIFF) - link_directories(${TIFF_LIBPATH}) - endif() - if(WITH_BOOST) - link_directories(${BOOST_LIBPATH}) - endif() - if(WITH_OPENIMAGEIO) - link_directories(${OPENIMAGEIO_LIBPATH}) - endif() - if(WITH_OPENCOLORIO) - link_directories(${OPENCOLORIO_LIBPATH}) - endif() - if(WITH_OPENVDB) - link_directories(${OPENVDB_LIBPATH}) - endif() - if(WITH_OPENAL) - link_directories(${OPENAL_LIBPATH}) - endif() - if(WITH_JACK AND NOT WITH_JACK_DYNLOAD) - link_directories(${JACK_LIBPATH}) - endif() - if(WITH_CODEC_SNDFILE) - link_directories(${SNDFILE_LIBPATH}) - endif() - if(WITH_FFTW3) - link_directories(${FFTW3_LIBPATH}) - endif() - if(WITH_OPENCOLLADA) - link_directories(${OPENCOLLADA_LIBPATH}) - ## Never set - # link_directories(${PCRE_LIBPATH}) - # link_directories(${EXPAT_LIBPATH}) - endif() - if(WITH_LLVM) - link_directories(${LLVM_LIBPATH}) - endif() + if(WITH_PYTHON) # AND NOT WITH_PYTHON_MODULE # WIN32 needs + link_directories(${PYTHON_LIBPATH}) + endif() + if(WITH_SDL AND NOT WITH_SDL_DYNLOAD) + link_directories(${SDL_LIBPATH}) + endif() + if(WITH_CODEC_FFMPEG) + link_directories(${FFMPEG_LIBPATH}) + endif() + if(WITH_IMAGE_OPENEXR) + link_directories(${OPENEXR_LIBPATH}) + endif() + if(WITH_IMAGE_TIFF) + link_directories(${TIFF_LIBPATH}) + endif() + if(WITH_BOOST) + link_directories(${BOOST_LIBPATH}) + endif() + if(WITH_OPENIMAGEIO) + link_directories(${OPENIMAGEIO_LIBPATH}) + endif() + if(WITH_OPENCOLORIO) + link_directories(${OPENCOLORIO_LIBPATH}) + endif() + if(WITH_OPENVDB) + link_directories(${OPENVDB_LIBPATH}) + endif() + if(WITH_OPENAL) + link_directories(${OPENAL_LIBPATH}) + endif() + if(WITH_JACK AND NOT WITH_JACK_DYNLOAD) + link_directories(${JACK_LIBPATH}) + endif() + if(WITH_CODEC_SNDFILE) + link_directories(${SNDFILE_LIBPATH}) + endif() + if(WITH_FFTW3) + link_directories(${FFTW3_LIBPATH}) + endif() + if(WITH_OPENCOLLADA) + link_directories(${OPENCOLLADA_LIBPATH}) + ## Never set + # link_directories(${PCRE_LIBPATH}) + # link_directories(${EXPAT_LIBPATH}) + endif() + if(WITH_LLVM) + link_directories(${LLVM_LIBPATH}) + endif() - if(WITH_ALEMBIC) - link_directories(${ALEMBIC_LIBPATH}) - link_directories(${HDF5_LIBPATH}) - endif() + if(WITH_ALEMBIC) + link_directories(${ALEMBIC_LIBPATH}) + link_directories(${HDF5_LIBPATH}) + endif() - if(WIN32 AND NOT UNIX) - link_directories(${PTHREADS_LIBPATH}) - endif() + if(WIN32 AND NOT UNIX) + link_directories(${PTHREADS_LIBPATH}) + endif() + endif(NOT MSVC) endfunction() function(setup_liblinks |