diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index a9acf473ec..98fb806a26 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -197,11 +197,6 @@ foreach(option_flag IN LISTS option_flags) convert_env_var_to_bool("${option_flag}") endforeach() -if(WITH_CGAL) - find_package(CGAL REQUIRED) - set(CGAL_LIBRARIES CGAL::CGAL_INTERFACE) - list(APPEND GEOMETRY_KERNELS cgal) -endif() if(BUILD_IFCGEOM AND WITH_OPENCASCADE) find_package(OpenCASCADE REQUIRED) @@ -306,6 +301,15 @@ if(USE_MMAP) add_definitions(-DUSE_MMAP) endif() +# Handle CGAL after Boost settings are set, since CGAL will use them too. +# Do `find_package(Boost)` only after this, to make sure `FindBoost` finds correct components. +# Otherwise it will find components needed for CGAL and we might some libraries. +if(WITH_CGAL) + find_package(CGAL REQUIRED) + set(CGAL_LIBRARIES CGAL::CGAL_INTERFACE) + list(APPEND GEOMETRY_KERNELS cgal) +endif() + find_package(Boost REQUIRED COMPONENTS ${BOOST_COMPONENTS}) message(STATUS "Boost include files found in ${Boost_INCLUDE_DIRS}") message(STATUS "Boost libraries found in ${Boost_LIBRARY_DIRS}") diff --git a/cmake/FindCGAL.cmake b/cmake/FindCGAL.cmake index 772c315e9c..29944ae867 100644 --- a/cmake/FindCGAL.cmake +++ b/cmake/FindCGAL.cmake @@ -46,6 +46,9 @@ else() else() set(CGAL_Boost_USE_STATIC_LIBS "${Boost_USE_STATIC_LIBS}") endif() + # Annoyingly this is producing CMP0167 boost warnings, because it's unsetting cmake policies + # and using FindBoost module. But there's nothing we can do about it, + # since everything happens in the scope of CGAL config. I guess it's be resolved in CGAL 6.1.0. find_package(CGAL CONFIG) if(NOT CGAL_FOUND) message( diff --git a/win/run-cmake.bat b/win/run-cmake.bat index 1f8887f6eb..7b67a4f022 100755 --- a/win/run-cmake.bat +++ b/win/run-cmake.bat @@ -107,12 +107,9 @@ if not defined SWIG_INSTALL_DIR set SWIG_INSTALL_DIR=%INSTALL_DIR%\swigwin set JSON_INCLUDE_DIR=%INSTALL_DIR%\json if not defined ADD_COMMIT_SHA set ADD_COMMIT_SHA=Off -set CGAL_INCLUDE_DIR=%INSTALL_DIR%\cgal\include -:: set CGAL_LIBRARY_DIR=%INSTALL_DIR%\cgal\lib -set GMP_INCLUDE_DIR=%INSTALL_DIR%\mpir -set GMP_LIBRARY_DIR=%INSTALL_DIR%\mpir -set MPFR_INCLUDE_DIR=%INSTALL_DIR%\mpfr -set MPFR_LIBRARY_DIR=%INSTALL_DIR%\mpfr +set CGAL_INSTALL_DIR=%INSTALL_DIR%\cgal +set GMP_INSTALL_DIR=%INSTALL_DIR%\mpir +set MPFR_INSTALL_DIR=%INSTALL_DIR%\mpfr :: We don't install Eigen currently, :: so there's no Eigen3config.cmake and therefore we provide path explicitly. set EIGEN_DIR=%INSTALL_DIR%\Eigen @@ -146,12 +143,10 @@ echo PYTHON_EXECUTABLE = %PYTHON_EXECUTABLE% echo SWIG_INSTALL_DIR = %SWIG_INSTALL_DIR% echo JSON_INCLUDE_DIR = %JSON_INCLUDE_DIR% echo. -echo CGAL_INCLUDE_DIR = %CGAL_INCLUDE_DIR% +echo CGAL_INSTALL_DIR = %CGAL_INSTALL_DIR% :: echo CGAL_LIBRARY_DIR = %CGAL_LIBRARY_DIR% -echo GMP_INCLUDE_DIR = %GMP_INCLUDE_DIR% -echo GMP_LIBRARY_DIR = %GMP_LIBRARY_DIR% -echo MPFR_INCLUDE_DIR = %MPFR_INCLUDE_DIR% -echo MPFR_LIBRARY_DIR = %MPFR_LIBRARY_DIR% +echo GMP_INSTALL_DIR = %GMP_INSTALL_DIR% +echo MPFR_INSTALL_DIR = %MPFR_INSTALL_DIR% echo EIGEN_DIR = %EIGEN_DIR% echo TBB_INSTALL_DIR = %TBB_INSTALL_DIR% echo USD_INSTALL_DIR = %USD_INSTALL_DIR% @@ -171,7 +166,8 @@ set CMAKE_PREFIX_PATH=%HDF5_INSTALL_DIR%;%OPENCOLLADA_INSTALL_DIR%;%SWIG_INSTALL set CMAKE_PREFIX_PATH=%CMAKE_PREFIX_PATH%;%ROCKSDB_INSTALL_DIR%;%ZSTD_INSTALL_DIR% set CMAKE_PREFIX_PATH=%CMAKE_PREFIX_PATH%;%BOOST_INSTALL_DIR%;%CCACHE_INSTALL_DIR% set CMake_PREFIX_PATH=%CMAKE_PREFIX_PATH%;%USD_INSTALL_DIR%;%TBB_INSTALL_DIR% -set CMAKE_PREFIX_PATH=%CMAKE_PREFIX_PATH%;%OCC_INSTALL_DIR% +set CMAKE_PREFIX_PATH=%CMAKE_PREFIX_PATH%;%OCC_INSTALL_DIR%;%CGAL_INSTALL_DIR% +set CMAKE_PREFIX_PATH=%CMAKE_PREFIX_PATH%;%GMP_INSTALL_DIR%;%MPFR_INSTALL_DIR% :: Not fully supported - not available from install-ifcopenshell :: and some logs are still showing Visual Studio generators.