Export directory renamed to MD5 hash
There is a behavior change between CMake 3.23.3 and 3.24.1 when running an install(EXPORT)
. My apologies if this is a documented change or known bug and I've missed it.
The issue comes from running an install(EXPORT)
with a DESTINATION
path:
install(EXPORT TutorialExp
DESTINATION cmake
FILE TutorialExp.cmake
)
In CMake 3.23.3, this will create the TutorialExp.cmake file at the path <BUILD_DIR>/CMakeFiles/Export/cmake
.
In CMake 3.24.1, the TutorialExp.cmake file will instead be at the path <BUILD_DIR>/CMakeFiles/Export/272ceadb8458515b2ae4b5630a6029cc
, with this last directory being the MD5 hash of "cmake".
Changing the DESTINATION
from "cmake" to a different name will generate a folder with the MD5 hash of this new name.
Here is a sample reproducer for this issue based upon the sources of Step 2 provided in the CMake Tutorial. Note that the project generated by this will not compile but that is not needed for the issue presented here.
cmake_minimum_required(VERSION 3.10)
# set the project name and version
project(Tutorial VERSION 1.0)
# specify the C++ standard
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED True)
# configure a header file to pass some of the CMake settings
# to the source code
configure_file(TutorialConfig.h.in TutorialConfig.h)
# add the executable
add_executable(Tutorial tutorial.cxx)
install(TARGETS Tutorial
EXPORT TutorialExp
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
)
install(EXPORT TutorialExp
DESTINATION cmake
FILE TutorialExp.cmake
)