Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions cmake/external.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -190,14 +190,15 @@ INIT_EXT(ext_zlib
get_from_local_repo_if_exists("https://github.com/madler/zlib.git")
ExternalProject_Add(ext_zlib
GIT_REPOSITORY ${_git_url}
GIT_TAG v1.3.1
GIT_TAG v1.3.1
GIT_SHALLOW TRUE
PREFIX "${_base}"
CMAKE_ARGS -DCMAKE_BUILD_TYPE:STRING=${TD_CONFIG_NAME} # if main project is built in Debug, ext_zlib is too
CMAKE_ARGS -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} # use configure-time value so stamp files detect build type changes
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:STRING=${_ins} # let default INSTALL step use
CMAKE_ARGS -DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON # linking consistent
CMAKE_ARGS -DZLIB_BUILD_SHARED:BOOL=OFF
CMAKE_ARGS -DZLIB_BUILD_TESTING:BOOL=OFF
BUILD_BYPRODUCTS "${TD_EXTERNALS_BASE_DIR}/install/ext_zlib/${CMAKE_BUILD_TYPE}/lib/${ext_zlib_static}"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The BUILD_BYPRODUCTS path uses ${CMAKE_BUILD_TYPE}, which can be empty if not explicitly set (e.g., on multi-config generators or when relying on defaults). However, the installation prefix (_ins) passed to the external project in line 197 is defined using TD_CONFIG_NAME, which defaults to Debug when CMAKE_BUILD_TYPE is unset. This mismatch means the byproduct path will not match the actual installation location, causing build errors as CMake won't find the expected file. It is safer and more consistent to use the ${ext_zlib_install} variable which is already set up by the INIT_EXT macro.

    BUILD_BYPRODUCTS "${ext_zlib_install}/lib/${ext_zlib_static}"

Comment on lines +196 to +201
EXCLUDE_FROM_ALL TRUE
VERBATIM
)
Expand Down
Loading