Skip to content

Commit 20d6547

Browse files
committed
run-cmake.bat - use cgal config instead of explicit paths
1 parent 71a3614 commit 20d6547

File tree

3 files changed

+20
-17
lines changed

3 files changed

+20
-17
lines changed

cmake/CMakeLists.txt

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -197,11 +197,6 @@ foreach(option_flag IN LISTS option_flags)
197197
convert_env_var_to_bool("${option_flag}")
198198
endforeach()
199199

200-
if(WITH_CGAL)
201-
find_package(CGAL REQUIRED)
202-
set(CGAL_LIBRARIES CGAL::CGAL_INTERFACE)
203-
list(APPEND GEOMETRY_KERNELS cgal)
204-
endif()
205200

206201
if(BUILD_IFCGEOM AND WITH_OPENCASCADE)
207202
find_package(OpenCASCADE REQUIRED)
@@ -306,6 +301,15 @@ if(USE_MMAP)
306301
add_definitions(-DUSE_MMAP)
307302
endif()
308303

304+
# Handle CGAL after Boost settings are set, since CGAL will use them too.
305+
# Do `find_package(Boost)` only after this, to make sure `FindBoost` finds correct components.
306+
# Otherwise it will find components needed for CGAL and we might some libraries.
307+
if(WITH_CGAL)
308+
find_package(CGAL REQUIRED)
309+
set(CGAL_LIBRARIES CGAL::CGAL_INTERFACE)
310+
list(APPEND GEOMETRY_KERNELS cgal)
311+
endif()
312+
309313
find_package(Boost REQUIRED COMPONENTS ${BOOST_COMPONENTS})
310314
message(STATUS "Boost include files found in ${Boost_INCLUDE_DIRS}")
311315
message(STATUS "Boost libraries found in ${Boost_LIBRARY_DIRS}")

cmake/FindCGAL.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ else()
4646
else()
4747
set(CGAL_Boost_USE_STATIC_LIBS "${Boost_USE_STATIC_LIBS}")
4848
endif()
49+
# Annoyingly this is producing CMP0167 boost warnings, because it's unsetting cmake policies
50+
# and using FindBoost module. But there's nothing we can do about it,
51+
# since everything happens in the scope of CGAL config. I guess it's be resolved in CGAL 6.1.0.
4952
find_package(CGAL CONFIG)
5053
if(NOT CGAL_FOUND)
5154
message(

win/run-cmake.bat

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,9 @@ if not defined SWIG_INSTALL_DIR set SWIG_INSTALL_DIR=%INSTALL_DIR%\swigwin
107107
set JSON_INCLUDE_DIR=%INSTALL_DIR%\json
108108
if not defined ADD_COMMIT_SHA set ADD_COMMIT_SHA=Off
109109

110-
set CGAL_INCLUDE_DIR=%INSTALL_DIR%\cgal\include
111-
:: set CGAL_LIBRARY_DIR=%INSTALL_DIR%\cgal\lib
112-
set GMP_INCLUDE_DIR=%INSTALL_DIR%\mpir
113-
set GMP_LIBRARY_DIR=%INSTALL_DIR%\mpir
114-
set MPFR_INCLUDE_DIR=%INSTALL_DIR%\mpfr
115-
set MPFR_LIBRARY_DIR=%INSTALL_DIR%\mpfr
110+
set CGAL_INSTALL_DIR=%INSTALL_DIR%\cgal
111+
set GMP_INSTALL_DIR=%INSTALL_DIR%\mpir
112+
set MPFR_INSTALL_DIR=%INSTALL_DIR%\mpfr
116113
:: We don't install Eigen currently,
117114
:: so there's no Eigen3config.cmake and therefore we provide path explicitly.
118115
set EIGEN_DIR=%INSTALL_DIR%\Eigen
@@ -146,12 +143,10 @@ echo PYTHON_EXECUTABLE = %PYTHON_EXECUTABLE%
146143
echo SWIG_INSTALL_DIR = %SWIG_INSTALL_DIR%
147144
echo JSON_INCLUDE_DIR = %JSON_INCLUDE_DIR%
148145
echo.
149-
echo CGAL_INCLUDE_DIR = %CGAL_INCLUDE_DIR%
146+
echo CGAL_INSTALL_DIR = %CGAL_INSTALL_DIR%
150147
:: echo CGAL_LIBRARY_DIR = %CGAL_LIBRARY_DIR%
151-
echo GMP_INCLUDE_DIR = %GMP_INCLUDE_DIR%
152-
echo GMP_LIBRARY_DIR = %GMP_LIBRARY_DIR%
153-
echo MPFR_INCLUDE_DIR = %MPFR_INCLUDE_DIR%
154-
echo MPFR_LIBRARY_DIR = %MPFR_LIBRARY_DIR%
148+
echo GMP_INSTALL_DIR = %GMP_INSTALL_DIR%
149+
echo MPFR_INSTALL_DIR = %MPFR_INSTALL_DIR%
155150
echo EIGEN_DIR = %EIGEN_DIR%
156151
echo TBB_INSTALL_DIR = %TBB_INSTALL_DIR%
157152
echo USD_INSTALL_DIR = %USD_INSTALL_DIR%
@@ -171,7 +166,8 @@ set CMAKE_PREFIX_PATH=%HDF5_INSTALL_DIR%;%OPENCOLLADA_INSTALL_DIR%;%SWIG_INSTALL
171166
set CMAKE_PREFIX_PATH=%CMAKE_PREFIX_PATH%;%ROCKSDB_INSTALL_DIR%;%ZSTD_INSTALL_DIR%
172167
set CMAKE_PREFIX_PATH=%CMAKE_PREFIX_PATH%;%BOOST_INSTALL_DIR%;%CCACHE_INSTALL_DIR%
173168
set CMake_PREFIX_PATH=%CMAKE_PREFIX_PATH%;%USD_INSTALL_DIR%;%TBB_INSTALL_DIR%
174-
set CMAKE_PREFIX_PATH=%CMAKE_PREFIX_PATH%;%OCC_INSTALL_DIR%
169+
set CMAKE_PREFIX_PATH=%CMAKE_PREFIX_PATH%;%OCC_INSTALL_DIR%;%CGAL_INSTALL_DIR%
170+
set CMAKE_PREFIX_PATH=%CMAKE_PREFIX_PATH%;%GMP_INSTALL_DIR%;%MPFR_INSTALL_DIR%
175171

176172
:: Not fully supported - not available from install-ifcopenshell
177173
:: and some logs are still showing Visual Studio generators.

0 commit comments

Comments
 (0)