1
0
mirror of https://github.com/libssh2/libssh2.git synced 2025-07-31 00:03:08 +03:00

cmake: add and test "unity" builds

"Unity" (aka "jumbo", aka "amalgamation" builds concatenate source files
before compiling. It has these benefits for example: faster builds,
improved code optimization, cleaner code. Let's support and test this.

- enable unity builds for some existing CI builds to test this build
  scenario.
- tune `UNITY_BUILD_BATCH_SIZE` size.
- disable unity build for example and test programs (they use one source
  each already).

You can enable it by passing `-DCMAKE_UNITY_BUILD=ON` to cmake.
Supported by CMake 3.16 and newer.

Ref: https://cmake.org/cmake/help/latest/prop_tgt/UNITY_BUILD.html

Closes #1034
This commit is contained in:
Viktor Szakats
2023-05-07 00:38:55 +00:00
parent cdd7fc009d
commit 7129ea9ca8
5 changed files with 26 additions and 16 deletions

View File

@ -48,6 +48,7 @@ foreach(example ${EXAMPLES})
# to find generated header
target_include_directories(${example} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/../src ../src)
target_link_libraries(${example} ${LIB_SELECTED} ${LIBRARIES})
set_target_properties(${example} PROPERTIES UNITY_BUILD false)
endforeach()
add_target_to_copy_dependencies(