CMake: Resolve FIXMEs related to CMake < 3.20

We already have required this version for quite a while for Lagom,
Ladybird and Serenity. Now that we require it in all of our CMakeLists,
let's scrub for better ways of writing things.
This commit is contained in:
Andrew Kaster 2024-04-25 11:30:44 -06:00 committed by Andrew Kaster
commit 37a0466285
Notes: sideshowbarker 2024-07-17 05:02:35 +09:00
3 changed files with 4 additions and 13 deletions

View file

@ -29,10 +29,7 @@ function(serenity_install_headers target_name)
endfunction()
function(serenity_install_sources)
# TODO: Use cmake_path() when we upgrade the minimum CMake version to 3.20
# https://cmake.org/cmake/help/v3.23/command/cmake_path.html#relative-path
string(LENGTH ${SerenityOS_SOURCE_DIR} root_source_dir_length)
string(SUBSTRING ${CMAKE_CURRENT_SOURCE_DIR} ${root_source_dir_length} -1 current_source_dir_relative)
cmake_path(RELATIVE_PATH CMAKE_CURRENT_SOURCE_DIR BASE_DIRECTORY ${SerenityOS_SOURCE_DIR} OUTPUT_VARIABLE current_source_dir_relative)
file(GLOB_RECURSE sources RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.h" "*.cpp" "*.gml")
foreach(source ${sources})
get_filename_component(subdirectory ${source} DIRECTORY)