mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-21 20:15:17 +00:00
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:
parent
65bfd2ca2d
commit
37a0466285
Notes:
sideshowbarker
2024-07-17 05:02:35 +09:00
Author: https://github.com/ADKaster Commit: https://github.com/SerenityOS/serenity/commit/37a0466285 Pull-request: https://github.com/SerenityOS/serenity/pull/24112 Reviewed-by: https://github.com/trflynn89
3 changed files with 4 additions and 13 deletions
|
@ -55,15 +55,12 @@ if (HAIKU)
|
|||
endif()
|
||||
|
||||
# Lagom
|
||||
# FIXME: PROJECT_IS_TOP_LEVEL with CMake 3.21+
|
||||
set(LADYBIRD_IS_TOP_LEVEL FALSE)
|
||||
set(LADYBIRD_CUSTOM_TARGET_SUFFIX "-ladybird")
|
||||
if ("${CMAKE_BINARY_DIR}" STREQUAL "${PROJECT_BINARY_DIR}")
|
||||
set(LADYBIRD_IS_TOP_LEVEL TRUE)
|
||||
if (PROJECT_IS_TOP_LEVEL)
|
||||
set(LADYBIRD_CUSTOM_TARGET_SUFFIX "")
|
||||
endif()
|
||||
|
||||
if (LADYBIRD_IS_TOP_LEVEL)
|
||||
if (PROJECT_IS_TOP_LEVEL)
|
||||
get_filename_component(
|
||||
SERENITY_SOURCE_DIR "${ladybird_SOURCE_DIR}/.."
|
||||
ABSOLUTE
|
||||
|
|
|
@ -62,10 +62,7 @@ function(compile_ipc source output)
|
|||
add_custom_target(generate_${output_name} DEPENDS ${output})
|
||||
add_dependencies(all_generated generate_${output_name})
|
||||
|
||||
# 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)
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${output} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${current_source_dir_relative}" OPTIONAL)
|
||||
endfunction()
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue