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.
CMakeLists.txtcurrently usesCMAKE_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_DIRrather thanCMAKE_CURRENT_BINARY_DIR, these two commands assume thatlib3mfis being built as the root project, which is not necessarily the case (e.g. when another project usesadd_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.pcis not found in the root build directory.Both of these should just be changed to
CMAKE_CURRENT_BINARY_DIR, which fixes the install target.