From 5156e45b5bc5a396f688333f84e2c90f05c9eb13 Mon Sep 17 00:00:00 2001 From: Nils Wentzell Date: Wed, 10 Jun 2020 16:53:25 -0400 Subject: [PATCH] [cmake] Make sure to use namespaced targets in c++ test dir --- CMakeLists.txt | 1 - test/c++/CMakeLists.txt | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6d148331..e42c001e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 diff --git a/test/c++/CMakeLists.txt b/test/c++/CMakeLists.txt index 071b5fd2..36466c39 100644 --- a/test/c++/CMakeLists.txt +++ b/test/c++/CMakeLists.txt @@ -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