From 21de8adc3646147c2e7372d9d323fe67be5f4669 Mon Sep 17 00:00:00 2001 From: Michael Kruse Date: Fri, 12 Jan 2018 16:09:18 +0000 Subject: [PATCH] [CMake] Use only keyword-version of target_link_library. NFC. CMake insists that for each target, one uses only the non-keyword version of target_link_library target_link_library(mytarget lib) or the one with PUBLIC/PRIVATE/INTERFACE keyword: target_link_library(mytarget PUBLIC lib) Otherwise, CMake fails with the error message: The keyword signature for target_link_libraries has already been used with the target "mytarget". All uses of target_link_libraries with a target must be either all-keyword or all-plain. Change all occurances of target_link_library to the newer keyworded version to avoid such errors. Some already have been changed in r319840, but might not be sufficient for all build configurations to build the doxygen manual. Reported-by: Tanya Lattner llvm-svn: 322376 --- polly/CMakeLists.txt | 4 ++-- polly/cmake/polly_macros.cmake | 4 ++-- polly/lib/CMakeLists.txt | 12 ++++++------ polly/lib/External/CMakeLists.txt | 4 ++-- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/polly/CMakeLists.txt b/polly/CMakeLists.txt index 9ddc0f7ff81d..af0263b7810e 100644 --- a/polly/CMakeLists.txt +++ b/polly/CMakeLists.txt @@ -49,10 +49,10 @@ if (NOT DEFINED LLVM_MAIN_SRC_DIR) "${UNITTEST_DIR}/googletest" "${UNITTEST_DIR}/googlemock" ) - target_link_libraries(gtest -lpthread) + target_link_libraries(gtest PUBLIC -lpthread) add_library(gtest_main ${UNITTEST_DIR}/UnitTestMain/TestMain.cpp) - target_link_libraries(gtest_main gtest) + target_link_libraries(gtest_main PUBLIC gtest) set(POLLY_GTEST_AVAIL 1) endif() diff --git a/polly/cmake/polly_macros.cmake b/polly/cmake/polly_macros.cmake index 32bed50bb060..e48203871884 100644 --- a/polly/cmake/polly_macros.cmake +++ b/polly/cmake/polly_macros.cmake @@ -28,13 +28,13 @@ macro(add_polly_library name) endif( LLVM_COMMON_DEPENDS ) if( LLVM_USED_LIBS ) foreach(lib ${LLVM_USED_LIBS}) - target_link_libraries( ${name} ${lib} ) + target_link_libraries( ${name} PUBLIC ${lib} ) endforeach(lib) endif( LLVM_USED_LIBS ) if(POLLY_LINK_LIBS) foreach(lib ${POLLY_LINK_LIBS}) - target_link_libraries(${name} ${lib}) + target_link_libraries(${name} PUBLIC ${lib}) endforeach(lib) endif(POLLY_LINK_LIBS) diff --git a/polly/lib/CMakeLists.txt b/polly/lib/CMakeLists.txt index cba633af2dd9..0e81a31295ba 100644 --- a/polly/lib/CMakeLists.txt +++ b/polly/lib/CMakeLists.txt @@ -75,14 +75,14 @@ set_target_properties(PollyCore PROPERTIES FOLDER "Polly") # LLVM_POLLY_LINK_INTO_TOOLS=ON, its dependencies like PollyISL are linked as # well. add_polly_library(Polly $) -target_link_libraries(Polly +target_link_libraries(Polly PUBLIC ${ISL_TARGET} ${JSONCPP_LIBRARIES} ) # Additional dependencies for Polly-ACC. if (GPU_CODEGEN) - target_link_libraries(Polly PollyPPCG) + target_link_libraries(Polly PUBLIC PollyPPCG) endif () @@ -100,9 +100,9 @@ if (LLVM_LINK_LLVM_DYLIB) # (their LLVM*.a/so and their copies in libLLVM.so) # which results in errors when the two instances try to register the same # command-line switches. - target_link_libraries(Polly LLVM) + target_link_libraries(Polly PUBLIC LLVM) else () - target_link_libraries(Polly + target_link_libraries(Polly PUBLIC LLVMSupport LLVMCore LLVMScalarOpts @@ -145,9 +145,9 @@ else () # hosts. This is not the case for bugpoint. Use LLVM_POLLY_LINK_INTO_TOOLS=ON # instead which will automatically resolve the additional dependencies by # Polly. - target_link_libraries(LLVMPolly ${ISL_TARGET} ${JSONCPP_LIBRARIES}) + target_link_libraries(LLVMPolly PUBLIC ${ISL_TARGET} ${JSONCPP_LIBRARIES}) if (GPU_CODEGEN) - target_link_libraries(LLVMPolly PollyPPCG) + target_link_libraries(LLVMPolly PUBLIC PollyPPCG) endif () set_target_properties(LLVMPolly diff --git a/polly/lib/External/CMakeLists.txt b/polly/lib/External/CMakeLists.txt index b3c6e73a7a00..8ab07d813cb4 100644 --- a/polly/lib/External/CMakeLists.txt +++ b/polly/lib/External/CMakeLists.txt @@ -281,7 +281,7 @@ if (POLLY_BUNDLED_ISL) ) set_target_properties(polly-isl-test PROPERTIES FOLDER "Polly") - target_link_libraries(polly-isl-test + target_link_libraries(polly-isl-test PRIVATE PollyISL ) @@ -342,7 +342,7 @@ add_polly_library(PollyPPCG ${PPCG_FILES} ) -target_link_libraries(PollyPPCG ${ISL_TARGET}) +target_link_libraries(PollyPPCG PUBLIC ${ISL_TARGET}) # Disable warnings for upstream projects. if (MSVC)