Skip to content

Commit c273e07

Browse files
committed
[CMake] Simplify ROOTTEST_COMPILE_MACRO to shorten test command
* Remove preprocessor variables that were always defined and hence carried no information * Add include path and library path via environment variables * Remove redundant `gROOT->SetMacroPath()` call with path to source directory, because the `${realfp}` variable passed to the `build.C` script already contains the full path
1 parent 08d77bb commit c273e07

File tree

2 files changed

+8
-14
lines changed

2 files changed

+8
-14
lines changed

cmake/modules/RootMacros.cmake

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2314,17 +2314,14 @@ macro(ROOTTEST_COMPILE_MACRO filename)
23142314
list(APPEND RootMacroDirDefines "-e;#define ${d}")
23152315
endforeach()
23162316

2317-
set(RootMacroBuildDefines
2318-
-e "#define CMakeEnvironment"
2319-
-e "#define CMakeBuildDir \"${CMAKE_CURRENT_BINARY_DIR}\""
2320-
-e "gSystem->AddDynamicPath(\"${CMAKE_CURRENT_BINARY_DIR}\")"
2321-
-e "gROOT->SetMacroPath(\"${CMAKE_CURRENT_SOURCE_DIR}\")"
2322-
-e "gInterpreter->AddIncludePath(\"-I${CMAKE_CURRENT_BINARY_DIR}\")"
2323-
-e "gSystem->AddIncludePath(\"-I${CMAKE_CURRENT_BINARY_DIR}\")"
2324-
-e "gSystem->SetBuildDir(\"${CMAKE_CURRENT_BINARY_DIR}\", true)"
2325-
${RootMacroDirDefines})
2326-
2327-
set(root_compile_macro ${ROOT_root_CMD} ${RootMacroBuildDefines} -q -l -b)
2317+
set(root_compile_macro ${CMAKE_COMMAND} -E env
2318+
ROOT_LIBRARY_PATH="${CMAKE_CURRENT_BINARY_DIR}"
2319+
ROOT_INCLUDE_PATH="${CMAKE_CURRENT_BINARY_DIR}"
2320+
${ROOT_root_CMD}
2321+
-e "gSystem->SetBuildDir(\"${CMAKE_CURRENT_BINARY_DIR}\", true)"
2322+
${RootMacroDirDefines}
2323+
-q -l -b
2324+
)
23282325

23292326
get_filename_component(realfp ${filename} ABSOLUTE)
23302327
if(MSVC)

roottest/scripts/build.C

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,6 @@ void build(const char *filename, const char *lib = 0, const char *obj = 0, const
7575
}
7676
// fprintf(stderr,"from %s to %s\n",filename,fname.Data());
7777
int result = gSystem->CompileMacro(fname,"kc");
78-
#elif defined(CMakeEnvironment) && defined(CMakeBuildDir)
79-
// fprintf(stderr,"CmakeBuildDir: %s filename: %s", CMakeBuildDir, filename);
80-
int result = gSystem->CompileMacro(filename,"kc-", libname, CMakeBuildDir);
8178
#else
8279
int result = gSystem->CompileMacro(filename,"kc", libname);
8380
#endif

0 commit comments

Comments
 (0)