Skip to content

Commit

Permalink
CMake: Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
alessandrogario authored and Smjert committed Aug 25, 2019
1 parent 5af3822 commit 09a56c1
Show file tree
Hide file tree
Showing 28 changed files with 242 additions and 95 deletions.
16 changes: 12 additions & 4 deletions libraries/cmake/source/augeas/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -124,17 +124,20 @@ function(augeasMain)
target_link_libraries(thirdparty_augeas PUBLIC
global_c_settings
thirdparty_libxml2
thirdparty_silence_warnings
thirdparty_selinux
)

target_include_directories(thirdparty_augeas SYSTEM PRIVATE
target_link_libraries(thirdparty_augeas PRIVATE
thirdparty_source_module_warnings
)

target_include_directories(thirdparty_augeas PRIVATE
"${CMAKE_CURRENT_SOURCE_DIR}/config"
"${CMAKE_CURRENT_BINARY_DIR}"
"${library_root}/src"
)

target_include_directories(thirdparty_augeas SYSTEM PUBLIC
target_include_directories(thirdparty_augeas SYSTEM INTERFACE
"${library_root}/src"
)

Expand All @@ -155,9 +158,14 @@ function(importSELinux)
target_include_directories(thirdparty_selinux PRIVATE
"${CMAKE_CURRENT_SOURCE_DIR}/config"
"${library_root}/lib"
"${CMAKE_CURRENT_SOURCE_DIR}/gnulib"
)

target_link_libraries(thirdparty_selinux PRIVATE
thirdparty_source_module_warnings
)

target_include_directories(thirdparty_selinux SYSTEM PUBLIC
target_include_directories(thirdparty_selinux SYSTEM INTERFACE
"${CMAKE_CURRENT_SOURCE_DIR}/gnulib"
)
endfunction()
Expand Down
9 changes: 7 additions & 2 deletions libraries/cmake/source/berkeley-db/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -284,15 +284,20 @@ function(berkeleydbMain)
target_link_libraries(thirdparty_berkeley-db PUBLIC
global_c_settings
thirdparty_sqlite
thirdparty_silence_warnings
)

target_link_libraries(thirdparty_berkeley-db PRIVATE
thirdparty_source_module_warnings
)

target_include_directories(thirdparty_berkeley-db PRIVATE
"${library_root}/lang/sql/adapter"
"${library_root}/lang/sql/generated"
"${CMAKE_CURRENT_SOURCE_DIR}/generated"
"${library_root}/src"
)

target_include_directories(thirdparty_berkeley-db SYSTEM PUBLIC
target_include_directories(thirdparty_berkeley-db SYSTEM INTERFACE
"${CMAKE_CURRENT_SOURCE_DIR}/generated"
"${library_root}/src"
)
Expand Down
12 changes: 9 additions & 3 deletions libraries/cmake/source/bzip2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,23 @@ function(bzip2Main)
"${library_root}/spewG.c"
)

# todo(alessandro): macOS and Windows support
target_compile_definitions(thirdparty_bzip2 PRIVATE
_FILE_OFFSET_BITS=64
)

target_link_libraries(thirdparty_bzip2 PUBLIC
global_c_settings
thirdparty_silence_warnings
)

target_include_directories(thirdparty_bzip2 SYSTEM PUBLIC
target_link_libraries(thirdparty_bzip2 PRIVATE
thirdparty_source_module_warnings
)

target_include_directories(thirdparty_bzip2 PRIVATE
"${library_root}"
)

target_include_directories(thirdparty_bzip2 SYSTEM INTERFACE
"${library_root}"
)
endfunction()
Expand Down
20 changes: 13 additions & 7 deletions libraries/cmake/source/libarchive/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ function(libarchiveMain)
"${library_root}/libarchive_fe/passphrase.c"
)

# todo(alessandro): macOS and Windows support
target_compile_definitions(thirdparty_libarchive PRIVATE
HAVE_CONFIG_H
archive_EXPORTS
Expand Down Expand Up @@ -159,14 +158,21 @@ function(libarchiveMain)
thirdparty_bzip2
thirdparty_lzma
thirdparty_libxml2
thirdparty_silence_warnings
)

target_include_directories(thirdparty_libarchive SYSTEM
PUBLIC "${library_root}/libarchive"
PRIVATE "${library_root}/src"
"${CMAKE_CURRENT_SOURCE_DIR}/config"
"${library_root}/libarchive_fe"
target_link_libraries(thirdparty_libarchive PRIVATE
thirdparty_source_module_warnings
)

target_include_directories(thirdparty_libarchive PRIVATE
"${library_root}/src"
"${CMAKE_CURRENT_SOURCE_DIR}/config"
"${library_root}/libarchive_fe"
"${library_root}/libarchive"
)

target_include_directories(thirdparty_libarchive SYSTEM INTERFACE
"${library_root}/libarchive"
)
endfunction()

Expand Down
10 changes: 7 additions & 3 deletions libraries/cmake/source/libaudit/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,21 @@ function(libauditMain)

target_link_libraries(thirdparty_libaudit PUBLIC
global_c_settings
thirdparty_silence_warnings
)

target_include_directories(thirdparty_libaudit SYSTEM PRIVATE
target_link_libraries(thirdparty_libaudit PRIVATE
thirdparty_source_module_warnings
)

target_include_directories(thirdparty_libaudit PRIVATE
"${CMAKE_CURRENT_SOURCE_DIR}/config"
"${CMAKE_CURRENT_SOURCE_DIR}/generated"
"${library_root}"
"${library_root}/auparse"
"${library_root}/lib"
)

target_include_directories(thirdparty_libaudit SYSTEM PUBLIC
target_include_directories(thirdparty_libaudit SYSTEM INTERFACE
"${library_root}/lib"
)
endfunction()
Expand Down
12 changes: 8 additions & 4 deletions libraries/cmake/source/libdpkg/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,10 @@ function(libdpkgMain)
thirdparty_lzma
thirdparty_zlib
thirdparty_bzip2
thirdparty_silence_warnings
)

target_link_libraries(thirdparty_libdpkg PRIVATE
thirdparty_source_module_warnings
)

target_compile_definitions(thirdparty_libdpkg PRIVATE
Expand All @@ -145,13 +148,14 @@ function(libdpkgMain)
SYSCONFDIR="/usr/local/etc"
)

target_include_directories(thirdparty_libdpkg SYSTEM PRIVATE
target_include_directories(thirdparty_libdpkg PRIVATE
"${CMAKE_CURRENT_SOURCE_DIR}/config"
"${library_root}/lib/compat"
"${library_root}"
"${library_root}/lib"
)

target_include_directories(thirdparty_libdpkg SYSTEM PUBLIC
"${library_root}"
target_include_directories(thirdparty_libdpkg SYSTEM INTERFACE
"${library_root}/lib"
)
endfunction()
Expand Down
14 changes: 8 additions & 6 deletions libraries/cmake/source/libelfin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function(libelfinElf)
)

target_link_libraries(thirdparty_libelfin_elf PRIVATE
thirdparty_silence_warnings
thirdparty_source_module_warnings
)

# The original package built for Buck was built installing
Expand All @@ -51,11 +51,12 @@ function(libelfinElf)
)
endforeach()

target_include_directories(thirdparty_libelfin_elf SYSTEM PRIVATE
target_include_directories(thirdparty_libelfin_elf PRIVATE
"${CMAKE_CURRENT_BINARY_DIR}"
"${library_root}"
)

target_include_directories(thirdparty_libelfin_elf SYSTEM PUBLIC
target_include_directories(thirdparty_libelfin_elf SYSTEM INTERFACE
"${CMAKE_CURRENT_BINARY_DIR}"
)
endfunction()
Expand Down Expand Up @@ -84,7 +85,7 @@ function(libelfinDwarf)
)

target_link_libraries(thirdparty_libelfin_dwarf PRIVATE
thirdparty_silence_warnings
thirdparty_source_module_warnings
)

# The original package built for Buck was built installing
Expand All @@ -105,11 +106,12 @@ function(libelfinDwarf)
)
endforeach()

target_include_directories(thirdparty_libelfin_dwarf SYSTEM PRIVATE
target_include_directories(thirdparty_libelfin_dwarf PRIVATE
"${CMAKE_CURRENT_BINARY_DIR}"
"${library_root}"
)

target_include_directories(thirdparty_libelfin_dwarf SYSTEM PUBLIC
target_include_directories(thirdparty_libelfin_dwarf SYSTEM INTERFACE
"${CMAKE_CURRENT_BINARY_DIR}"
)
endfunction()
Expand Down
10 changes: 6 additions & 4 deletions libraries/cmake/source/libgcrypt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -200,20 +200,22 @@ function(libgcryptMain)
)

target_link_libraries(thirdparty_libgcrypt PRIVATE
thirdparty_silence_warnings
thirdparty_source_module_warnings
)

target_include_directories(thirdparty_libgcrypt SYSTEM PRIVATE
target_include_directories(thirdparty_libgcrypt PRIVATE
"${CMAKE_CURRENT_SOURCE_DIR}/config"

"${library_root}/src"
"${library_root}/mpi"
"${library_root}/cipher"
)

target_include_directories(thirdparty_libgcrypt SYSTEM PUBLIC
"${CMAKE_CURRENT_SOURCE_DIR}/generated/src"
"${CMAKE_CURRENT_SOURCE_DIR}/generated/mpi"
"${CMAKE_CURRENT_SOURCE_DIR}/generated/cipher"
)

target_include_directories(thirdparty_libgcrypt SYSTEM INTERFACE
"${library_root}/src"
)
endfunction()
Expand Down
9 changes: 5 additions & 4 deletions libraries/cmake/source/libgpg-error/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,17 @@ function(libgpgerrorMain)
)

target_link_libraries(thirdparty_libgpg-error PRIVATE
thirdparty_silence_warnings
thirdparty_source_module_warnings
)

target_include_directories(thirdparty_libgpg-error SYSTEM PRIVATE
target_include_directories(thirdparty_libgpg-error PRIVATE
"${CMAKE_CURRENT_SOURCE_DIR}/config"
"${CMAKE_CURRENT_SOURCE_DIR}/generated"
"${library_root}"
)

target_include_directories(thirdparty_libgpg-error SYSTEM PUBLIC
target_include_directories(thirdparty_libgpg-error SYSTEM INTERFACE
"${CMAKE_CURRENT_SOURCE_DIR}/generated"
"${library_root}"
)
endfunction()

Expand Down
17 changes: 12 additions & 5 deletions libraries/cmake/source/libmagic/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ function(libmagicMain)
"${library_root}/src/ascmagic.c"
)

# todo(alessandro): macOS and Windows support
target_compile_definitions(thirdparty_libmagic PRIVATE
HAVE_CONFIG_H
MAGIC='"/usr/local/share/misc/magic"'
Expand All @@ -53,12 +52,20 @@ function(libmagicMain)
target_link_libraries(thirdparty_libmagic PUBLIC
global_c_settings
thirdparty_zlib
thirdparty_silence_warnings
)

target_include_directories(thirdparty_libmagic SYSTEM
PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include"
PRIVATE "${library_root}/src" "${CMAKE_CURRENT_SOURCE_DIR}/include" "${CMAKE_CURRENT_SOURCE_DIR}/config"
target_link_libraries(thirdparty_libmagic PRIVATE
thirdparty_source_module_warnings
)

target_include_directories(thirdparty_libmagic PRIVATE
"${library_root}/src"
"${CMAKE_CURRENT_SOURCE_DIR}/include"
"${CMAKE_CURRENT_SOURCE_DIR}/config"
)

target_include_directories(thirdparty_libmagic SYSTEM INTERFACE
"${CMAKE_CURRENT_SOURCE_DIR}/include"
)
endfunction()

Expand Down
10 changes: 6 additions & 4 deletions libraries/cmake/source/librpm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -138,15 +138,17 @@ function(librpmMain)
)

target_link_libraries(thirdparty_librpm PRIVATE
thirdparty_silence_warnings
thirdparty_source_module_warnings
)

target_include_directories(thirdparty_librpm SYSTEM PRIVATE
target_include_directories(thirdparty_librpm PRIVATE
"${library_root}"
"${CMAKE_CURRENT_SOURCE_DIR}/generated"
"${CMAKE_CURRENT_SOURCE_DIR}/config"
"${CMAKE_CURRENT_SOURCE_DIR}/include"
)

target_include_directories(thirdparty_librpm SYSTEM PUBLIC
"${library_root}"
target_include_directories(thirdparty_librpm SYSTEM INTERFACE
"${CMAKE_CURRENT_SOURCE_DIR}/generated"
"${CMAKE_CURRENT_SOURCE_DIR}/include"
)
Expand Down
8 changes: 6 additions & 2 deletions libraries/cmake/source/libudev/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,18 @@ function(libudevMain)

target_link_libraries(thirdparty_libudev PUBLIC
global_c_settings
thirdparty_silence_warnings
)

target_link_libraries(thirdparty_libudev PRIVATE
thirdparty_source_module_warnings
)

target_include_directories(thirdparty_libudev PRIVATE
"${CMAKE_CURRENT_SOURCE_DIR}/config"
"${library_root}/libudev"
)

target_include_directories(thirdparty_libudev SYSTEM PUBLIC
target_include_directories(thirdparty_libudev SYSTEM INTERFACE
"${library_root}/libudev"
)
endfunction()
Expand Down
12 changes: 8 additions & 4 deletions libraries/cmake/source/libxml2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ function(libxml2Main)
"${library_root}/xzlib.c"
)

# todo(alessandro): macOS and Windows support
target_compile_definitions(thirdparty_libxml2 PRIVATE
HAVE_CONFIG_H
_REENTRANT
Expand All @@ -65,17 +64,22 @@ function(libxml2Main)
global_c_settings
thirdparty_lzma
thirdparty_zlib
thirdparty_silence_warnings
)

target_link_libraries(thirdparty_libxml2 PRIVATE
thirdparty_source_module_warnings
)

target_include_directories(thirdparty_libxml2 PRIVATE
"${library_root}"
"${CMAKE_CURRENT_SOURCE_DIR}/config"
"${CMAKE_CURRENT_SOURCE_DIR}/version"
"${library_root}/include"
)

target_include_directories(thirdparty_libxml2 SYSTEM PUBLIC
"${library_root}/include"
target_include_directories(thirdparty_libxml2 SYSTEM INTERFACE
"${CMAKE_CURRENT_SOURCE_DIR}/version"
"${library_root}/include"
)
endfunction()

Expand Down
Loading

0 comments on commit 09a56c1

Please sign in to comment.