CMake configure error (CTEST_USE_LAUNCHERS_ENABLED / RULE_LAUNCH_COMPILE global property not defined)

When I try to build 1.13.2 on Linux, I get the following error

CMake Error: CTEST_USE_LAUNCHERS is enabled, but the RULE_LAUNCH_COMPILE global property is not defined.
Did you forget to include(CTest) in the toplevel CMakeLists.txt ?

In HDF5options.cmake, I have un-commented the BUILD_SHARED_LIBS:BOOL=OFF and BUILD_TESTING:BOOL=OFF lines, and have added set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_EXAMPLES:BOOL=OFF -DHDF5_BUILD_TOOLS:BOOL=OFF -DHDF5_BUILD_UTILS:BOOL=OFF") at the end (since I only want a static library build for use in my program).

The top level CMakeLists.txt does contain include(CTest), so I have no clue what the issue is here actually.
The same options seem to work fine on Windows.
Any help on what I might be doing wrong here would be highly appreciated!

I looked a bit further, and found that the CTEST_USE_LAUNCHERS is set to ON in the HDF5 build in CTestScript.cmake, if Ninja/Make generator is used (that’s the difference to my Windows build I guess - there I used Visual Studio generator). Not sure about it’s exact use - is CMake automatically setting some compiler wrappers based on whether this is set, or is one supposed to set up such launchers somehow from the outside? In any case, I can only silence the error if I set CTEST_USE_LAUNCHERS to OFF.

CTEST_USE_LAUNCHERS error only happens when the build cannot find the source (at least for me).
CTEST_USE_LAUNCHERS setting is really harmless.

Something basic is not setup or correct.

Can you start with a clean location and follow the steps in the INSTALL_CMake.txt file and just go with the defaults?

If it helps something, this is on Ubuntu 20.04, with g++ 9.40. and cmake 3.24.1

CTEST_USE_LAUNCHERS error only happens when the build cannot find the source (at least for me).
CTEST_USE_LAUNCHERS setting is really harmless.

If CTEST_USE_LAUNCHERS itself is harmless, then there must be some other non-harmless setting tightly coupled to it. Because the build runs fine if I just change CTestScript.cmake (line 53) to:

# Launchers work only with Makefile and Ninja generators.
#if(NOT "${CTEST_CMAKE_GENERATOR}" MATCHES "Make|Ninja")
  set(CTEST_USE_LAUNCHERS 0)
  set(ENV{CTEST_USE_LAUNCHERS_DEFAULT} 0)
  set(BUILD_OPTIONS "${BUILD_OPTIONS} -DCTEST_USE_LAUNCHERS:BOOL=OFF")
#else()
#  set(CTEST_USE_LAUNCHERS 1)
#  set(ENV{CTEST_USE_LAUNCHERS_DEFAULT} 1)
#  set(BUILD_OPTIONS "${BUILD_OPTIONS} -DCTEST_USE_LAUNCHERS:BOOL=ON")
#endif()

Something basic is not setup or correct.
Can you start with a clean location and follow the steps in the INSTALL_CMake.txt file and just go with the defaults?

My automated build with which I have these problems follows these steps already (with changes and additions to HDF5config.cmake, as noted above, to speed up build times).

Just for testing, I now did a fresh manual build, with just the BUILD_SHARED_LIBS and BUILD_TESTING set to OFF - same issue. After that, another completely fresh test build without changing any settings in HDF5options.cmake -> problem did not occur. Another test build with just BUILD_TESTING to OFF -> problem appears.

Conclusion so far: Setting BUILD_TESTING to OFF is causing this issue, in conjunction with using Make/Ninja generator, and the CTEST_USE_LAUNCHERS option set through HDF5’s CTestScript.cmake.

Thanks - that helps! I can explore the “BUILD_TESTING to OFF” issue.

The CTEST_USE_LAUNCHERS maybe needs some debugging because I think that was recommended to us as I didn’t have Ninja installed.

If you wish, you can create a github issue for CTEST_USE_LAUNCHERS and BUILD_TESTING (include the Ninja as a note). And then we can track it. I will work on it next week so it can be in the next release.

It was not ninja but Unix Makefile generator (as per the build_unix.sh script). Probably happens the same on ninja though (since CTEST_USE_LAUNCHERS setting is done for this generator as well).

Looking at this further, if you are using the CTestScript.cmake file then you should be setting LOCAL_SKIP_TEST to TRUE also. The one change then that needs to be made is to change the line;
if(NOT “${CTEST_CMAKE_GENERATOR}” MATCHES “Make|Ninja”)
to add “OR LOCAL_SKIP_TEST”.

Setting BUILD_TESTING OFF if using LOCAL_SKIP_TEST, should not automatically happen because one might want to test later.