zlib
zlib copied to clipboard
Use PROJECT_SOURCE_DIR for cmake include_directories
The current usage of the CMAKE_SOURCE_DIR variable causes build breaks when compiling zlib in a subdirectory of the CMake tree. Instead of using CMAKE_SOURCE_DIR, we can use PROJECT_SOURCE_DIR to represent the root directory of where the ZLIB cmake project was declared.
Note, this removes the need to special case include directories for MSVC.
I would have used CMAKE_CURRENT_SOURCE_DIR
instead of PROJECT_SOURCE_DIR
but other than that I also recommend to merge this simple PR, because it fixes long standing build problems with the add_subdirectory
case and does not break the "build-alone" case.
Hi schultetwin1,
I came up with the changes in this pull request (plus the change Bagira80 suggested) independently. I just uploaded https://github.com/madler/zlib/pull/818. If you make the change Bagira80 suggested, I will abandon my pull request.
Thanks, Wan-Teh