@@ -334,7 +334,7 @@ install(
334334 "${CMAKE_CURRENT_BINARY_DIR } /cmake/QualityControlConfigVersion.cmake"
335335 DESTINATION ${CMAKE_INSTALL_LIBDIR} /cmake/QualityControl)
336336
337- # ---- Extra scripts ----
337+ # ---- Install config files and scripts ----
338338
339339install (FILES example-default.json
340340 alfa.json
@@ -357,7 +357,28 @@ install(PROGRAMS script/RepoCleaner/1_per_hour.py script/RepoCleaner/Ccdb.py scr
357357 script /o2-qc-database-setup.sh
358358 DESTINATION bin)
359359
360- file (COPY test /testSharedConfig.json test /testWorkflow.json
361- DESTINATION ${CMAKE_BINARY_DIR } /tests/ )
360+ # ---- Copy test files ----
361+ #
362+ # Using file(COPY is wrong because cmake will not detect when the files are modified.
363+ # Using install is also wrong because we don't want to install nor package the test files.
364+ # The solution is this ugly piece of cmake code.
365+
366+ set (TEST_FILES
367+ "testSharedConfig.json"
368+ "testWorkflow.json" )
369+ set (TEST_FILES_PREFIXED ${TEST_FILES} )
370+ list (TRANSFORM TEST_FILES_PREFIXED PREPEND ${CMAKE_BINARY_DIR } /tests/)
371+
372+ foreach (test_file ${TEST_FILES} )
373+ message ("**** ${test_file} " )
374+ add_custom_command (
375+ OUTPUT ${CMAKE_BINARY_DIR } /tests/${test_file}
376+ COMMAND ${CMAKE_COMMAND } -E copy ${CMAKE_CURRENT_SOURCE_DIR } /test/${test_file}
377+ ${CMAKE_BINARY_DIR } /tests/${test_file}
378+ MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR } /test/${test_file}
379+ COMMENT "Copying ${test_file} " )
380+ endforeach ()
362381
363- file (COPY streamerinfos.root streamerinfos_v017.root DESTINATION ${CMAKE_BINARY_DIR } /etc/ )
382+ add_custom_target (copy_test_files ALL
383+ DEPENDS ${TEST_FILES_PREFIXED}
384+ )
0 commit comments