summaryrefslogtreecommitdiff
path: root/Meta/CMake
diff options
context:
space:
mode:
authorItamar <itamar8910@gmail.com>2022-03-19 17:15:08 +0200
committerAndreas Kling <kling@serenityos.org>2022-03-19 22:02:44 +0100
commitb6f358689cb3ece58e3cfef0ee7177b66405fe76 (patch)
tree6df58bc5c23b89082d6d38bb5b450bbce48b364e /Meta/CMake
parentfe7d28e8701258640b1d485394f4fff7b14099a1 (diff)
downloadserenity-b6f358689cb3ece58e3cfef0ee7177b66405fe76.zip
CMake: Modify include path when building from Hack Studio
With regular builds, the generated IPC headers exist inside the Build directory. The path Userland/Services under the build directory is added to the include path. For in-system builds the IPC headers are installed at /usr/include/. To support this, we add /usr/include/Userland/Services to the build path when building from Hack Studio. Co-Authored-By: Andrew Kaster <akaster@serenityos.org>
Diffstat (limited to 'Meta/CMake')
-rw-r--r--Meta/CMake/code_generators.cmake2
-rw-r--r--Meta/CMake/utils.cmake2
2 files changed, 4 insertions, 0 deletions
diff --git a/Meta/CMake/code_generators.cmake b/Meta/CMake/code_generators.cmake
index 21b293b881..0baf6fd117 100644
--- a/Meta/CMake/code_generators.cmake
+++ b/Meta/CMake/code_generators.cmake
@@ -33,6 +33,8 @@ 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)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${output} DESTINATION usr/include${current_source_dir_relative} OPTIONAL)
diff --git a/Meta/CMake/utils.cmake b/Meta/CMake/utils.cmake
index 6cddf3cb5a..452333e27b 100644
--- a/Meta/CMake/utils.cmake
+++ b/Meta/CMake/utils.cmake
@@ -11,6 +11,8 @@ 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)
file(GLOB_RECURSE sources RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.h" "*.cpp")