Skip to content

Commit c62051e

Browse files
committed
CMakeLists.txt: quote VTK_VERSION and CGAL_VERSION
If `VTK_VERSION` is an empty string (because VTK is not installed), the statement `if (${VTK_VERSION} VERSION_GREATER "9")` is evaluated as `if (VERSION_GREATER "9")`, generating the following misleading and confusing syntax error: CMake Error at CMakeLists.txt:151 (if): if given arguments: "VERSION_GREATER" "9" Unknown arguments specified Quote `VTK_VERSION` to avoid the error. We do the same for `CGAL_VERSION` for consistency (although `CGAL_VERSION` shouldn't be affected by the same problem since errors are not ignored) Signed-off-by: Yifeng Li <tomli@tomli.me>
1 parent 305f5be commit c62051e

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ find_package(CGAL REQUIRED)
118118
INCLUDE_DIRECTORIES (${CGAL_INCLUDE_DIR})
119119
120120
# CGAL may be complied as headers, or as shared objects, which we must link
121-
if (${CGAL_VERSION} VERSION_GREATER 5.0)
121+
if ("${CGAL_VERSION}" VERSION_GREATER 5.0)
122122
set(CSXCAD_CGAL_LIBRARIES CGAL::CGAL)
123123
message(STATUS "Found package CGAL v5+. Using version " ${CGAL_VERSION})
124124
else()
@@ -148,7 +148,7 @@ endif()
148148
149149
# vtk
150150
find_package(VTK COMPONENTS vtkCommonCore NO_MODULE QUIET)
151-
if (${VTK_VERSION} VERSION_GREATER "9")
151+
if ("${VTK_VERSION}" VERSION_GREATER "9")
152152
find_package(VTK REQUIRED COMPONENTS IOGeometry IOPLY NO_MODULE REQUIRED)
153153
else()
154154
find_package(VTK REQUIRED COMPONENTS vtkIOGeometry vtkIOPLY NO_MODULE REQUIRED)

0 commit comments

Comments
 (0)