Skip to content

Commit e25db17

Browse files
committed
cmake: Install libraries to DATADIR from GNUInstallDirs
This moves default installation location to /usr/share to match libclc.pc. Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> Reviewer: Tom Stellard llvm-svn: 350565
1 parent 81fe1fb commit e25db17

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

libclc/CMakeLists.txt

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
cmake_minimum_required( VERSION 3.9.2 )
22

33
project( libclc VERSION 0.2.0 LANGUAGES CXX )
4+
include( GNUInstallDirs )
45

56
# List of all targets
67
set( LIBCLC_TARGETS_ALL
@@ -145,16 +146,16 @@ endif()
145146

146147
# pkg-config file
147148
configure_file( libclc.pc.in libclc.pc @ONLY )
148-
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/libclc.pc DESTINATION share/pkgconfig )
149-
install( DIRECTORY generic/include/clc DESTINATION include )
149+
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/libclc.pc DESTINATION ${CMAKE_INSTALL_DATADIR}/pkgconfig )
150+
install( DIRECTORY generic/include/clc DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} )
150151

151152
if( ENABLE_RUNTIME_SUBNORMAL )
152153
add_library( subnormal_use_default STATIC
153154
generic/lib/subnormal_use_default.ll )
154155
add_library( subnormal_disable STATIC
155156
generic/lib/subnormal_disable.ll )
156157
install( TARGETS subnormal_use_default subnormal_disable ARCHIVE
157-
DESTINATION lib/clc )
158+
DESTINATION ${CMAKE_INSTALL_DATADIR}/clc )
158159
endif()
159160

160161
find_program( PYTHON python )
@@ -274,7 +275,7 @@ foreach( t ${LIBCLC_TARGETS_TO_BUILD} )
274275
prepare_builtins )
275276
add_custom_target( "prepare-${obj_suffix}" ALL
276277
DEPENDS "${obj_suffix}" )
277-
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${obj_suffix} DESTINATION lib/clc )
278+
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${obj_suffix} DESTINATION ${CMAKE_INSTALL_DATADIR}/clc )
278279
# nvptx-- targets don't include workitem builtins
279280
if( NOT ${t} MATCHES ".*ptx.*--$" )
280281
add_test( NAME external-calls-${obj_suffix}
@@ -292,7 +293,7 @@ foreach( t ${LIBCLC_TARGETS_TO_BUILD} )
292293
create_symlink ${obj_suffix}
293294
${alias_suffix}
294295
DEPENDS "prepare-${obj_suffix}" )
295-
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${alias_suffix} DESTINATION lib/clc )
296+
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${alias_suffix} DESTINATION ${CMAKE_INSTALL_DATADIR}/clc )
296297
endforeach( a )
297298
endforeach( d )
298299
endforeach( t )

libclc/libclc.pc.in

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
includedir=@CMAKE_INSTALL_PREFIX@/include
2-
libexecdir=@CMAKE_INSTALL_PREFIX@/lib/clc
1+
includedir=@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_INCLUDEDIR@
2+
libexecdir=@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_DATADIR@/clc
33

44
Name: libclc
55
Description: Library requirements of the OpenCL C programming language

0 commit comments

Comments
 (0)