llvm.org GIT mirror llvm / 2982c08
CMake: Add LLVM_INSTALL_TOOLCHAIN_ONLY option. Differential Revision: http://llvm-reviews.chandlerc.com/D1428 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189155 91177308-0d34-0410-b5e6-96231b3b80d8 Hans Wennborg 6 years ago
3 changed file(s) with 69 addition(s) and 45 deletion(s). Raw diff Collapse all Expand all
1313 set(LLVM_VERSION_MINOR 4)
1414
1515 set(PACKAGE_VERSION "${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}svn")
16
17 option(LLVM_INSTALL_TOOLCHAIN_ONLY "Only include toolchain files in the 'install' target." OFF)
1618
1719 option(LLVM_USE_FOLDERS "Enable solution folders in Visual Studio. Disable for Express versions." ON)
1820 if ( LLVM_USE_FOLDERS )
464466
465467 add_subdirectory(cmake/modules)
466468
467 install(DIRECTORY include/
468 DESTINATION include
469 FILES_MATCHING
470 PATTERN "*.def"
471 PATTERN "*.h"
472 PATTERN "*.td"
473 PATTERN "*.inc"
474 PATTERN "LICENSE.TXT"
475 PATTERN ".svn" EXCLUDE
476 )
477
478 install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/
479 DESTINATION include
480 FILES_MATCHING
481 PATTERN "*.def"
482 PATTERN "*.h"
483 PATTERN "*.gen"
484 PATTERN "*.inc"
485 # Exclude include/llvm/CMakeFiles/intrinsics_gen.dir, matched by "*.def"
486 PATTERN "CMakeFiles" EXCLUDE
487 PATTERN ".svn" EXCLUDE
488 )
469 if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
470 install(DIRECTORY include/
471 DESTINATION include
472 FILES_MATCHING
473 PATTERN "*.def"
474 PATTERN "*.h"
475 PATTERN "*.td"
476 PATTERN "*.inc"
477 PATTERN "LICENSE.TXT"
478 PATTERN ".svn" EXCLUDE
479 )
480
481 install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/
482 DESTINATION include
483 FILES_MATCHING
484 PATTERN "*.def"
485 PATTERN "*.h"
486 PATTERN "*.gen"
487 PATTERN "*.inc"
488 # Exclude include/llvm/CMakeFiles/intrinsics_gen.dir, matched by "*.def"
489 PATTERN "CMakeFiles" EXCLUDE
490 PATTERN ".svn" EXCLUDE
491 )
492 endif()
493
494 if( NOT WIN32 )
495 install(FILES include/llvm-c/lto.h DESTINATION include/llvm-c)
496 endif()
497
489498
490499 # TODO: make and install documentation.
491500
2525 if( EXCLUDE_FROM_ALL )
2626 set_target_properties( ${name} PROPERTIES EXCLUDE_FROM_ALL ON)
2727 else()
28 install(TARGETS ${name}
29 LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
30 ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX})
28 if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ${name} STREQUAL "LTO")
29 install(TARGETS ${name}
30 LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
31 ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX})
32 endif()
3133 endif()
3234 set_target_properties(${name} PROPERTIES FOLDER "Libraries")
3335
6971 if( EXCLUDE_FROM_ALL )
7072 set_target_properties( ${name} PROPERTIES EXCLUDE_FROM_ALL ON)
7173 else()
72 install(TARGETS ${name}
73 LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
74 ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX})
74 if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
75 install(TARGETS ${name}
76 LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
77 ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX})
78 endif()
7579 endif()
7680 endif()
7781
9599 endmacro(add_llvm_executable name)
96100
97101
102 set (LLVM_TOOLCHAIN_TOOLS
103 llvm-ar
104 llvm-objdump
105 )
106
98107 macro(add_llvm_tool name)
99108 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LLVM_TOOLS_BINARY_DIR})
100109 if( NOT LLVM_BUILD_TOOLS )
101110 set(EXCLUDE_FROM_ALL ON)
102111 endif()
103112 add_llvm_executable(${name} ${ARGN})
104 if( LLVM_BUILD_TOOLS )
105 install(TARGETS ${name} RUNTIME DESTINATION bin)
113
114 list(FIND LLVM_TOOLCHAIN_TOOLS ${name} LLVM_IS_${name}_TOOLCHAIN_TOOL)
115 if (LLVM_IS_${name}_TOOLCHAIN_TOOL GREATER -1 OR NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
116 if( LLVM_BUILD_TOOLS )
117 install(TARGETS ${name} RUNTIME DESTINATION bin)
118 endif()
106119 endif()
107120 set_target_properties(${name} PROPERTIES FOLDER "Tools")
108121 endmacro(add_llvm_tool name)
1818 ${llvm_cmake_builddir}/LLVMConfigVersion.cmake
1919 @ONLY)
2020
21 install(FILES
22 ${llvm_cmake_builddir}/LLVMConfig.cmake
23 ${llvm_cmake_builddir}/LLVMConfigVersion.cmake
24 LLVM-Config.cmake
25 DESTINATION share/llvm/cmake)
21 if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
22 install(FILES
23 ${llvm_cmake_builddir}/LLVMConfig.cmake
24 ${llvm_cmake_builddir}/LLVMConfigVersion.cmake
25 LLVM-Config.cmake
26 DESTINATION share/llvm/cmake)
2627
27 install(DIRECTORY .
28 DESTINATION share/llvm/cmake
29 FILES_MATCHING PATTERN *.cmake
30 PATTERN .svn EXCLUDE
31 PATTERN LLVMConfig.cmake EXCLUDE
32 PATTERN LLVMConfigVersion.cmake EXCLUDE
33 PATTERN LLVM-Config.cmake EXCLUDE
34 PATTERN GetHostTriple.cmake EXCLUDE
35 PATTERN VersionFromVCS.cmake EXCLUDE
36 PATTERN CheckAtomic.cmake EXCLUDE)
28 install(DIRECTORY .
29 DESTINATION share/llvm/cmake
30 FILES_MATCHING PATTERN *.cmake
31 PATTERN .svn EXCLUDE
32 PATTERN LLVMConfig.cmake EXCLUDE
33 PATTERN LLVMConfigVersion.cmake EXCLUDE
34 PATTERN LLVM-Config.cmake EXCLUDE
35 PATTERN GetHostTriple.cmake EXCLUDE
36 PATTERN VersionFromVCS.cmake EXCLUDE
37 PATTERN CheckAtomic.cmake EXCLUDE)
38 endif()