At the moment there is an automatic check to enable BULD_QT5 if the environment variable FREECAD_LIBPACK_DIR is set pointing to a libpack directory. I think this can be extended to the case if someone (like I usually do) set FREECAD_LIBPACK_DIR in the CMake GUI before doing the initial Configure step.
Now in your PR you split the IF/ELSE block into two sections
Code: Select all
IF(EXISTS ${FREECAD_LIBPACK_DIR}/lib/Qt5Core.lib)
OPTION(BUILD_QT5 "Build with Qt5." ON)
ENDIF()
Code: Select all
# Default Qt5 ON if present in libpack
IF(EXISTS ${CMAKE_BINARY_DIR}/bin/Qt5Core.dll)
OPTION(BUILD_QT5 "Build with Qt5." OFF)
ENDIF()
Then the general problem with the PR is that BUILD_QT5 is only set in case CMake found some Qt5 specific files. However, I still use some older libpacks with a different directory structure where the above automatism doesn't work and thus won't offer the BUILD_QT5 option. So, it effectively becomes (almost) impossible that the user can override the default because it's not even offered.
So, in this case it's better to keep and improve the current logic.
Not sure why a user wants to have the shiboken2.exe in the build directory.
Code: Select all
# Copy libpack 'bin' to build 'bin' per user request - if non-existant at destination
IF(NOT EXISTS ${CMAKE_BINARY_DIR}/bin/Scripts/shiboken2.exe)
SET(COPY_LIBPACK_BIN_TO_BUILD ON)
OPTION(FREECAD_COPY_LIBPACK_BIN_TO_BUILD "Copy larger libpack dependency 'bin' folder to the build direcctory." OFF)
ENDIF()
Code: Select all
MESSAGE("=======================================\n"
"Copying libpack bin directory to build directory for Windows MSVC build.\n"
"This will take a while... (5-10 minutes or longer)\n"
"Time depends upon whether libpack is Release(1 GB), Debug(1 GB+), or BOTH(2 GB+).\n")
Code: Select all
MESSAGE("To auto-copy the 'bin' directory from the libpack to the build directory,\n"
"toggle the FREECAD_COPY_LIBPACK_BIN_TO_BUILD parameter to ON and configure again.\n"
"NOTE: The copy process can take from 5-15 minutes depending on your libpack installed.\n")
Code: Select all
ELSE()
MESSAGE("If you intend to use the Windows libpack, set the FREECAD_LIBPACK_DIR to the libpack directory.")
MESSAGE(STATUS "As of 23 March 2019, APeltauer released three configurations of libpack for Windows:
Debug, Release, and Combined (Debug and Release).\n"
"Visit: https://github.com/apeltauer/FreeCAD/releases/ for downloads.")