Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 10 additions & 31 deletions cmake/modules/RootMacros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2315,17 +2315,14 @@ macro(ROOTTEST_COMPILE_MACRO filename)
list(APPEND RootMacroDirDefines "-e;#define ${d}")
endforeach()

set(RootMacroBuildDefines
-e "#define CMakeEnvironment"
-e "#define CMakeBuildDir \"${CMAKE_CURRENT_BINARY_DIR}\""
-e "gSystem->AddDynamicPath(\"${CMAKE_CURRENT_BINARY_DIR}\")"
-e "gROOT->SetMacroPath(\"${CMAKE_CURRENT_SOURCE_DIR}\")"
-e "gInterpreter->AddIncludePath(\"-I${CMAKE_CURRENT_BINARY_DIR}\")"
-e "gSystem->AddIncludePath(\"-I${CMAKE_CURRENT_BINARY_DIR}\")"
-e "gSystem->SetBuildDir(\"${CMAKE_CURRENT_BINARY_DIR}\", true)"
${RootMacroDirDefines})

set(root_compile_macro ${ROOT_root_CMD} ${RootMacroBuildDefines} -q -l -b)
set(root_compile_macro ${CMAKE_COMMAND} -E env
ROOT_LIBRARY_PATH="${CMAKE_CURRENT_BINARY_DIR}"
ROOT_INCLUDE_PATH="${CMAKE_CURRENT_BINARY_DIR}"
${ROOT_root_CMD}
-e "gSystem->SetBuildDir(\"${CMAKE_CURRENT_BINARY_DIR}\", true)"
${RootMacroDirDefines}
-q -l -b
)

get_filename_component(realfp ${filename} ABSOLUTE)
if(MSVC)
Expand All @@ -2341,36 +2338,18 @@ macro(ROOTTEST_COMPILE_MACRO filename)
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})

if(ARG_DEPENDS)
set(deps ${ARG_DEPENDS})
message(WARNING "Specifying DEPENDS in ROOTTEST_COMPILE_MACRO has no effect.")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that this warning is never hit. Nowhere in the codebase to we specify DEPENDS in a ROOTTEST_COMPILE_MACRO. Together with the dependencies being ignored via the \fast target when using Makefiles, that makes it clear to me that it was never the intention to have dependencies for these macro tests.

The problem is that even with no dependencies, a re-configuration will still be triggered if the CMake code was changed, which is the reason thy the RUN_SERIAL true workaround was needed.

endif()

ROOTTEST_TARGETNAME_FROM_FILE(COMPILE_MACRO_TEST ${filename})

set(compile_target ${COMPILE_MACRO_TEST}-compile-macro)

add_custom_target(${compile_target}
COMMAND ${compile_macro_command}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
VERBATIM)

if(ARG_DEPENDS)
add_dependencies(${compile_target} ${deps})
endif()

set(COMPILE_MACRO_TEST ${COMPILE_MACRO_TEST}-build)

add_test(NAME ${COMPILE_MACRO_TEST}
COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR}
${build_config}
--target ${compile_target}${fast}
-- ${always-make})
add_test(NAME ${COMPILE_MACRO_TEST} COMMAND ${compile_macro_command})
if(NOT MSVC OR win_broken_tests)
set_property(TEST ${COMPILE_MACRO_TEST} PROPERTY FAIL_REGULAR_EXPRESSION "Warning in")
endif()
set_property(TEST ${COMPILE_MACRO_TEST} PROPERTY ENVIRONMENT ${ROOTTEST_ENVIRONMENT})
if(CMAKE_GENERATOR MATCHES Ninja AND NOT MSVC)
set_property(TEST ${COMPILE_MACRO_TEST} PROPERTY RUN_SERIAL true)
endif()
if (ARG_FIXTURES_SETUP)
set_property(TEST ${COMPILE_MACRO_TEST} PROPERTY
FIXTURES_SETUP ${ARG_FIXTURES_SETUP})
Expand Down
3 changes: 0 additions & 3 deletions roottest/scripts/build.C
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,6 @@ void build(const char *filename, const char *lib = 0, const char *obj = 0, const
}
// fprintf(stderr,"from %s to %s\n",filename,fname.Data());
int result = gSystem->CompileMacro(fname,"kc");
#elif defined(CMakeEnvironment) && defined(CMakeBuildDir)
// fprintf(stderr,"CmakeBuildDir: %s filename: %s", CMakeBuildDir, filename);
int result = gSystem->CompileMacro(filename,"kc-", libname, CMakeBuildDir);
#else
int result = gSystem->CompileMacro(filename,"kc", libname);
#endif
Expand Down
Loading