From 43f415de09f82a8b42f3c8b45acff111b19233ef Mon Sep 17 00:00:00 2001 From: Isaac Morales Date: Tue, 17 Sep 2024 19:26:25 +0200 Subject: [PATCH] Modify modulemap path --- cmake/BioDynaMo.cmake | 8 ++++++-- cmake/RootMacros.cmake | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/cmake/BioDynaMo.cmake b/cmake/BioDynaMo.cmake index 407b1a04f..b2d1f1bb7 100644 --- a/cmake/BioDynaMo.cmake +++ b/cmake/BioDynaMo.cmake @@ -112,9 +112,13 @@ function(build_shared_library TARGET) set(DICT_FILE "${CMAKE_CURRENT_BINARY_DIR}/lib${TARGET}_dict") set(BDM_DICT_FILE "${CMAKE_CURRENT_BINARY_DIR}/lib${TARGET}_bdm_dict.cc") set(module "${TARGET}") + set(ROOT_HEADERS) + string(REPLACE "${CMAKE_SOURCE_DIR}/src/" "" ROOT_HEADERS_TEMP "${ARG_HEADERS}") + string(REPLACE "${CMAKE_SOURCE_DIR}/test/" "" ROOT_HEADERS "${ROOT_HEADERS_TEMP}") + if (runtime_cxxmodules) - set(MODULEMAP "--moduleMapFile=${CMAKE_SOURCE_DIR}/src/module.modulemap") + set(CLING_MODULEMAP_FILES "$ENV{${CMAKE_BINARY_DIR}/include/module.modulemap}") endif() if (NOT ${TARGET} STREQUAL "biodynamo") @@ -129,7 +133,7 @@ function(build_shared_library TARGET) if(NOT DEFINED BDM_CMAKE_DIR) set(BDM_CMAKE_DIR $ENV{BDMSYS}/share/cmake) endif() - ROOT_GENERATE_DICTIONARY(${DICT_FILE} ${ARG_HEADERS} MODULE ${module} LINKDEF ${BDM_CMAKE_DIR}/${ARG_SELECTION} REFLEX ${NO_MODULE} OPTIONS ${DEPENDENCY_OPTION} -I src --inlineInputHeader --noIncludePaths ${MODULEMAP}) + ROOT_GENERATE_DICTIONARY(${DICT_FILE} ${ROOT_HEADERS} MODULE ${module} LINKDEF ${BDM_CMAKE_DIR}/${ARG_SELECTION} REFLEX ${NO_MODULE} OPTIONS ${DEPENDENCY_OPTION} -I src --inlineInputHeader --noIncludePaths ${MODULEMAP}) if (BDM_OUT_OF_SOURCE) set(BDM_DICT_BIN_PATH "$ENV{BDMSYS}/bin") else() diff --git a/cmake/RootMacros.cmake b/cmake/RootMacros.cmake index 8d223ed72..0dca9ddfc 100644 --- a/cmake/RootMacros.cmake +++ b/cmake/RootMacros.cmake @@ -844,7 +844,7 @@ function (ROOT_CXXMODULES_APPEND_TO_MODULEMAP library library_headers) # exposed via the main modulemap. This is exposed by setting the # ROOT_CXXMODULES_WRITE_TO_CURRENT_DIR. if (NOT "${CMAKE_PROJECT_NAME}" STREQUAL ROOT OR ROOT_CXXMODULES_WRITE_TO_CURRENT_DIR) - set(modulemap_output_file "${CMAKE_SOURCE_DIR}/src/module.modulemap") + set(modulemap_output_file "${CMAKE_BINARY_DIR}/include/module.modulemap") # It's possible that multiple modulemaps are needed in the current # directory and we need to merge them. As we don't want to have multiple