diff --git a/libclc/CMakeLists.txt b/libclc/CMakeLists.txt index 088edc06d23d..9a81f2658fe3 100644 --- a/libclc/CMakeLists.txt +++ b/libclc/CMakeLists.txt @@ -77,6 +77,7 @@ if( LIBCLC_STANDALONE_BUILD OR CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DI # Setup the paths where libclc runtimes should be stored. set( LIBCLC_OUTPUT_LIBRARY_DIR ${CMAKE_CURRENT_BINARY_DIR} ) + set( LIBCLC_INSTALL_DIR ${CMAKE_INSTALL_DATADIR}/clc ) else() # In-tree configuration set( LIBCLC_STANDALONE_BUILD FALSE ) @@ -100,10 +101,12 @@ else() # Setup the paths where libclc runtimes should be stored. By default, in an # in-tree build we place the libraries in clang's resource driectory. include(GetClangResourceDir) - get_clang_resource_dir( LIBCLC_OUTPUT_DIR PREFIX ${LLVM_LIBRARY_OUTPUT_INTDIR}/.. ) + get_clang_resource_dir( LIBCLC_INSTALL_DIR ) + cmake_path( APPEND LIBCLC_INSTALL_DIR "lib" "libclc" ) # Note we do not adhere to LLVM_ENABLE_PER_TARGET_RUNTIME_DIR. - set( LIBCLC_OUTPUT_LIBRARY_DIR ${LIBCLC_OUTPUT_DIR}/lib/libclc ) + cmake_path( GET LLVM_LIBRARY_OUTPUT_INTDIR PARENT_PATH LIBCLC_OUTPUT_LIBRARY_DIR ) + cmake_path( APPEND LIBCLC_OUTPUT_LIBRARY_DIR ${LIBCLC_INSTALL_DIR} ) file( MAKE_DIRECTORY ${LIBCLC_OUTPUT_LIBRARY_DIR} ) endif() diff --git a/libclc/cmake/modules/AddLibclc.cmake b/libclc/cmake/modules/AddLibclc.cmake index 614f9e3790a3..d8c22191678d 100644 --- a/libclc/cmake/modules/AddLibclc.cmake +++ b/libclc/cmake/modules/AddLibclc.cmake @@ -261,7 +261,7 @@ function(libclc_install) install( FILES ${files} - DESTINATION "${CMAKE_INSTALL_DATADIR}/clc" + DESTINATION ${LIBCLC_INSTALL_DIR} ) endfunction()