generator expression error

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.

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

CMake is giving an error, below:

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.

message(STATUS "HDF5_VERSION = ${HDF5_VERSION}")
message(STATUS "hdf5-\${HDF5_VERSION} = hdf5-${HDF5_VERSION}")
message(STATUS "1.12.0 = 1.12.0")
-- 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.

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.

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

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.


################################################################################
#
#    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.

-- 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)

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.

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?

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

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.