Skip to content

Lib3MF CMake commands use root CMAKE_BINARY_DIR, breaking install target as subdirectory #429

@Grimrukh

Description

@Grimrukh

CMakeLists.txt currently uses CMAKE_BINARY_DIR (the root build directory) in two places:

Line 179: if(NOT EXISTS ${CMAKE_BINARY_DIR}/libzip)
Line 263: install(FILES ${CMAKE_BINARY_DIR}/lib3mf.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)

By using CMAKE_BINARY_DIR rather than CMAKE_CURRENT_BINARY_DIR, these two commands assume that lib3mf is being built as the root project, which is not necessarily the case (e.g. when another project uses add_subdirectory(modules/lib3mf)).

This is a minor problem on line 179, as it just means libzip will always be built (correctly into "${CMAKE_CURRENT_BINARY_DIR}/libzip").

On line 263, it causes a fatal error when building the install target, as the expected file lib3mf.pc is not found in the root build directory.

Both of these should just be changed to CMAKE_CURRENT_BINARY_DIR, which fixes the install target.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions