[CMake] If 'INTERNAL_INSTALL_PREFIX' is set, use it for determining the install destination of c-index-test and the libclang headers.

llvm-svn: 253001
This commit is contained in:
Argyrios Kyrtzidis 2015-11-13 01:46:18 +00:00
parent fa5558307b
commit 2cab8eec74
2 changed files with 31 additions and 8 deletions

View File

@ -462,14 +462,28 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
) )
endif() endif()
if(INTERNAL_INSTALL_PREFIX)
set(LIBCLANG_HEADERS_INSTALL_DESTINATION "${INTERNAL_INSTALL_PREFIX}/include")
else()
set(LIBCLANG_HEADERS_INSTALL_DESTINATION include)
endif()
install(DIRECTORY include/clang-c install(DIRECTORY include/clang-c
COMPONENT libclang COMPONENT libclang-headers
DESTINATION include DESTINATION "${LIBCLANG_HEADERS_INSTALL_DESTINATION}"
FILES_MATCHING FILES_MATCHING
PATTERN "*.h" PATTERN "*.h"
PATTERN ".svn" EXCLUDE PATTERN ".svn" EXCLUDE
) )
if (NOT CMAKE_CONFIGURATION_TYPES) # don't add this for IDE's.
add_custom_target(install-libclang-headers
DEPENDS
COMMAND "${CMAKE_COMMAND}"
-DCMAKE_INSTALL_COMPONENT=libclang-headers
-P "${CMAKE_BINARY_DIR}/cmake_install.cmake")
endif()
add_definitions( -D_GNU_SOURCE ) add_definitions( -D_GNU_SOURCE )
option(CLANG_ENABLE_ARCMT "Build ARCMT." ON) option(CLANG_ENABLE_ARCMT "Build ARCMT." ON)

View File

@ -29,11 +29,20 @@ if (CLANG_HAVE_LIBXML)
target_link_libraries(c-index-test ${LIBXML2_LIBRARIES}) target_link_libraries(c-index-test ${LIBXML2_LIBRARIES})
endif() endif()
if(INTERNAL_INSTALL_PREFIX)
set(INSTALL_DESTINATION "${INTERNAL_INSTALL_PREFIX}/bin")
else()
set(INSTALL_DESTINATION bin)
endif()
install(TARGETS c-index-test install(TARGETS c-index-test
RUNTIME DESTINATION bin RUNTIME DESTINATION "${INSTALL_DESTINATION}"
COMPONENT c-index-test) COMPONENT c-index-test)
add_custom_target(install-c-index-test
DEPENDS c-index-test if (NOT CMAKE_CONFIGURATION_TYPES) # don't add this for IDE's.
COMMAND "${CMAKE_COMMAND}" add_custom_target(install-c-index-test
-DCMAKE_INSTALL_COMPONENT=c-index-test DEPENDS c-index-test
-P "${CMAKE_BINARY_DIR}/cmake_install.cmake") COMMAND "${CMAKE_COMMAND}"
-DCMAKE_INSTALL_COMPONENT=c-index-test
-P "${CMAKE_BINARY_DIR}/cmake_install.cmake")
endif()