File tree Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -11,13 +11,25 @@ find_package(Parquet REQUIRED)
11
11
add_library (xsf INTERFACE )
12
12
target_include_directories (xsf INTERFACE ${CMAKE_SOURCE_DIR} /include )
13
13
14
+ set (TEST_BASE_DIR "${CMAKE_SOURCE_DIR} /tests" )
15
+
14
16
file (GLOB TEST_SOURCES "*/test_*.cpp" )
15
17
foreach (test_file ${TEST_SOURCES} )
18
+ # Families of tests go in subfolders of xsf/tests. Test files in different
19
+ # folders can have the same name. Try to generate a unique target name based
20
+ # on the test name and its parent folder(s).
16
21
get_filename_component (test_name ${test_file} NAME_WE )
17
- add_executable (${test_name} .test ${test_file} )
18
- target_link_libraries (${test_name} .test PRIVATE Catch2::Catch2WithMain Arrow::arrow_shared Parquet::parquet_shared xsf )
19
- target_compile_definitions (${test_name} .test PRIVATE XSREF_TABLES_PATH= "${XSREF_TABLES_PATH} " )
22
+ get_filename_component (test_dir ${test_file} DIRECTORY )
23
+ file (RELATIVE_PATH test_dir ${TEST_BASE_DIR} ${test_dir} )
24
+ string (REPLACE "/" "-" test_dir ${test_dir} )
25
+ set (target_name ${test_dir} _${test_name} )
26
+
27
+ add_executable (${target_name} ${test_file} )
28
+
29
+ target_link_libraries (${target_name} PRIVATE Catch2::Catch2WithMain Arrow::arrow_shared Parquet::parquet_shared xsf )
30
+
31
+ target_compile_definitions (${target_name} PRIVATE XSREF_TABLES_PATH= "${XSREF_TABLES_PATH} " )
20
32
include (CTest )
21
33
include (Catch )
22
- catch_discover_tests (${test_name} .test )
34
+ catch_discover_tests (${target_name} )
23
35
endforeach ()
You can’t perform that action at this time.
0 commit comments