]> granicus.if.org Git - llvm/commitdiff
[CMake] Use if(... IN_LIST ...) instead of list(FIND...)
authorChris Bieneman <beanz@apple.com>
Tue, 27 Sep 2016 17:47:24 +0000 (17:47 +0000)
committerChris Bieneman <beanz@apple.com>
Tue, 27 Sep 2016 17:47:24 +0000 (17:47 +0000)
NFC. This is just a little code cleanup to make things easier to read and understand.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282510 91177308-0d34-0410-b5e6-96231b3b80d8

cmake/modules/AddLLVM.cmake

index 94c08f5daf76ac65c313cdb424385fa87c5c04d3..51ae62da200e6eaa378fd522b5a7c8309d1903b3 100644 (file)
@@ -776,8 +776,7 @@ macro(add_llvm_tool name)
   endif()
   add_llvm_executable(${name} ${ARGN})
 
-  list(FIND LLVM_TOOLCHAIN_TOOLS ${name} LLVM_IS_${name}_TOOLCHAIN_TOOL)
-  if (LLVM_IS_${name}_TOOLCHAIN_TOOL GREATER -1 OR NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+  if ( ${name} IN_LIST LLVM_TOOLCHAIN_TOOLS OR NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
     if( LLVM_BUILD_TOOLS )
       install(TARGETS ${name}
               EXPORT LLVMExports
@@ -1264,20 +1263,13 @@ function(add_llvm_tool_symlink name dest)
     add_custom_target(${target_name} ALL DEPENDS ${output_path})
     set_target_properties(${target_name} PROPERTIES FOLDER Tools)
 
-    # Make sure the parent tool is a toolchain tool, otherwise exclude this tool
-    list(FIND LLVM_TOOLCHAIN_TOOLS ${dest} LLVM_IS_${dest}_TOOLCHAIN_TOOL)
-    if (NOT LLVM_IS_${dest}_TOOLCHAIN_TOOL GREATER -1)
-      set(LLVM_IS_${name}_TOOLCHAIN_TOOL ${LLVM_IS_${dest}_TOOLCHAIN_TOOL})
-    else()
-      list(FIND LLVM_TOOLCHAIN_TOOLS ${name} LLVM_IS_${name}_TOOLCHAIN_TOOL)
+    # Make sure both the link and target are toolchain tools
+    if (NOT ${name} IN_LIST LLVM_TOOLCHAIN_TOOLS OR NOT ${dest} IN_LIST LLVM_TOOLCHAIN_TOOLS)
+      return()
     endif()
 
-    # LLVM_IS_${name}_TOOLCHAIN_TOOL will only be greater than -1 if both this
-    # tool and its parent tool are in LLVM_TOOLCHAIN_TOOLS
-    if (LLVM_IS_${name}_TOOLCHAIN_TOOL GREATER -1 OR NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
-      if( LLVM_BUILD_TOOLS )
-        llvm_install_symlink(${name} ${dest})
-      endif()
+    if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY AND LLVM_BUILD_TOOLS )
+      llvm_install_symlink(${name} ${dest})
     endif()
   endif()
 endfunction()