From: Orgad Shaneh Date: Sat, 15 Oct 2022 18:15:59 +0000 (+0300) Subject: build: Add headers to CMake project files (#1178) X-Git-Tag: v4.7~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=794685e6f97bc8e16523634409eddc5cabe9949a;p=thirdparty%2Fccache.git build: Add headers to CMake project files (#1178) Useful for listing them in the IDE project tree, for IDEs that use CMake file api (like Qt Creator). --- diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6a7cb3f79..7ae93c38f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -36,6 +36,9 @@ if(WIN32) list(APPEND source_files Win32Util.cpp) endif() +file(GLOB headers *.hpp) +list(APPEND source_files ${headers}) + add_library(ccache_framework STATIC ${source_files}) if(WIN32) diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 6932336f3..1fa9f7073 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -14,4 +14,7 @@ set( types.cpp ) +file(GLOB headers *.hpp) +list(APPEND sources ${headers}) + target_sources(ccache_framework PRIVATE ${sources}) diff --git a/src/storage/CMakeLists.txt b/src/storage/CMakeLists.txt index e5476cc39..907d16fdc 100644 --- a/src/storage/CMakeLists.txt +++ b/src/storage/CMakeLists.txt @@ -6,4 +6,7 @@ set( Storage.cpp ) +file(GLOB headers *.hpp) +list(APPEND sources ${headers}) + target_sources(ccache_framework PRIVATE ${sources}) diff --git a/src/storage/local/CMakeLists.txt b/src/storage/local/CMakeLists.txt index 88703781a..7b0d4f05a 100644 --- a/src/storage/local/CMakeLists.txt +++ b/src/storage/local/CMakeLists.txt @@ -9,4 +9,7 @@ set( util.cpp ) +file(GLOB headers *.hpp) +list(APPEND sources ${headers}) + target_sources(ccache_framework PRIVATE ${sources}) diff --git a/src/storage/remote/CMakeLists.txt b/src/storage/remote/CMakeLists.txt index 8d14eca18..96dbebb0b 100644 --- a/src/storage/remote/CMakeLists.txt +++ b/src/storage/remote/CMakeLists.txt @@ -9,4 +9,7 @@ if(REDIS_STORAGE_BACKEND) list(APPEND sources RedisStorage.cpp) endif() +file(GLOB headers *.hpp) +list(APPEND sources ${headers}) + target_sources(ccache_framework PRIVATE ${sources}) diff --git a/src/third_party/CMakeLists.txt b/src/third_party/CMakeLists.txt index fe43d594b..0d6ffb3e2 100644 --- a/src/third_party/CMakeLists.txt +++ b/src/third_party/CMakeLists.txt @@ -14,6 +14,9 @@ if(ENABLE_TRACING) target_sources(third_party PRIVATE minitrace.c) endif() +file(GLOB headers *.h fmt/*.h nonstd/*.hpp win32/*.h) +target_sources(third_party PRIVATE ${headers}) + set(xxhdispatchtest [=[ #include "xxh_x86dispatch.c" diff --git a/src/third_party/blake3/CMakeLists.txt b/src/third_party/blake3/CMakeLists.txt index 145837735..a30342d5d 100644 --- a/src/third_party/blake3/CMakeLists.txt +++ b/src/third_party/blake3/CMakeLists.txt @@ -115,3 +115,6 @@ if(CMAKE_SIZEOF_VOID_P EQUAL 8) target_compile_definitions(blake3 PRIVATE BLAKE3_USE_NEON) endif() endif() + +file(GLOB headers *.h) +target_sources(blake3 PRIVATE ${headers}) diff --git a/src/util/CMakeLists.txt b/src/util/CMakeLists.txt index f3133e715..560f79f91 100644 --- a/src/util/CMakeLists.txt +++ b/src/util/CMakeLists.txt @@ -11,4 +11,7 @@ set( zstd.cpp ) +file(GLOB headers *.hpp) +list(APPEND sources ${headers}) + target_sources(ccache_framework PRIVATE ${sources}) diff --git a/unittest/CMakeLists.txt b/unittest/CMakeLists.txt index fc54fe01a..e0ec8b325 100644 --- a/unittest/CMakeLists.txt +++ b/unittest/CMakeLists.txt @@ -42,6 +42,9 @@ if(WIN32) list(APPEND source_files test_bsdmkstemp.cpp test_Win32Util.cpp) endif() +file(GLOB headers *.hpp) +list(APPEND source_files ${headers}) + add_executable(unittest ${source_files}) if(MSVC)