# generator expression error

**URL:** https://discourse.cmake.org/t/generator-expression-error/7906
**Category:** Usage
**Tags:** os:linux
**Created:** [April 13, 2023, 9:22pm UTC](https://discourse.cmake.org/t/generator-expression-error/7906 "2023-04-13T21:22:25Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![KBentley57](https://discourse.cmake.org/user_avatar/discourse.cmake.org/kbentley57/32/474_2.png) [@KBentley57](https://discourse.cmake.org/u/KBentley57)
#### Post date: [April 13, 2023, 9:22pm UTC](https://discourse.cmake.org/t/generator-expression-error/7906/1 "2023-04-13T21:22:25Z")

</div>

Hi all,

I’m having an error that didn’t seem to happen in the past. I’m building HDF5, using externalproject\_add, not that it really matters.

The problem is with the generator expression below.

```auto
SOURCE_SUBDIR $<$<VERSION_GREATER_EQUAL:${HDF5_VERSION},1.12.0>:hdf5-${HDF5_VERSION}>

```

CMake is giving an error, below:

```auto
CMake Error at /usr/share/cmake-3.23/Modules/ExternalProject.cmake:1995 (file):
  Error evaluating generator expression:

    $<VERSION_GREATER_EQUAL;1.12.0,1.12.0>

Expression did not evaluate to a known generator expression

```

I’m not sure where the semicolon is coming from, but here’s the output for verification.

```cmake
message(STATUS "HDF5_VERSION = ${HDF5_VERSION}")
message(STATUS "hdf5-\${HDF5_VERSION} = hdf5-${HDF5_VERSION}")
message(STATUS "1.12.0 = 1.12.0")

```

```auto
-- HDF5_VERSION = 1.12.0
-- hdf5-${HDF5_VERSION} = hdf5-1.12.0
-- 1.12.0 = 1.12.0

```

Any advice? It was working yesterday, I swear.

---

<div class="post-metadata">

### Author: ![craig.scott](https://discourse.cmake.org/user_avatar/discourse.cmake.org/craig.scott/32/20_2.png) [@craig.scott](https://discourse.cmake.org/u/craig.scott)
#### Post date: [April 14, 2023, 2:29am UTC](https://discourse.cmake.org/t/generator-expression-error/7906/2 "2023-04-14T02:29:22Z")

</div>

Modify your actual project to print the value of `HDF5_VERSION` immediately before you call `ExternalProject_Add()` and confirm it holds the value you expect. That may reveal something to explore. The error message printed by CMake doesn’t make a lot of sense with the semicolon in there right now.

---

<div class="post-metadata">

### Author: ![fenrir](https://discourse.cmake.org/user_avatar/discourse.cmake.org/fenrir/32/734_2.png) [@fenrir](https://discourse.cmake.org/u/fenrir)
#### Post date: [April 14, 2023, 6:39am UTC](https://discourse.cmake.org/t/generator-expression-error/7906/3 "2023-04-14T06:39:48Z")

</div>

Wild guess:  
Do you use `LIST_SEPARATOR ":"` by any chance?

---

<div class="post-metadata">

### Author: ![KBentley57](https://discourse.cmake.org/user_avatar/discourse.cmake.org/kbentley57/32/474_2.png) [@KBentley57](https://discourse.cmake.org/u/KBentley57)
#### Post date: [April 14, 2023, 2:30pm UTC](https://discourse.cmake.org/t/generator-expression-error/7906/4 "2023-04-14T14:30:38Z")

</div>

Thanks Craig. I tried to keep it short, but I might as well post the whole file. Here’s what’s running right now. Those calls are immediately before the externalrproject\_add function.

```auto

################################################################################
#
# Kyle Bentley
# Torch Technologies
# kyle.bentley@torchtechnologies.com
# 2021/04/13
#
# This package installs hdf5, a file format used everywhere.
#
# https://www.hdfgroup.org/solutions/hdf5/
#
################################################################################

message(STATUS "HDF5_VERSION = ${HDF5_VERSION}")
message(STATUS "hdf5-\${HDF5_VERSION} = hdf5-${HDF5_VERSION}")
message(STATUS "1.12.0 = 1.12.0")

ExternalProject_Add(hdf5
	URL ${SUPPORTPACKAGES_PACKAGE_DIR}/@canonical_name@
	URL_MD5 @package_md5@
	PREFIX ${CMAKE_CURRENT_BINARY_DIR}/hdf5
	INSTALL_DIR ${CMAKE_INSTALL_PREFIX}
	SOURCE_SUBDIR $<$<VERSION_GREATER_EQUAL:${HDF5_VERSION},1.12.0>:hdf5-${HDF5_VERSION}>
	CMAKE_ARGS 	
	    -DCMAKE_MODULE_PATH=<INSTALL_DIR>/Modules
		-DCMAKE_PREFIX_PATH=<INSTALL_DIR>
		-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
		-DCMAKE_INSTALL_LIBDIR=<INSTALL_DIR>/lib
		-DH5_DEFAULT_PLUGINDIR=<INSTALL_DIR>/lib
		-DHDF5_ENABLE_PARALLEL=ON 
		-DHDF5_BUILD_FORTRAN=OFF 
		-DONLY_SHARED_LIBS=ON 
		-DCMAKE_ANSI_CFLAGS=-fPIC
		-DBUILD_TESTING=FALSE	 
		-DHDF5_ENABLE_ASSERTS=TRUE
		-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
		-DHDF5_ENABLE_MAP_API=TRUE 
		-DHDF5_ENABLE_Z_LIB_SUPPORT=ON
		-DHDF5_BUILD_CPP_LIB=FALSE
		-DHDF5_ENABLE_OPTIMIZATION=TRUE	
        -DOPTIMIZE_CFLAGS=${COMMON_C_FLAGS}
        -DDEFAULT_API_VERSION:STRING=v18
		$<$<BOOL:${BUILD_LOCAL_MPI}>:-DMPIEXEC_EXECUTABLE=<INSTALL_DIR>/bin/mpiexec>
		$<$<BOOL:${BUILD_LOCAL_MPI}>:-DMPI_LIBRARY=<INSTALL_DIR>/lib/libmpi.so>
		$<$<BOOL:${BUILD_LOCAL_MPI}>:-DMPI_HOME=<INSTALL_DIR>>
		$<$<BOOL:${BUILD_LOCAL_MPI}>:-DMPI_ROOT=<INSTALL_DIR>>
	    $<$<BOOL:${BUILD_LOCAL_MPI}>:-DMPI_C_INCLUDE_DIRS=<INSTALL_DIR>/include>
		$<$<BOOL:${BUILD_ZLIB}>:-DZLIB_ROOT=$<INSTALL_DIR>>		
	LOG_CONFIGURE 1
	LOG_BUILD 1
	LOG_INSTALL 1
)

if(BUILD_LOCAL_MPI)
    add_dependencies(hdf5 ${MPI_TARGET})
endif(BUILD_LOCAL_MPI)

if(BUILD_ZLIB)
    add_dependencies(hdf5 zlib)
endif(BUILD_ZLIB)

```

The output of which gets to this point, described above.

```auto
-- HDF5_VERSION = 1.12.0
-- hdf5-${HDF5_VERSION} = hdf5-1.12.0
-- 1.12.0 = 1.12.0
-- Configuring done

CMake Error at /usr/share/cmake-3.23/Modules/ExternalProject.cmake:1995 (file):
  Error evaluating generator expression:

    $<VERSION_GREATER_EQUAL;1.12.0,1.12.0>

  Expression did not evaluate to a known generator expression
Call Stack (most recent call first):
  /usr/share/cmake-3.23/Modules/ExternalProject.cmake:2286 (_ep_write_log_script)
  /usr/share/cmake-3.23/Modules/ExternalProject.cmake:3229:EVAL:2 (ExternalProject_Add_Step)
  /usr/share/cmake-3.23/Modules/ExternalProject.cmake:3229 (cmake_language)
  /usr/share/cmake-3.23/Modules/ExternalProject.cmake:3643 (_ep_add_configure_command)
  build/Modules/hdf5.cmake:21 (ExternalProject_Add)
  cmakefiles/options/sp_templates.cmake:239 (include)
  CMakeLists.txt:522 (include)

```

---

<div class="post-metadata">

### Author: ![KBentley57](https://discourse.cmake.org/user_avatar/discourse.cmake.org/kbentley57/32/474_2.png) [@KBentley57](https://discourse.cmake.org/u/KBentley57)
#### Post date: [April 14, 2023, 2:32pm UTC](https://discourse.cmake.org/t/generator-expression-error/7906/5 "2023-04-14T14:32:03Z")

</div>

Good thinking on the LIST\_SEPARATOR. I use it in other places, but nowhere around here. I just grepped the entire project and the only places I see it don’t use a colon.

---

<div class="post-metadata">

### Author: ![KBentley57](https://discourse.cmake.org/user_avatar/discourse.cmake.org/kbentley57/32/474_2.png) [@KBentley57](https://discourse.cmake.org/u/KBentley57)
#### Post date: [April 14, 2023, 3:18pm UTC](https://discourse.cmake.org/t/generator-expression-error/7906/6 "2023-04-14T15:18:25Z")

</div>

I compiled a 3.20.2 version of CMake that I keep around. The behavior is not exhibited in that version.

What’s your thoughts on that? I’m using debian 11, with the version from the repos. Is it worthy of a bug report?

```auto
bentleykw@bentleykw:~$ aptitude show cmake
Package: cmake                           
Version: 3.23.2-1
State: installed
Automatically installed: no
Multi-Arch: foreign
Priority: optional
Section: devel
Maintainer: Debian CMake Team <pkg-cmake-team@lists.alioth.debian.org>
Architecture: amd64
Uncompressed Size: 27.9 M
Depends: libarchive13 (>= 3.3.3), libc6 (>= 2.33), libcurl4 (>= 7.16.2),
         libexpat1 (>= 2.0.1), libgcc-s1 (>= 3.0), libjsoncpp25 (>= 1.9.5),
         librhash0 (>= 1.2.6), libstdc++6 (>= 12), libuv1 (>= 1.38.0), zlib1g
         (>= 1:1.1.4), cmake-data (= 3.23.2-1), procps
Recommends: gcc, make
Suggests: cmake-doc, ninja-build, cmake-format
Conflicts: cmake:i386
Provides: cmake:i386 (= 3.23.2-1)
Provided by: cmake:i386 (3.18.4-2+deb11u1)

```

Thanks,

Kyle

---

<div class="post-metadata">

### Author: ![craig.scott](https://discourse.cmake.org/user_avatar/discourse.cmake.org/craig.scott/32/20_2.png) [@craig.scott](https://discourse.cmake.org/u/craig.scott)
#### Post date: [April 19, 2023, 5:05am UTC](https://discourse.cmake.org/t/generator-expression-error/7906/7 "2023-04-19T05:05:09Z")

</div>

Please put together a minimal, complete example that reproduces the problem. Make it as simple as possible so that someone can easily replicate it. If you can do that, then open a bug report and attach that minimal example.
