mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-02 14:19:48 +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: 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()
|
endif()
|
||||||
|
|
||||||
# Lagom
|
# Lagom
|
||||||
# FIXME: PROJECT_IS_TOP_LEVEL with CMake 3.21+
|
|
||||||
set(LADYBIRD_IS_TOP_LEVEL FALSE)
|
|
||||||
set(LADYBIRD_CUSTOM_TARGET_SUFFIX "-ladybird")
|
set(LADYBIRD_CUSTOM_TARGET_SUFFIX "-ladybird")
|
||||||
if ("${CMAKE_BINARY_DIR}" STREQUAL "${PROJECT_BINARY_DIR}")
|
if (PROJECT_IS_TOP_LEVEL)
|
||||||
set(LADYBIRD_IS_TOP_LEVEL TRUE)
|
|
||||||
set(LADYBIRD_CUSTOM_TARGET_SUFFIX "")
|
set(LADYBIRD_CUSTOM_TARGET_SUFFIX "")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (LADYBIRD_IS_TOP_LEVEL)
|
if (PROJECT_IS_TOP_LEVEL)
|
||||||
get_filename_component(
|
get_filename_component(
|
||||||
SERENITY_SOURCE_DIR "${ladybird_SOURCE_DIR}/.."
|
SERENITY_SOURCE_DIR "${ladybird_SOURCE_DIR}/.."
|
||||||
ABSOLUTE
|
ABSOLUTE
|
||||||
|
|
|
@ -62,10 +62,7 @@ function(compile_ipc source output)
|
||||||
add_custom_target(generate_${output_name} DEPENDS ${output})
|
add_custom_target(generate_${output_name} DEPENDS ${output})
|
||||||
add_dependencies(all_generated generate_${output_name})
|
add_dependencies(all_generated generate_${output_name})
|
||||||
|
|
||||||
# TODO: Use cmake_path() when we upgrade the minimum CMake version to 3.20
|
cmake_path(RELATIVE_PATH CMAKE_CURRENT_SOURCE_DIR BASE_DIRECTORY ${SerenityOS_SOURCE_DIR} OUTPUT_VARIABLE current_source_dir_relative)
|
||||||
# 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)
|
|
||||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${output} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${current_source_dir_relative}" OPTIONAL)
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${output} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${current_source_dir_relative}" OPTIONAL)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
|
|
@ -29,10 +29,7 @@ function(serenity_install_headers target_name)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
function(serenity_install_sources)
|
function(serenity_install_sources)
|
||||||
# TODO: Use cmake_path() when we upgrade the minimum CMake version to 3.20
|
cmake_path(RELATIVE_PATH CMAKE_CURRENT_SOURCE_DIR BASE_DIRECTORY ${SerenityOS_SOURCE_DIR} OUTPUT_VARIABLE current_source_dir_relative)
|
||||||
# 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)
|
|
||||||
file(GLOB_RECURSE sources RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.h" "*.cpp" "*.gml")
|
file(GLOB_RECURSE sources RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.h" "*.cpp" "*.gml")
|
||||||
foreach(source ${sources})
|
foreach(source ${sources})
|
||||||
get_filename_component(subdirectory ${source} DIRECTORY)
|
get_filename_component(subdirectory ${source} DIRECTORY)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue