3
0
mirror of https://github.com/triqs/dft_tools synced 2024-06-29 00:15:00 +02:00

[cmake] Make sure to use namespaced targets in c++ test dir

This commit is contained in:
Nils Wentzell 2020-06-10 16:53:25 -04:00
parent 354f1420c1
commit 5156e45b5b
2 changed files with 1 additions and 2 deletions

View File

@ -100,7 +100,6 @@ add_compile_options(
# Create an Interface target for compiler warnings
add_library(${PROJECT_NAME}_warnings INTERFACE)
add_library(${PROJECT_NAME}::${PROJECT_NAME}_warnings ALIAS ${PROJECT_NAME}_warnings)
target_compile_options(${PROJECT_NAME}_warnings
INTERFACE
-Wall

View File

@ -11,7 +11,7 @@ foreach(test ${all_tests})
get_filename_component(test_name ${test} NAME_WE)
get_filename_component(test_dir ${test} DIRECTORY)
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})
add_test(NAME ${test_name} COMMAND ${test_name} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${test_dir})
# Run clang-tidy if found