Skip to content
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

Generated files unzip.h and zip.h shall be in build directory #588

Closed
piwaneczko opened this issue Aug 3, 2021 · 3 comments
Closed

Generated files unzip.h and zip.h shall be in build directory #588

piwaneczko opened this issue Aug 3, 2021 · 3 comments

Comments

@piwaneczko
Copy link
Contributor

piwaneczko commented Aug 3, 2021

Discussed in https://github.com/zlib-ng/minizip-ng/discussions/587

Originally posted by piwaneczko August 3, 2021
Generated files shall be always placed in build directory.

AC:

  • Header template file.h.in is created:
    /* @FILE_H@ -- Compatibility layer shim
        part of the minizip-ng project
        This program is distributed under the terms of the same license as zlib.
        See the accompanying LICENSE file for the full text of the license.
    */
    #ifndef @MZ_COMPAT_FILE@
    #define @MZ_COMPAT_FILE@

    #include "mz_compat.h"
    #endif
  • CMakeLists.txt is updated:
    if(MZ_COMPAT)
        set(FILE_H "zip.h")
        set(MZ_COMPAT_FILE "MZ_COMPAT_ZIP")
        configure(file.h.in zip.h)

        set(FILE_H "unzip.h")
        set(MZ_COMPAT_FILE "MZ_COMPAT_UNZIP")
        configure(file.h.in unzip.h)

        if(MZ_COMPAT_VERSION)
            list(APPEND MINIZIP_DEF -DMZ_COMPAT_VERSION=${MZ_COMPAT_VERSION})
        endif()
        list(APPEND MINIZIP_SRC mz_compat.c)
        list(APPEND MINIZIP_HDR mz_compat.h ${CMAKE_CURRENT_BINARY_DIR}/zip.h ${CMAKE_CURRENT_BINARY_DIR}/unzip.h)
    endif()
@nmoinvaz
Copy link
Member

nmoinvaz commented Mar 5, 2022

Thanks for the good report. I have incorporated it into the dev branch.

@nmoinvaz nmoinvaz closed this as completed Mar 5, 2022
@piwaneczko
Copy link
Contributor Author

You have forgot to add build directory to include_directories for target:
example target_include_directories(minizip PUBLIC ${minizip_BUILD_DIR})
Now unzip.h and zip.h cannot by found by other source.
I couldn't test it before

@nmoinvaz
Copy link
Member

Ok please test dev.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants