Переглянути джерело

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.
Andrew Kaster 3 роки тому
батько
коміт
6e7cc40b18
3 змінених файлів з 12 додано та 8 видалено
  1. 6 4
      CMakeLists.txt
  2. 5 3
      Meta/Lagom/CMakeLists.txt
  3. 1 1
      Tests/LibMarkdown/CMakeLists.txt

+ 6 - 4
CMakeLists.txt

@@ -1,4 +1,7 @@
 cmake_minimum_required(VERSION 3.16)
 cmake_minimum_required(VERSION 3.16)
+
+list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/Meta/CMake")
+
 project(SerenityOS C CXX ASM)
 project(SerenityOS C CXX ASM)
 
 
 if(NOT "${CMAKE_BUILD_TYPE}" STREQUAL "")
 if(NOT "${CMAKE_BUILD_TYPE}" STREQUAL "")
@@ -141,7 +144,7 @@ if (ENABLE_ALL_DEBUG_FACILITIES)
 endif()
 endif()
 
 
 if (ENABLE_ALL_THE_DEBUG_MACROS)
 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)
 endif(ENABLE_ALL_THE_DEBUG_MACROS)
 
 
 configure_file(AK/Debug.h.in AK/Debug.h @ONLY)
 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")
     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined -fno-sanitize=vptr")
 endif()
 endif()
 
 
-include(Meta/CMake/wasm_spec_tests.cmake)
-
 add_custom_target(components ALL)
 add_custom_target(components ALL)
 option(BUILD_EVERYTHING "Build all optional components" ON)
 option(BUILD_EVERYTHING "Build all optional components" ON)
 
 
-include(Meta/CMake/utils.cmake)
+include(utils)
+include(wasm_spec_tests)
 
 
 serenity_component(
 serenity_component(
     Tests
     Tests

+ 5 - 3
Meta/Lagom/CMakeLists.txt

@@ -24,6 +24,8 @@ get_filename_component(
     ABSOLUTE CACHE
     ABSOLUTE CACHE
 )
 )
 
 
+list(APPEND CMAKE_MODULE_PATH "${SERENITY_PROJECT_ROOT}/Meta/CMake")
+
 find_package(Threads REQUIRED)
 find_package(Threads REQUIRED)
 
 
 if (ENABLE_LAGOM_CCACHE)
 if (ENABLE_LAGOM_CCACHE)
@@ -33,7 +35,7 @@ if (ENABLE_LAGOM_CCACHE)
     endif()
     endif()
 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(-Wno-unknown-warning-option -Wno-literal-suffix -Wno-deprecated-copy)
 add_compile_options(-O2)
 add_compile_options(-O2)
@@ -378,7 +380,7 @@ if (BUILD_LAGOM)
     # Unicode
     # Unicode
     # Don't include UnicodeData for Fuzzer builds, we didn't build the CodeGenerators
     # Don't include UnicodeData for Fuzzer builds, we didn't build the CodeGenerators
     if (NOT ENABLE_OSS_FUZZ AND NOT ENABLE_FUZZER_SANITIZER)
     if (NOT ENABLE_OSS_FUZZ AND NOT ENABLE_FUZZER_SANITIZER)
-        include(${SERENITY_PROJECT_ROOT}/Meta/CMake/unicode_data.cmake)
+        include(unicode_data)
     else()
     else()
         set(ENABLE_UNICODE_DATABASE_DOWNLOAD OFF)
         set(ENABLE_UNICODE_DATABASE_DOWNLOAD OFF)
     endif()
     endif()
@@ -519,7 +521,7 @@ if (BUILD_LAGOM)
         set_tests_properties(JS PROPERTIES ENVIRONMENT SERENITY_SOURCE_DIR=${SERENITY_PROJECT_ROOT})
         set_tests_properties(JS PROPERTIES ENVIRONMENT SERENITY_SOURCE_DIR=${SERENITY_PROJECT_ROOT})
 
 
         # Markdown
         # Markdown
-        include(${SERENITY_PROJECT_ROOT}/Meta/CMake/commonmark_spec.cmake)
+        include(commonmark_spec)
         file(GLOB LIBMARKDOWN_TEST_SOURCES CONFIGURE_DEPENDS "../../Tests/LibMarkdown/*.cpp")
         file(GLOB LIBMARKDOWN_TEST_SOURCES CONFIGURE_DEPENDS "../../Tests/LibMarkdown/*.cpp")
         foreach(source ${LIBMARKDOWN_TEST_SOURCES})
         foreach(source ${LIBMARKDOWN_TEST_SOURCES})
             lagom_test(${source} LIBS LagomMarkdown)
             lagom_test(${source} LIBS LagomMarkdown)

+ 1 - 1
Tests/LibMarkdown/CMakeLists.txt

@@ -1,4 +1,4 @@
-include(${SERENITY_PROJECT_ROOT}/Meta/CMake/commonmark_spec.cmake)
+include(commonmark_spec)
 
 
 set(TEST_SOURCES
 set(TEST_SOURCES
     TestCommonmark.cpp
     TestCommonmark.cpp