[PATCH] D53376: Fix generation of exported targets in build directory

Marcin Copik via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 17 08:11:29 PDT 2018


mcopik created this revision.
mcopik added a reviewer: grosser.
Herald added subscribers: llvm-commits, mgorny.
Herald added a reviewer: bollu.

After a long investigation of my own CMake scripts, I found out that CMake is not able to link with Polly libraries because the exported targets file is not generated correctly in the build directory when `CONFIG` is not set.

The generated file `lib/cmake/polly/PollyExports-all.cmake`

  set_target_properties(LLVMPolly PROPERTIES
                IMPORTED_LOCATION_ my_build_dir/lib/LLVMPolly.so)
  set_target_properties(Polly PROPERTIES
                IMPORTED_LOCATION_ my_build_dir/lib/libPolly.a)

Please notice the additional underscore at the end of `IMPORTED_LOCATION`. The generation for install directory works correctly since the generator expression used there adds the underscore and config name only when it's defined. This patch simply adds this missing guard for cmake files generated in the build directory.


Repository:
  rPLO Polly

https://reviews.llvm.org/D53376

Files:
  cmake/CMakeLists.txt


Index: cmake/CMakeLists.txt
===================================================================
--- cmake/CMakeLists.txt
+++ cmake/CMakeLists.txt
@@ -60,7 +60,7 @@
   if (NOT tgt_type STREQUAL "INTERFACE_LIBRARY")
     set(POLLY_EXPORTS
       "set_target_properties(${tgt} PROPERTIES
-              IMPORTED_LOCATION_$<UPPER_CASE:$<CONFIG>> $<TARGET_FILE:${tgt}>)
+              IMPORTED_LOCATION$<$<NOT:$<CONFIG:>>:_<UPPER_CASE:$<CONFIG>> $<TARGET_FILE:${tgt}>)
 ${POLLY_EXPORTS}")
   endif()
 endforeach(tgt)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53376.170011.patch
Type: text/x-patch
Size: 512 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181017/b646c961/attachment.bin>


More information about the llvm-commits mailing list