[test-suite] r338620 - cmake: Use generator expression to get target path
Matthias Braun via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 1 13:22:29 PDT 2018
Author: matze
Date: Wed Aug 1 13:22:29 2018
New Revision: 338620
URL: http://llvm.org/viewvc/llvm-project?rev=338620&view=rev
Log:
cmake: Use generator expression to get target path
This is the recommended way to deal with this in cmake.
This makes it easier to move the targets around (in upcoming patches).
Modified:
test-suite/trunk/cmake/modules/TestFile.cmake
test-suite/trunk/cmake/modules/TestSuite.cmake
Modified: test-suite/trunk/cmake/modules/TestFile.cmake
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/cmake/modules/TestFile.cmake?rev=338620&r1=338619&r2=338620&view=diff
==============================================================================
--- test-suite/trunk/cmake/modules/TestFile.cmake (original)
+++ test-suite/trunk/cmake/modules/TestFile.cmake Wed Aug 1 13:22:29 2018
@@ -82,3 +82,7 @@ function(llvm_add_test testfile executab
# flush the test script
set(TESTSCRIPT "" PARENT_SCOPE)
endfunction()
+
+macro(llvm_add_test_for_target target)
+ llvm_add_test($<TARGET_FILE_DIR:${target}>/${target}.test $<TARGET_FILE:${target}>)
+endmacro()
Modified: test-suite/trunk/cmake/modules/TestSuite.cmake
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/cmake/modules/TestSuite.cmake?rev=338620&r1=338619&r2=338620&view=diff
==============================================================================
--- test-suite/trunk/cmake/modules/TestSuite.cmake (original)
+++ test-suite/trunk/cmake/modules/TestSuite.cmake Wed Aug 1 13:22:29 2018
@@ -18,14 +18,14 @@ macro(llvm_test_executable target)
# Note that we cannot use target_link_libraries() here because that one
# only interprets inputs starting with '-' as flags.
append_target_flags(LINK_LIBRARIES ${target} ${LDFLAGS})
- set(target_path ${CMAKE_CURRENT_BINARY_DIR}/${target})
+ set(target_path $<TARGET_FILE:${target}>)
if(TEST_SUITE_PROFILE_USE)
append_target_flags(COMPILE_FLAGS ${target} -fprofile-instr-use=${target_path}.profdata)
append_target_flags(LINK_LIBRARIES ${target} -fprofile-instr-use=${target_path}.profdata)
endif()
set_property(GLOBAL APPEND PROPERTY TEST_SUITE_TARGETS ${target})
- llvm_add_test(${CMAKE_CURRENT_BINARY_DIR}/${target}.test ${target_path})
+ llvm_add_test_for_target(${target})
test_suite_add_build_dependencies(${target})
endmacro()
More information about the llvm-commits
mailing list