AK: Make the AK library's CMake a bit more standard

We no longer have multiple locations including AK (e.g. LibC). So let's
avoid awkwardly defining the AK library across multiple CMake files.

This is to allow more easily adding third-party dependencies to AK in
the future.
This commit is contained in:
Timothy Flynn 2024-07-15 13:24:18 -04:00 committed by Andreas Kling
parent e797ea816b
commit 58dfe5424f
Notes: sideshowbarker 2024-07-17 07:38:17 +09:00
2 changed files with 16 additions and 17 deletions

View file

@ -1,4 +1,4 @@
set(AK_SOURCES
set(SOURCES
Assertions.cpp
Base64.cpp
CircularBuffer.cpp
@ -37,10 +37,22 @@ set(AK_SOURCES
Utf8View.cpp
kmalloc.cpp
)
# AK sources are included from many different places
list(TRANSFORM AK_SOURCES PREPEND "${CMAKE_CURRENT_SOURCE_DIR}/")
set(AK_SOURCES ${AK_SOURCES} PARENT_SCOPE)
serenity_lib(AK ak)
serenity_install_headers(AK)
serenity_install_sources(AK)
find_package(Backtrace)
configure_file(Backtrace.h.in Backtrace.h @ONLY)
if (Backtrace_FOUND)
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.30)
target_link_libraries(AK PRIVATE Backtrace::Backtrace)
else()
target_include_directories(AK PRIVATE ${Backtrace_INCLUDE_DIRS})
target_link_libraries(AK PRIVATE ${Backtrace_LIBRARIES})
endif()
else()
message(WARNING "Backtrace not found, stack traces will be unavailable")
endif()

View file

@ -327,19 +327,6 @@ install(TARGETS LibC LibCrypt NoCoverage EXPORT LagomTargets)
# AK
add_serenity_subdirectory(AK)
lagom_lib(AK ak SOURCES ${AK_SOURCES})
find_package(Backtrace)
configure_file(../../AK/Backtrace.h.in AK/Backtrace.h @ONLY)
if (Backtrace_FOUND)
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.30)
target_link_libraries(AK PRIVATE Backtrace::Backtrace)
else()
target_include_directories(AK PRIVATE ${Backtrace_INCLUDE_DIRS})
target_link_libraries(AK PRIVATE ${Backtrace_LIBRARIES})
endif()
else()
message(WARNING "Backtrace not found, stack traces will be unavailable")
endif()
# LibCoreMinimal
add_serenity_subdirectory(Userland/Libraries/LibCore)