Skip to content

Commit 08d77bb

Browse files
committed
[CMake] Don't wrap command in ROOTTEST_COMPILE_MACRO in CMake target
Instead of running the `root ... <macro>.C+` build step as the command associated with a custom CMake target, just run the command directly in the test added with `add_test`. This simplification is possible because for the custom CMake target, no dependencies are ever specified. This makes building it not different from just running the underlying command directly.
1 parent adc3cbe commit 08d77bb

File tree

1 file changed

+3
-26
lines changed

1 file changed

+3
-26
lines changed

cmake/modules/RootMacros.cmake

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2291,8 +2291,7 @@ endfunction(ROOTTEST_ADD_AUTOMACROS)
22912291
#-------------------------------------------------------------------------------
22922292
#
22932293
# macro ROOTTEST_COMPILE_MACRO(<filename> [BUILDOBJ object] [BUILDLIB lib]
2294-
# [FIXTURES_SETUP ...] [FIXTURES_CLEANUP ...] [FIXTURES_REQUIRED ...]
2295-
# [DEPENDS dependencies...])
2294+
# [FIXTURES_SETUP ...] [FIXTURES_CLEANUP ...] [FIXTURES_REQUIRED ...])
22962295
#
22972296
# This macro creates and loads a shared library containing the code from
22982297
# the file <filename>. A test that performs the compilation is created.
@@ -2302,7 +2301,7 @@ endfunction(ROOTTEST_ADD_AUTOMACROS)
23022301
#
23032302
#-------------------------------------------------------------------------------
23042303
macro(ROOTTEST_COMPILE_MACRO filename)
2305-
CMAKE_PARSE_ARGUMENTS(ARG "" "BUILDOBJ;BUILDLIB" "DEPENDS;FIXTURES_SETUP;FIXTURES_CLEANUP;FIXTURES_REQUIRED" ${ARGN})
2304+
CMAKE_PARSE_ARGUMENTS(ARG "" "BUILDOBJ;BUILDLIB" "FIXTURES_SETUP;FIXTURES_CLEANUP;FIXTURES_REQUIRED" ${ARGN})
23062305

23072306
# Add defines to root_compile_macro, in order to have out-of-source builds
23082307
# when using the scripts/build.C macro.
@@ -2340,37 +2339,15 @@ macro(ROOTTEST_COMPILE_MACRO filename)
23402339
${BuildScriptFile}${BuildScriptArg}
23412340
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
23422341

2343-
if(ARG_DEPENDS)
2344-
set(deps ${ARG_DEPENDS})
2345-
endif()
2346-
23472342
ROOTTEST_TARGETNAME_FROM_FILE(COMPILE_MACRO_TEST ${filename})
23482343

2349-
set(compile_target ${COMPILE_MACRO_TEST}-compile-macro)
2350-
2351-
add_custom_target(${compile_target}
2352-
COMMAND ${compile_macro_command}
2353-
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
2354-
VERBATIM)
2355-
2356-
if(ARG_DEPENDS)
2357-
add_dependencies(${compile_target} ${deps})
2358-
endif()
2359-
23602344
set(COMPILE_MACRO_TEST ${COMPILE_MACRO_TEST}-build)
23612345

2362-
add_test(NAME ${COMPILE_MACRO_TEST}
2363-
COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR}
2364-
${build_config}
2365-
--target ${compile_target}${fast}
2366-
-- ${always-make})
2346+
add_test(NAME ${COMPILE_MACRO_TEST} COMMAND ${compile_macro_command})
23672347
if(NOT MSVC OR win_broken_tests)
23682348
set_property(TEST ${COMPILE_MACRO_TEST} PROPERTY FAIL_REGULAR_EXPRESSION "Warning in")
23692349
endif()
23702350
set_property(TEST ${COMPILE_MACRO_TEST} PROPERTY ENVIRONMENT ${ROOTTEST_ENVIRONMENT})
2371-
if(CMAKE_GENERATOR MATCHES Ninja AND NOT MSVC)
2372-
set_property(TEST ${COMPILE_MACRO_TEST} PROPERTY RUN_SERIAL true)
2373-
endif()
23742351
if (ARG_FIXTURES_SETUP)
23752352
set_property(TEST ${COMPILE_MACRO_TEST} PROPERTY
23762353
FIXTURES_SETUP ${ARG_FIXTURES_SETUP})

0 commit comments

Comments
 (0)