1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 12:28:12 +00:00

Meta: Use CMAKE_INSTALL_FOODIR variables instead of hardcoding usr/foo

In preparation for future refactoring of Lagom, let's use the variables
from GNUInstallDirs as much as possible for the helper macros and other
scripts used by the main build already.
This commit is contained in:
Andrew Kaster 2022-07-04 11:01:05 -06:00 committed by Andreas Kling
parent 2b82c83ceb
commit 02e8f29560
3 changed files with 12 additions and 10 deletions

View file

@ -6,7 +6,7 @@ function(serenity_install_headers target_name)
file(GLOB_RECURSE headers RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.h")
foreach(header ${headers})
get_filename_component(subdirectory ${header} DIRECTORY)
install(FILES ${header} DESTINATION usr/include/${target_name}/${subdirectory} OPTIONAL)
install(FILES ${header} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${target_name}/${subdirectory}" OPTIONAL)
endforeach()
endfunction()
@ -39,7 +39,7 @@ function(serenity_lib target_name fs_name)
add_library(${target_name} SHARED ${SOURCES} ${GENERATED_SOURCES})
set_target_properties(${target_name} PROPERTIES EXCLUDE_FROM_ALL TRUE)
set_target_properties(${target_name} PROPERTIES VERSION "serenity")
install(TARGETS ${target_name} DESTINATION usr/lib OPTIONAL)
install(TARGETS ${target_name} DESTINATION ${CMAKE_INSTALL_LIBDIR} OPTIONAL)
set_target_properties(${target_name} PROPERTIES OUTPUT_NAME ${fs_name})
serenity_generated_sources(${target_name})
endfunction()
@ -50,7 +50,7 @@ function(serenity_lib_static target_name fs_name)
add_library(${target_name} STATIC ${SOURCES} ${GENERATED_SOURCES})
set_target_properties(${target_name} PROPERTIES EXCLUDE_FROM_ALL TRUE)
set_target_properties(${target_name} PROPERTIES VERSION "serenity")
install(TARGETS ${target_name} DESTINATION usr/lib OPTIONAL)
install(TARGETS ${target_name} DESTINATION ${CMAKE_INSTALL_LIBDIR} OPTIONAL)
set_target_properties(${target_name} PROPERTIES OUTPUT_NAME ${fs_name})
serenity_generated_sources(${target_name})
endfunction()
@ -60,7 +60,7 @@ function(serenity_libc target_name fs_name)
serenity_install_sources()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -nostdlib -fpic")
add_library(${target_name} SHARED ${SOURCES})
install(TARGETS ${target_name} DESTINATION usr/lib)
install(TARGETS ${target_name} DESTINATION ${CMAKE_INSTALL_LIBDIR})
set_target_properties(${target_name} PROPERTIES OUTPUT_NAME ${fs_name})
# Avoid creating a dependency cycle between system libraries and the C++ standard library. This is necessary
# to ensure that initialization functions will be called in the right order (libc++ must come after LibPthread).