r252836 - [CMake] Setup an install component for libclang and c-index-test.

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 12 07:29:58 PST 2015


Is this target needed by IDEs? It currently adds the target to the
root level of the solution in MSVC.

~Aaron

On Wed, Nov 11, 2015 at 7:46 PM, Argyrios Kyrtzidis via cfe-commits
<cfe-commits at lists.llvm.org> wrote:
> Author: akirtzidis
> Date: Wed Nov 11 18:46:57 2015
> New Revision: 252836
>
> URL: http://llvm.org/viewvc/llvm-project?rev=252836&view=rev
> Log:
> [CMake] Setup an install component for libclang and c-index-test.
>
> Also don't create libclang dylib symlinks on darwin.
>
> Modified:
>     cfe/trunk/CMakeLists.txt
>     cfe/trunk/tools/c-index-test/CMakeLists.txt
>     cfe/trunk/tools/libclang/CMakeLists.txt
>
> Modified: cfe/trunk/CMakeLists.txt
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CMakeLists.txt?rev=252836&r1=252835&r2=252836&view=diff
> ==============================================================================
> --- cfe/trunk/CMakeLists.txt (original)
> +++ cfe/trunk/CMakeLists.txt Wed Nov 11 18:46:57 2015
> @@ -354,7 +354,7 @@ endmacro()
>
>  macro(add_clang_library name)
>    cmake_parse_arguments(ARG
> -    ""
> +    "SHARED"
>      ""
>      "ADDITIONAL_HEADERS"
>      ${ARGN})
> @@ -390,17 +390,29 @@ macro(add_clang_library name)
>        ${ARG_ADDITIONAL_HEADERS} # It may contain unparsed unknown args.
>        )
>    endif()
> -  llvm_add_library(${name} ${ARG_UNPARSED_ARGUMENTS} ${srcs})
> +  if(ARG_SHARED)
> +    set(ARG_ENABLE_SHARED SHARED)
> +  endif()
> +  llvm_add_library(${name} ${ARG_ENABLE_SHARED} ${ARG_UNPARSED_ARGUMENTS} ${srcs})
>
>    if(TARGET ${name})
>      target_link_libraries(${name} ${cmake_2_8_12_INTERFACE} ${LLVM_COMMON_LIBS})
>
>      if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ${name} STREQUAL "libclang")
>        install(TARGETS ${name}
> +        COMPONENT ${name}
>          EXPORT ClangTargets
>          LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
>          ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}
>          RUNTIME DESTINATION bin)
> +
> +      if (${ARG_SHARED} AND NOT CMAKE_CONFIGURATION_TYPES)
> +        add_custom_target(install-${name}
> +                          DEPENDS ${name}
> +                          COMMAND "${CMAKE_COMMAND}"
> +                                  -DCMAKE_INSTALL_COMPONENT=${name}
> +                                  -P "${CMAKE_BINARY_DIR}/cmake_install.cmake")
> +      endif()
>      endif()
>      set_property(GLOBAL APPEND PROPERTY CLANG_EXPORTS ${name})
>    else()
> @@ -451,6 +463,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
>  endif()
>
>  install(DIRECTORY include/clang-c
> +  COMPONENT libclang
>    DESTINATION include
>    FILES_MATCHING
>    PATTERN "*.h"
>
> Modified: cfe/trunk/tools/c-index-test/CMakeLists.txt
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/c-index-test/CMakeLists.txt?rev=252836&r1=252835&r2=252836&view=diff
> ==============================================================================
> --- cfe/trunk/tools/c-index-test/CMakeLists.txt (original)
> +++ cfe/trunk/tools/c-index-test/CMakeLists.txt Wed Nov 11 18:46:57 2015
> @@ -28,3 +28,12 @@ if (CLANG_HAVE_LIBXML)
>    include_directories(SYSTEM ${LIBXML2_INCLUDE_DIR})
>    target_link_libraries(c-index-test ${LIBXML2_LIBRARIES})
>  endif()
> +
> +install(TARGETS c-index-test
> +  RUNTIME DESTINATION local/bin
> +  COMPONENT c-index-test)
> +add_custom_target(install-c-index-test
> +  DEPENDS c-index-test
> +  COMMAND "${CMAKE_COMMAND}"
> +          -DCMAKE_INSTALL_COMPONENT=c-index-test
> +          -P "${CMAKE_BINARY_DIR}/cmake_install.cmake")
>
> Modified: cfe/trunk/tools/libclang/CMakeLists.txt
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CMakeLists.txt?rev=252836&r1=252835&r2=252836&view=diff
> ==============================================================================
> --- cfe/trunk/tools/libclang/CMakeLists.txt (original)
> +++ cfe/trunk/tools/libclang/CMakeLists.txt Wed Nov 11 18:46:57 2015
> @@ -102,18 +102,16 @@ if(ENABLE_SHARED)
>        PROPERTIES
>        VERSION ${LIBCLANG_LIBRARY_VERSION}
>        DEFINE_SYMBOL _CINDEX_LIB_)
> -  else()
> -    set_target_properties(libclang
> -      PROPERTIES
> -      VERSION ${LIBCLANG_LIBRARY_VERSION}
> -      DEFINE_SYMBOL _CINDEX_LIB_)
> -  endif()
> -
> -  if(APPLE)
> +  elseif(APPLE)
>      set(LIBCLANG_LINK_FLAGS " -Wl,-compatibility_version -Wl,1")
>      set(LIBCLANG_LINK_FLAGS "${LIBCLANG_LINK_FLAGS} -Wl,-current_version -Wl,${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}")
>
>      set_property(TARGET libclang APPEND_STRING PROPERTY
>                   LINK_FLAGS ${LIBCLANG_LINK_FLAGS})
> +  else()
> +    set_target_properties(libclang
> +      PROPERTIES
> +      VERSION ${LIBCLANG_LIBRARY_VERSION}
> +      DEFINE_SYMBOL _CINDEX_LIB_)
>    endif()
>  endif()
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


More information about the cfe-commits mailing list