configure_package_config_file throws error of unknown keyword ${PROJECT_NAME}-config.cmake

Hi all,

I am trying to pull in the Arcade-Learning-Environment project via CPM in my project via

        NAME ale  
        GIT_TAG v0.9.0
        # Configuration options passed to the dependency (optional)
        GITHUB_REPOSITORY Farama-Foundation/Arcade-Learning-Environment

but run into an error with configure_package_config_file which is used in the project like so:

root CMakeLists.txt:


# Set cmake module path
            DESCRIPTION "The Arcade Learning Environment (ALE) - a platform for AI research."
            HOMEPAGE_URL ""
            LANGUAGES CXX)

# Main ALE src directory


  # Configure installable cmake config

the file resides in their root-level folder cmake which seems to be found.
Letting CPM populate this repo now brings up this error though:

CMake Error at /u/michael.aichmueller/cmake-3.26.5-linux-x86_64/share/cmake-3.26/Modules/CMakePackageConfigHelpers.cmake:250 (message):
Unknown keywords given to CONFIGURE_PACKAGE_CONFIG_FILE():
Call Stack (most recent call first):
cmake-build-debug-clang-lactose/_deps/ale-src/src/CMakeLists.txt:105 (configure_package_config_file)

I have been trying to fix this in my fork by prepending e.g. ${CMAKE_CURRENT_BINARY_DIR} to the output path of configure_package_config_file and/or adding quotes, but all lead to errors.

In fact, the documentation and example on the cmake github repo lead me to believe that the usage in ALE is correct.

This was run with cmake 26.5 on an x86-64 ubuntu 22.04 system.

Any tips on why this would not work?

The problem is the use of ${CMAKE_MODULE_PATH} in the first argument. That’s not valid, the CMAKE_MODULE_PATH variable can (and indeed in this case does) contain a list. That will result in the first argument being parsed as multiple arguments. I’m not sure what they were intending, but this is definitely a bug in their project.

Hi @craig.scott , thanks for the answer!

I see that the first input takes up the 1st and 2nd argument (input and output) upon expansion of configure_package_config_file which forces the ale-config.cmake file to be parsed as keyword.

Once I replaced CMAKE_MODULE_PATH with CMAKE_CURRENT_SOURCE_DIR/…/cmake for the 1st arg in the function call within my fork, I could configure the project correctly.

Thanks for your help. I will suggest the fix to the project maintainers.