mirror of
https://github.com/triqs/dft_tools
synced 2024-12-23 04:43:42 +01:00
[cmake] Make sure to use namespaced targets in c++ test dir
This commit is contained in:
parent
354f1420c1
commit
5156e45b5b
@ -100,7 +100,6 @@ add_compile_options(
|
|||||||
|
|
||||||
# Create an Interface target for compiler warnings
|
# Create an Interface target for compiler warnings
|
||||||
add_library(${PROJECT_NAME}_warnings INTERFACE)
|
add_library(${PROJECT_NAME}_warnings INTERFACE)
|
||||||
add_library(${PROJECT_NAME}::${PROJECT_NAME}_warnings ALIAS ${PROJECT_NAME}_warnings)
|
|
||||||
target_compile_options(${PROJECT_NAME}_warnings
|
target_compile_options(${PROJECT_NAME}_warnings
|
||||||
INTERFACE
|
INTERFACE
|
||||||
-Wall
|
-Wall
|
||||||
|
@ -11,7 +11,7 @@ foreach(test ${all_tests})
|
|||||||
get_filename_component(test_name ${test} NAME_WE)
|
get_filename_component(test_name ${test} NAME_WE)
|
||||||
get_filename_component(test_dir ${test} DIRECTORY)
|
get_filename_component(test_dir ${test} DIRECTORY)
|
||||||
add_executable(${test_name} ${test})
|
add_executable(${test_name} ${test})
|
||||||
target_link_libraries(${test_name} ${PROJECT_NAME}_c gtest_main ${PROJECT_NAME}_warnings)
|
target_link_libraries(${test_name} ${PROJECT_NAME}::${PROJECT_NAME}_c ${PROJECT_NAME}_warnings gtest_main)
|
||||||
set_property(TARGET ${test_name} PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${test_dir})
|
set_property(TARGET ${test_name} PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${test_dir})
|
||||||
add_test(NAME ${test_name} COMMAND ${test_name} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${test_dir})
|
add_test(NAME ${test_name} COMMAND ${test_name} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${test_dir})
|
||||||
# Run clang-tidy if found
|
# Run clang-tidy if found
|
||||||
|
Loading…
Reference in New Issue
Block a user