From 6fd2db04d0f22ea22c5317d98ce2126aa64b6a73 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Sun, 4 Apr 2021 13:02:18 -0400 Subject: Use `GNUInstallDirs` to support custom installation dirs. -- LLVM This is a new draft of D28234. I previously did the unorthodox thing of pushing to it when I wasn't the original author, but since this version - Uses `GNUInstallDirs`, rather than mimics it, as the original author was hesitant to do but others requested. - Is much broader, effecting many more projects than LLVM itself. I figured it was time to make a new revision. I am using this patch (and many back-ports) as the basis of https://github.com/NixOS/nixpkgs/pull/111487 for my distro (NixOS). It looked like people were generally on board in D28234, but I make note of this here in case extra motivation is useful. --- As pointed out in the original issue, a central tension is that LLVM already has some partial support for these sorts of things. For example `LLVM_LIBDIR_SUFFIX`, or `COMPILER_RT_INSTALL_PATH`. Because it's not quite clear yet what to do about those, we are holding off on changing libdirs and `compiler-rt`. for this initial PR. --- On the advice of @lebedev.ri, I am splitting this up a bit per subproject, starting with LLVM. To allow it to be more easily reviewed. This and the subsequent patch must be landed together, as this will not build alone. But the rest can be landed on their own. Reviewed By: compnerd Differential Revision: https://reviews.llvm.org/D100810 --- libclc/CMakeLists.txt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'libclc') diff --git a/libclc/CMakeLists.txt b/libclc/CMakeLists.txt index ec39ea63f2d0..e90e0fd85201 100644 --- a/libclc/CMakeLists.txt +++ b/libclc/CMakeLists.txt @@ -183,8 +183,8 @@ endif() # pkg-config file configure_file( libclc.pc.in libclc.pc @ONLY ) -install( FILES ${CMAKE_CURRENT_BINARY_DIR}/libclc.pc DESTINATION ${CMAKE_INSTALL_DATADIR}/pkgconfig ) -install( DIRECTORY generic/include/clc DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ) +install( FILES ${CMAKE_CURRENT_BINARY_DIR}/libclc.pc DESTINATION "${CMAKE_INSTALL_DATADIR}/pkgconfig" ) +install( DIRECTORY generic/include/clc DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" ) if( ENABLE_RUNTIME_SUBNORMAL ) add_library( subnormal_use_default STATIC @@ -192,7 +192,7 @@ if( ENABLE_RUNTIME_SUBNORMAL ) add_library( subnormal_disable STATIC generic/lib/subnormal_disable.ll ) install( TARGETS subnormal_use_default subnormal_disable ARCHIVE - DESTINATION ${CMAKE_INSTALL_DATADIR}/clc ) + DESTINATION "${CMAKE_INSTALL_DATADIR}/clc" ) endif() find_package( Python3 REQUIRED COMPONENTS Interpreter ) @@ -343,7 +343,7 @@ foreach( t ${LIBCLC_TARGETS_TO_BUILD} ) add_custom_target( "prepare-${spv_suffix}" ALL DEPENDS "${spv_suffix}" ) install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${spv_suffix} - DESTINATION ${CMAKE_INSTALL_DATADIR}/clc ) + DESTINATION "${CMAKE_INSTALL_DATADIR}/clc" ) else() # Add prepare target @@ -366,7 +366,7 @@ foreach( t ${LIBCLC_TARGETS_TO_BUILD} ) PROPERTIES ENVIRONMENT "LLVM_CONFIG=${LLVM_CONFIG}" ) endif() - install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${obj_suffix} DESTINATION ${CMAKE_INSTALL_DATADIR}/clc ) + install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${obj_suffix} DESTINATION "${CMAKE_INSTALL_DATADIR}/clc" ) foreach( a ${${d}_aliases} ) set( alias_suffix "${a}-${t}.bc" ) add_custom_target( ${alias_suffix} ALL @@ -374,7 +374,7 @@ foreach( t ${LIBCLC_TARGETS_TO_BUILD} ) create_symlink ${obj_suffix} ${alias_suffix} DEPENDS "prepare-${obj_suffix}" ) - install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${alias_suffix} DESTINATION ${CMAKE_INSTALL_DATADIR}/clc ) + install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${alias_suffix} DESTINATION "${CMAKE_INSTALL_DATADIR}/clc" ) endforeach( a ) endif() endforeach( d ) -- cgit v1.2.1