diff options
author | Julian Andres Klode <jak@debian.org> | 2017-10-23 03:29:10 +0200 |
---|---|---|
committer | Julian Andres Klode <jak@debian.org> | 2017-10-23 04:19:19 +0200 |
commit | 43b9eb5bac15666fdc0346aca7031fab0fa5e064 (patch) | |
tree | 4e40fe1a78569bceb4dc0fed677188e902244b86 | |
parent | 669b310a6676f2247165e492b673d2e5bcb06f89 (diff) | |
download | apt-43b9eb5bac15666fdc0346aca7031fab0fa5e064.tar.gz |
CMake: methods: Cleanup link libraries, use OBJECT libraries
Use OBJECT libraries for http and connect stuff, and move the
seccomp link expression into a global link_libraries() call.
This also fixes a bug where only the http target pulled in
the gnutls header arguments despite gnutls being used in
connect.cc, and thus by mirror and ftp as well.
Adjust translation support to ignore TARGET_OBJECTS sources
and add the OBJECT libraries to the translated files.
-rw-r--r-- | CMake/Translations.cmake | 5 | ||||
-rw-r--r-- | methods/CMakeLists.txt | 31 | ||||
-rw-r--r-- | po/CMakeLists.txt | 2 |
3 files changed, 20 insertions, 18 deletions
diff --git a/CMake/Translations.cmake b/CMake/Translations.cmake index 79f2633a7..9a7127e07 100644 --- a/CMake/Translations.cmake +++ b/CMake/Translations.cmake @@ -31,6 +31,11 @@ function(apt_add_translation_domain) get_target_property(source_dir ${target} SOURCE_DIR) get_target_property(sources ${target} SOURCES) foreach(source ${sources}) + if (source MATCHES TARGET_OBJECTS) + message(IGNORE ${source}) + continue() + endif() + message(ADD ${source}) path_join(file "${source_dir}" "${source}") file(RELATIVE_PATH relfile ${PROJECT_SOURCE_DIR} ${file}) set(files ${files} ${relfile}) diff --git a/methods/CMakeLists.txt b/methods/CMakeLists.txt index 60c636c7b..4a5047efe 100644 --- a/methods/CMakeLists.txt +++ b/methods/CMakeLists.txt @@ -1,31 +1,28 @@ # Create the executable targets include_directories($<$<BOOL:${SECCOMP_FOUND}>:${SECCOMP_INCLUDE_DIR}>) +link_libraries(apt-pkg $<$<BOOL:${SECCOMP_FOUND}>:${SECCOMP_LIBRARIES}>) + +add_library(httplib OBJECT http.cc basehttp.cc) +add_library(connectlib OBJECT connect.cc rfc2553emu.cc) add_executable(file file.cc) add_executable(copy copy.cc) add_executable(store store.cc) add_executable(gpgv gpgv.cc) add_executable(cdrom cdrom.cc) -add_executable(http http.cc http_main.cc rfc2553emu.cc connect.cc basehttp.cc) -add_executable(mirror mirror.cc http.cc rfc2553emu.cc connect.cc basehttp.cc) -add_executable(ftp ftp.cc rfc2553emu.cc connect.cc) +add_executable(http http_main.cc $<TARGET_OBJECTS:httplib> $<TARGET_OBJECTS:connectlib>) +add_executable(mirror mirror.cc $<TARGET_OBJECTS:httplib> $<TARGET_OBJECTS:connectlib>) +add_executable(ftp ftp.cc $<TARGET_OBJECTS:connectlib>) add_executable(rred rred.cc) add_executable(rsh rsh.cc) -target_compile_definitions(http PRIVATE ${GNUTLS_DEFINITIONS}) -target_include_directories(http PRIVATE ${GNUTLS_INCLUDE_DIR}) - -# Link the executables against the libraries -target_link_libraries(file apt-pkg $<$<BOOL:${SECCOMP_FOUND}>:${SECCOMP_LIBRARIES}>) -target_link_libraries(copy apt-pkg $<$<BOOL:${SECCOMP_FOUND}>:${SECCOMP_LIBRARIES}>) -target_link_libraries(store apt-pkg $<$<BOOL:${SECCOMP_FOUND}>:${SECCOMP_LIBRARIES}>) -target_link_libraries(gpgv apt-pkg $<$<BOOL:${SECCOMP_FOUND}>:${SECCOMP_LIBRARIES}>) -target_link_libraries(cdrom apt-pkg $<$<BOOL:${SECCOMP_FOUND}>:${SECCOMP_LIBRARIES}>) -target_link_libraries(http apt-pkg ${GNUTLS_LIBRARIES} $<$<BOOL:${SECCOMP_FOUND}>:${SECCOMP_LIBRARIES}>) -target_link_libraries(mirror apt-pkg ${RESOLV_LIBRARIES} ${GNUTLS_LIBRARIES} $<$<BOOL:${SECCOMP_FOUND}>:${SECCOMP_LIBRARIES}>) -target_link_libraries(ftp apt-pkg ${GNUTLS_LIBRARIES} $<$<BOOL:${SECCOMP_FOUND}>:${SECCOMP_LIBRARIES}>) -target_link_libraries(rred apt-pkg $<$<BOOL:${SECCOMP_FOUND}>:${SECCOMP_LIBRARIES}>) -target_link_libraries(rsh apt-pkg $<$<BOOL:${SECCOMP_FOUND}>:${SECCOMP_LIBRARIES}>) +target_compile_definitions(connectlib PRIVATE ${GNUTLS_DEFINITIONS}) +target_include_directories(connectlib PRIVATE ${GNUTLS_INCLUDE_DIR}) + +# Additional libraries to link against for networked stuff +target_link_libraries(http ${GNUTLS_LIBRARIES}) +target_link_libraries(mirror ${RESOLV_LIBRARIES} ${GNUTLS_LIBRARIES}) +target_link_libraries(ftp ${GNUTLS_LIBRARIES}) # Install the library install(TARGETS file copy store gpgv cdrom http ftp rred rsh mirror diff --git a/po/CMakeLists.txt b/po/CMakeLists.txt index 57015eca7..f69123a26 100644 --- a/po/CMakeLists.txt +++ b/po/CMakeLists.txt @@ -15,7 +15,7 @@ apt_add_translation_domain( TARGETS apt apt-cache apt-get apt-config apt-cdrom apt-helper apt-mark apt-private # Methods - file copy store gpgv cdrom http ftp rred rsh mirror + connectlib httplib file copy store gpgv cdrom http ftp rred rsh mirror SCRIPTS ../dselect/install ../dselect/update EXCLUDE_LANGUAGES ${languages_excluded} ) |