From 6e7cc40b18dae594a9b0344a8dda692fa4d81343 Mon Sep 17 00:00:00 2001 From: Andrew Kaster Date: Tue, 7 Sep 2021 01:50:09 -0600 Subject: [PATCH] Meta: Add Meta/CMake to the CMAKE_MODULE_PATH for Serenity and Lagom This makes it so we don't need to specify the full path to all the helper scripts we include() from different places in the codebase and feels a lot cleaner. --- CMakeLists.txt | 10 ++++++---- Meta/Lagom/CMakeLists.txt | 8 +++++--- Tests/LibMarkdown/CMakeLists.txt | 2 +- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2ba11089bf6..b9c503172d1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,7 @@ cmake_minimum_required(VERSION 3.16) + +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/Meta/CMake") + project(SerenityOS C CXX ASM) if(NOT "${CMAKE_BUILD_TYPE}" STREQUAL "") @@ -141,7 +144,7 @@ if (ENABLE_ALL_DEBUG_FACILITIES) endif() if (ENABLE_ALL_THE_DEBUG_MACROS) - include("${SerenityOS_SOURCE_DIR}/Meta/CMake/all_the_debug_macros.cmake") + include(all_the_debug_macros) endif(ENABLE_ALL_THE_DEBUG_MACROS) configure_file(AK/Debug.h.in AK/Debug.h @ONLY) @@ -335,12 +338,11 @@ if (ENABLE_UNDEFINED_SANITIZER) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined -fno-sanitize=vptr") endif() -include(Meta/CMake/wasm_spec_tests.cmake) - add_custom_target(components ALL) option(BUILD_EVERYTHING "Build all optional components" ON) -include(Meta/CMake/utils.cmake) +include(utils) +include(wasm_spec_tests) serenity_component( Tests diff --git a/Meta/Lagom/CMakeLists.txt b/Meta/Lagom/CMakeLists.txt index 39cbdd17f91..f35a5d908c5 100644 --- a/Meta/Lagom/CMakeLists.txt +++ b/Meta/Lagom/CMakeLists.txt @@ -24,6 +24,8 @@ get_filename_component( ABSOLUTE CACHE ) +list(APPEND CMAKE_MODULE_PATH "${SERENITY_PROJECT_ROOT}/Meta/CMake") + find_package(Threads REQUIRED) if (ENABLE_LAGOM_CCACHE) @@ -33,7 +35,7 @@ if (ENABLE_LAGOM_CCACHE) endif() endif() -include(${SERENITY_PROJECT_ROOT}/Meta/CMake/wasm_spec_tests.cmake) +include(wasm_spec_tests) add_compile_options(-Wno-unknown-warning-option -Wno-literal-suffix -Wno-deprecated-copy) add_compile_options(-O2) @@ -378,7 +380,7 @@ if (BUILD_LAGOM) # Unicode # Don't include UnicodeData for Fuzzer builds, we didn't build the CodeGenerators if (NOT ENABLE_OSS_FUZZ AND NOT ENABLE_FUZZER_SANITIZER) - include(${SERENITY_PROJECT_ROOT}/Meta/CMake/unicode_data.cmake) + include(unicode_data) else() set(ENABLE_UNICODE_DATABASE_DOWNLOAD OFF) endif() @@ -519,7 +521,7 @@ if (BUILD_LAGOM) set_tests_properties(JS PROPERTIES ENVIRONMENT SERENITY_SOURCE_DIR=${SERENITY_PROJECT_ROOT}) # Markdown - include(${SERENITY_PROJECT_ROOT}/Meta/CMake/commonmark_spec.cmake) + include(commonmark_spec) file(GLOB LIBMARKDOWN_TEST_SOURCES CONFIGURE_DEPENDS "../../Tests/LibMarkdown/*.cpp") foreach(source ${LIBMARKDOWN_TEST_SOURCES}) lagom_test(${source} LIBS LagomMarkdown) diff --git a/Tests/LibMarkdown/CMakeLists.txt b/Tests/LibMarkdown/CMakeLists.txt index b69c3013b17..ec58449842a 100644 --- a/Tests/LibMarkdown/CMakeLists.txt +++ b/Tests/LibMarkdown/CMakeLists.txt @@ -1,4 +1,4 @@ -include(${SERENITY_PROJECT_ROOT}/Meta/CMake/commonmark_spec.cmake) +include(commonmark_spec) set(TEST_SOURCES TestCommonmark.cpp