Closed alxbilger closed 1 year ago
I guess you are embedding a project based on the JRL cmake module into another CMake project?
Yes, but the master project does not interact (voluntarily) with JRL cmake project. Do you support this configuration?
Normally yes, but we might still need to fix some issues with this cmake feature. Could you provide a minimalist reproducible example to move forward?
one thing to look into is that we are relying on an old trick to trigger finalize calls (see details here) and while it still works in the most recent CMake versions for standalone projects it might not be working as nicely with more recent CMake versions (or under all circumstances when embedded inside another cmake project)
With CMake >= 3.19 we could rely on cmake_language(DEFER)
to achieve the same thing
@alxbilger if you have some time, would you mind trying the following modification in base.cmake
(around Line 214 which I pointed out earlier)
variable_watch(CMAKE_CURRENT_LIST_DIR SETUP_PROJECT_FINALIZE_HOOK)
function(SETUP_PROJECT_FINALIZE_HOOK VARIABLE ACCESS)
if("${${VARIABLE}}" STREQUAL "")
set(CMAKE_CURRENT_LIST_DIR ${PROJECT_JRL_CMAKE_MODULE_DIR})
set(JRL_CMAKEMODULE_LOGGING_FILENAME
"${PROJECT_JRL_CMAKE_BINARY_DIR}/config.log")
setup_project_finalize()
if(PROJECT_USE_CMAKE_EXPORT)
setup_project_package_finalize()
endif()
set(CMAKE_CURRENT_LIST_DIR "") # restore value
set(JRL_CMAKEMODULE_LOGGING_FILENAME "") # restore value
endif()
endfunction()
to
function(do_finalize)
setup_project_finalize()
if(PROJECT_USE_CMAKE_EXPORT)
setup_project_package_finalize()
endif()
endfunction()
cmake_language(DEFER CALL do_finalize)
This will trigger jrl-cmakemodules finalize calls at the end of the included project CMakeLists.txt without fail.
@gergondet I tested your suggestion and it works properly. I added a watch on JRL_CMAKEMODULE_LOGGING_FILENAME
and it always reads a defined value, whereas it was not the case before. I also confirm that the file config.log
is well created and filled. And I no longer have build failure in the doc
target.
I am closing this issue because it looks like that your issue has been solved. Feel free to reopen it if needed.
Hi,
I have a couple of errors in the configure step:
logging.cmake
, functionLOGGING_FINALIZE
, line 126, the variableJRL_CMAKEMODULE_LOGGING_FILENAME
is not defined, resulting in the failure of thefile(APPEND ...)
command. The variableJRL_CMAKEMODULE_LOGGING_FILENAME
is well defined in the beginning of the file, but somehow it is unset in the call ofLOGGING_FINALIZE
.doxygen.cmake
, the variableDOXYGEN_FOUND
is well defined in the function_SETUP_PROJECT_DOCUMENTATION
, but it is no longer defined in the function_SETUP_PROJECT_DOCUMENTATION_FINALIZE
. This problem does not cause a configuration error, but it is definitively a bug which results in the failure of the custom target.Windows 11, CMake 3.24.1