]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cmake: skip boost dependency on ALIAS targets
authorCasey Bodley <cbodley@redhat.com>
Sat, 27 Jan 2018 17:24:12 +0000 (12:24 -0500)
committerKefu Chai <kchai@redhat.com>
Tue, 27 Feb 2018 13:26:42 +0000 (21:26 +0800)
the boost override for add_library() does not work for ALIAS targets:

CMake Error at cmake/modules/BuildBoost.cmake:227 (add_dependencies):
  Cannot add target-level dependencies to alias target "Seastar::seastar".

Signed-off-by: Casey Bodley <cbodley@redhat.com>
cmake/modules/BuildBoost.cmake

index 32f6c1d07e016e756e0400431ac06897b89a8cf0..681e95b2f08abbe59650d0e68f8a0c8351de267a 100644 (file)
@@ -212,10 +212,6 @@ macro(build_boost version)
 endmacro()
 
 function(maybe_add_boost_dep target)
-  get_target_property(imported ${target} IMPORTED)
-  if(imported)
-    return()
-  endif()
   get_target_property(type ${target} TYPE)
   if(NOT type MATCHES "OBJECT_LIBRARY|STATIC_LIBRARY|SHARED_LIBRARY|EXECUTABLE")
     return()
@@ -234,7 +230,10 @@ endfunction()
 # override add_library() to add Boost headers dependency
 function(add_library target)
   _add_library(${target} ${ARGN})
-  maybe_add_boost_dep(${target})
+  # can't add dependencies to aliases or imported libraries
+  if (NOT ";${ARGN};" MATCHES ";(ALIAS|IMPORTED);")
+    maybe_add_boost_dep(${target})
+  endif()
 endfunction()
 
 function(add_executable target)