From bdd3b78e3dfb8bc4994f8e3ec14be9144ca46200 Mon Sep 17 00:00:00 2001 From: Adrien Bertrand Date: Mon, 26 Aug 2024 00:56:48 +0200 Subject: [PATCH] cmake: add option BUILD_SHARED_LIBS (by default ON). Use OFF for static. This simplifies the whole lib target creation thing... --- .cmake/create_lib_target_with_deps.cmake | 53 ++++++++++++++++ .cmake/create_targets_both_lib_types.cmake | 73 ---------------------- CMakeLists.txt | 2 + CMakePresets.json | 24 +++++++ libticables/trunk/CMakeLists.txt | 30 ++++----- libticables/trunk/tests/CMakeLists.txt | 2 +- libticalcs/trunk/CMakeLists.txt | 19 +++--- libticalcs/trunk/tests/CMakeLists.txt | 2 +- libticonv/trunk/CMakeLists.txt | 15 +++-- libticonv/trunk/tests/CMakeLists.txt | 2 +- libtifiles/trunk/CMakeLists.txt | 13 ++-- libtifiles/trunk/tests/CMakeLists.txt | 2 +- tifileutil/CMakeLists.txt | 4 +- 13 files changed, 119 insertions(+), 122 deletions(-) create mode 100644 .cmake/create_lib_target_with_deps.cmake delete mode 100644 .cmake/create_targets_both_lib_types.cmake diff --git a/.cmake/create_lib_target_with_deps.cmake b/.cmake/create_lib_target_with_deps.cmake new file mode 100644 index 00000000..38559808 --- /dev/null +++ b/.cmake/create_lib_target_with_deps.cmake @@ -0,0 +1,53 @@ +function(create_lib_target_with_deps basename) + set(lib lib_${basename}) + add_library(${lib} ${SRC_FILES}) + + include(CheckIPOSupported) + check_ipo_supported(RESULT lto_supported OUTPUT error) + if(lto_supported) + set_target_properties(${lib} PROPERTIES + INTERPROCEDURAL_OPTIMIZATION_DEBUG FALSE + INTERPROCEDURAL_OPTIMIZATION_RELEASE TRUE + INTERPROCEDURAL_OPTIMIZATION_RELWITHDEBINFO TRUE + ) + else() + message(STATUS "IPO/LTO not supported: <${error}>") + endif() + + # Internal deps + foreach(idep ${ARGN}) + add_dependencies(${lib} lib_${idep}) + if(${idep} MATCHES "^(ti[a-z]+)2$") + set(INTERNAL_DEP_LIB_DIR ${PROJECT_BINARY_DIR}/../../lib${CMAKE_MATCH_1}/trunk) + set(INTERNAL_DEP_INC_DIR ${PROJECT_SOURCE_DIR}/../../lib${CMAKE_MATCH_1}/trunk/src) + else() + set(INTERNAL_DEP_LIB_DIR ${PROJECT_BINARY_DIR}/../../lib${idep}/trunk) + set(INTERNAL_DEP_INC_DIR ${PROJECT_SOURCE_DIR}/../../lib${idep}/trunk/src) + endif() + if(GEN_IS_MULTI_CONFIG) + set(INTERNAL_DEP_LIB_DIR "${INTERNAL_DEP_LIB_DIR}/$") + endif() + target_include_directories(${lib} PRIVATE ${INTERNAL_DEP_INC_DIR}) + if (BUILD_SHARED_LIBS) + target_link_directories(${lib} PRIVATE "${INTERNAL_DEP_LIB_DIR}") + target_link_libraries(${lib} PRIVATE ${idep}) + else() + target_link_libraries(${lib} PRIVATE "${INTERNAL_DEP_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}${idep}${CMAKE_STATIC_LIBRARY_SUFFIX}") + endif() + endforeach() + + # Main properties + set_target_properties(${lib} PROPERTIES PUBLIC_HEADER "${PUBLIC_HEADERS}") + + # Defines + target_compile_definitions(${lib} PRIVATE PACKAGE="${PROJECT_NAME}" VERSION="${PROJECT_VERSION}") + + # Stuff to install and developer-related things + install(TARGETS ${lib} + ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" + PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/tilp2") + + configure_and_install_pc_file(${basename} ${PROJECT_VERSION}) +endfunction() diff --git a/.cmake/create_targets_both_lib_types.cmake b/.cmake/create_targets_both_lib_types.cmake deleted file mode 100644 index 9051bc85..00000000 --- a/.cmake/create_targets_both_lib_types.cmake +++ /dev/null @@ -1,73 +0,0 @@ -function(create_targets_both_lib_types basename) - set(lib_objlib ${basename}_objlib) - set(lib_shared ${basename}_shared) - set(lib_static ${basename}_static) - - if(MSVC) - set(STATIC_LIB_NAME_PRESUFFIX "-static") - else() - set(STATIC_LIB_NAME_PRESUFFIX "") - endif() - - # Object target to unify source building for both (shared/static) real targets - add_library(${lib_objlib} OBJECT ${SRC_FILES}) - - # The two real targets - add_library(${lib_shared} SHARED $) - add_library(${lib_static} STATIC $) - - include(CheckIPOSupported) - check_ipo_supported(RESULT lto_supported OUTPUT error) - if(lto_supported) - set_target_properties(${lib_objlib} PROPERTIES - INTERPROCEDURAL_OPTIMIZATION_DEBUG FALSE - INTERPROCEDURAL_OPTIMIZATION_RELEASE TRUE - INTERPROCEDURAL_OPTIMIZATION_RELWITHDEBINFO TRUE - ) - else() - message(STATUS "IPO/LTO not supported: <${error}>") - endif() - - # Internal deps - foreach(idep ${ARGN}) - add_dependencies(${lib_objlib} ${idep}_objlib) - add_dependencies(${lib_shared} ${idep}_shared) - if(${idep} MATCHES "^(ti[a-z]+)2$") - set(INTERNAL_DEP_LIB_DIR ${PROJECT_BINARY_DIR}/../../lib${CMAKE_MATCH_1}/trunk) - set(INTERNAL_DEP_INC_DIR ${PROJECT_SOURCE_DIR}/../../lib${CMAKE_MATCH_1}/trunk/src) - else() - set(INTERNAL_DEP_LIB_DIR ${PROJECT_BINARY_DIR}/../../lib${idep}/trunk) - set(INTERNAL_DEP_INC_DIR ${PROJECT_SOURCE_DIR}/../../lib${idep}/trunk/src) - endif() - if(GEN_IS_MULTI_CONFIG) - set(INTERNAL_DEP_LIB_DIR "${INTERNAL_DEP_LIB_DIR}/$") - endif() - target_include_directories(${lib_objlib} PRIVATE ${INTERNAL_DEP_INC_DIR}) - if (VCPKG_TARGET_TRIPLET MATCHES "-static") - target_link_libraries(${lib_shared} PRIVATE "${INTERNAL_DEP_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}${idep}${STATIC_LIB_NAME_PRESUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}") - else() - target_link_directories(${lib_shared} PRIVATE "${INTERNAL_DEP_LIB_DIR}") - target_link_libraries(${lib_shared} PRIVATE ${idep}) - endif() - endforeach() - - # Main properties - set_target_properties(${lib_shared} PROPERTIES - OUTPUT_NAME ${basename} - PUBLIC_HEADER "${PUBLIC_HEADERS}") - set_target_properties(${lib_static} PROPERTIES - OUTPUT_NAME "${basename}${STATIC_LIB_NAME_PRESUFFIX}" - PUBLIC_HEADER "${PUBLIC_HEADERS}") - - # Defines - target_compile_definitions(${lib_objlib} PRIVATE PACKAGE="${PROJECT_NAME}" VERSION="${PROJECT_VERSION}") - - # Stuff to install and developer-related things - install(TARGETS ${lib_shared} ${lib_static} - ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" - LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" - RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" - PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/tilp2") - - configure_and_install_pc_file(${basename} ${PROJECT_VERSION}) -endfunction() diff --git a/CMakeLists.txt b/CMakeLists.txt index 2db36b49..1cd5091c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -61,6 +61,8 @@ endif() project(tilibs C CXX) +option(BUILD_SHARED_LIBS "Whether to build shared libs instead of static ones" ON) + # Our modules list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/.cmake) file(GLOB files "${CMAKE_CURRENT_SOURCE_DIR}/.cmake/*.cmake") diff --git a/CMakePresets.json b/CMakePresets.json index c04f799a..9980b77d 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -93,6 +93,10 @@ "VCPKG_TARGET_TRIPLET": { "type": "STRING", "value": "x64-windows-static" + }, + "BUILD_SHARED_LIBS": { + "type": "BOOL", + "value": "OFF" } } }, @@ -103,6 +107,10 @@ "VCPKG_TARGET_TRIPLET": { "type": "STRING", "value": "x86-windows-static" + }, + "BUILD_SHARED_LIBS": { + "type": "BOOL", + "value": "OFF" } } }, @@ -113,6 +121,10 @@ "VCPKG_TARGET_TRIPLET": { "type": "STRING", "value": "x64-osx" + }, + "BUILD_SHARED_LIBS": { + "type": "BOOL", + "value": "OFF" } } }, @@ -123,6 +135,10 @@ "VCPKG_TARGET_TRIPLET": { "type": "STRING", "value": "arm64-osx" + }, + "BUILD_SHARED_LIBS": { + "type": "BOOL", + "value": "OFF" } } }, @@ -133,6 +149,10 @@ "VCPKG_TARGET_TRIPLET": { "type": "STRING", "value": "x64-linux" + }, + "BUILD_SHARED_LIBS": { + "type": "BOOL", + "value": "OFF" } } }, @@ -143,6 +163,10 @@ "VCPKG_TARGET_TRIPLET": { "type": "STRING", "value": "x64-linux-dynamic" + }, + "BUILD_SHARED_LIBS": { + "type": "BOOL", + "value": "ON" } } } diff --git a/libticables/trunk/CMakeLists.txt b/libticables/trunk/CMakeLists.txt index d3ab8533..bb4d4d40 100644 --- a/libticables/trunk/CMakeLists.txt +++ b/libticables/trunk/CMakeLists.txt @@ -48,44 +48,40 @@ if(NOT WIN32) endif() # auto-creation of all targets with flags etc. -create_targets_both_lib_types(ticables2) +create_lib_target_with_deps(ticables2) if(APPLE) find_library(IOKitFramework IOKit REQUIRED) find_library(SecurityFramework Security REQUIRED) - target_link_libraries(ticables2_objlib PRIVATE ${IOKitFramework} ${SecurityFramework}) - target_link_libraries(ticables2_shared PRIVATE ${IOKitFramework} ${SecurityFramework}) + target_link_libraries(lib_ticables2 PRIVATE ${IOKitFramework} ${SecurityFramework}) endif() if(LINUX) - target_link_libraries(ticables2_objlib PRIVATE Threads::Threads) + target_link_libraries(lib_ticables2 PRIVATE Threads::Threads) endif() # external deps lookup if(WIN32) find_library(LIBUSB0 NAMES libusb0.lib usb0 REQUIRED) - target_link_libraries(ticables2_objlib PRIVATE ${LIBUSB0}) - target_link_libraries(ticables2_shared PRIVATE ${LIBUSB0}) + target_link_libraries(lib_ticables2 PRIVATE ${LIBUSB0}) else() pkg_check_modules(libusb REQUIRED IMPORTED_TARGET libusb-1.0>=1.0.16) - target_link_libraries(ticables2_objlib PRIVATE PkgConfig::libusb) - target_link_libraries(ticables2_shared PRIVATE PkgConfig::libusb) + target_link_libraries(lib_ticables2 PRIVATE PkgConfig::libusb) endif() pkg_check_modules(glib REQUIRED IMPORTED_TARGET glib-2.0) -target_link_libraries(ticables2_objlib PRIVATE PkgConfig::glib) -target_link_libraries(ticables2_shared PRIVATE PkgConfig::glib) +target_link_libraries(lib_ticables2 PRIVATE PkgConfig::glib) if(NOT WIN32) # additional internal defines - target_compile_definitions(ticables2_objlib PUBLIC HAVE_LIBUSB_1_0=1 HAVE_LIBUSB10_STRERROR=1 HAVE_TERMIOS_H=1) + target_compile_definitions(lib_ticables2 PUBLIC HAVE_LIBUSB_1_0=1 HAVE_LIBUSB10_STRERROR=1 HAVE_TERMIOS_H=1) endif() -set_target_properties(ticables2_shared PROPERTIES VERSION 8.0.0 SOVERSION 8) +set_target_properties(lib_ticables2 PROPERTIES VERSION 8.0.0 SOVERSION 8) # Takes care of the i18n po/pot/gmo/mo files if(ENABLE_NLS) i18n_mo_from_po_pot() - add_dependencies(ticables2_objlib potfiles_2) + add_dependencies(lib_ticables2 potfiles_2) endif() # check includes for parallel and serial support @@ -94,19 +90,19 @@ if(LINUX) CHECK_INCLUDE_FILE(linux/parport.h HAVE_LINUX_PARPORT_H) CHECK_INCLUDE_FILE(linux/serial.h HAVE_LINUX_SERIAL_H) if (HAVE_LINUX_PARPORT_H) - target_compile_definitions(ticables2_objlib PUBLIC HAVE_LINUX_PARPORT_H=1) + target_compile_definitions(lib_ticables2 PUBLIC HAVE_LINUX_PARPORT_H=1) endif() if (HAVE_LINUX_SERIAL_H) - target_compile_definitions(ticables2_objlib PUBLIC HAVE_LINUX_SERIAL_H=1) + target_compile_definitions(lib_ticables2 PUBLIC HAVE_LINUX_SERIAL_H=1) endif() endif() # public export define -target_compile_definitions(ticables2_objlib PUBLIC TICABLES_EXPORTS) +target_compile_definitions(lib_ticables2 PUBLIC TICABLES_EXPORTS) option(ENABLE_LOGGING "Whether to build with cables logging enabled (default ON)" ON) if(ENABLE_LOGGING) - target_compile_definitions(ticables2_objlib PUBLIC ENABLE_LOGGING=1) + target_compile_definitions(lib_ticables2 PUBLIC ENABLE_LOGGING=1) else() message("Building ${PROJECT_NAME} with logging disabled") endif() diff --git a/libticables/trunk/tests/CMakeLists.txt b/libticables/trunk/tests/CMakeLists.txt index 7c66e733..b26da6a8 100644 --- a/libticables/trunk/tests/CMakeLists.txt +++ b/libticables/trunk/tests/CMakeLists.txt @@ -16,7 +16,7 @@ foreach(tar torture_ticables test_ticables_2) endif() target_include_directories(${tar} PRIVATE ${PROJECT_SOURCE_DIR}/../src) target_link_directories(${tar} PRIVATE ${PROJECT_BINARY_DIR}/..) - target_link_libraries(${tar} PRIVATE PkgConfig::glib ticables2_objlib) + target_link_libraries(${tar} PRIVATE PkgConfig::glib lib_ticables2) endforeach() add_custom_target(ticables2_check diff --git a/libticalcs/trunk/CMakeLists.txt b/libticalcs/trunk/CMakeLists.txt index 21d68e83..bb0924b8 100644 --- a/libticalcs/trunk/CMakeLists.txt +++ b/libticalcs/trunk/CMakeLists.txt @@ -65,38 +65,35 @@ set(PUBLIC_HEADERS src/calclabequipmentdata.h) # auto-creation of all targets with flags etc., alongside with internal deps -create_targets_both_lib_types(ticalcs2 tifiles2 ticables2 ticonv) +create_lib_target_with_deps(ticalcs2 tifiles2 ticables2 ticonv) if(LINUX) - target_link_libraries(ticalcs2_objlib PRIVATE Threads::Threads) + target_link_libraries(lib_ticalcs2 PRIVATE Threads::Threads) endif() # external deps lookup if(WIN32) find_library(LIBUSB0 NAMES libusb0.lib usb0 REQUIRED) - target_link_libraries(ticalcs2_objlib PRIVATE ${LIBUSB0}) - target_link_libraries(ticalcs2_shared PRIVATE ${LIBUSB0}) + target_link_libraries(lib_ticalcs2 PRIVATE ${LIBUSB0}) else() pkg_check_modules(libusb REQUIRED IMPORTED_TARGET libusb-1.0>=1.0.16) - target_link_libraries(ticalcs2_objlib PRIVATE PkgConfig::libusb) - target_link_libraries(ticalcs2_shared PRIVATE PkgConfig::libusb) + target_link_libraries(lib_ticalcs2 PRIVATE PkgConfig::libusb) endif() pkg_check_modules(glib REQUIRED IMPORTED_TARGET glib-2.0) find_package(ZLIB REQUIRED) # for libtifiles find_package(LibArchive REQUIRED) # for libticables -target_link_libraries(ticalcs2_objlib PRIVATE ZLIB::ZLIB PkgConfig::glib LibArchive::LibArchive) -target_link_libraries(ticalcs2_shared PRIVATE ZLIB::ZLIB PkgConfig::glib LibArchive::LibArchive) +target_link_libraries(lib_ticalcs2 PRIVATE ZLIB::ZLIB PkgConfig::glib LibArchive::LibArchive) -set_target_properties(ticalcs2_shared PROPERTIES VERSION 13.0.3 SOVERSION 13) +set_target_properties(lib_ticalcs2 PROPERTIES VERSION 13.0.3 SOVERSION 13) # Takes care of the i18n po/pot/gmo/mo files if(ENABLE_NLS) i18n_mo_from_po_pot() - add_dependencies(ticalcs2_objlib potfiles_3) + add_dependencies(lib_ticalcs2 potfiles_3) endif() # public export define -target_compile_definitions(ticalcs2_objlib PUBLIC TICALCS_EXPORTS) +target_compile_definitions(lib_ticalcs2 PUBLIC TICALCS_EXPORTS) # tests add_subdirectory(tests) diff --git a/libticalcs/trunk/tests/CMakeLists.txt b/libticalcs/trunk/tests/CMakeLists.txt index 9f467382..9a3aecc4 100644 --- a/libticalcs/trunk/tests/CMakeLists.txt +++ b/libticalcs/trunk/tests/CMakeLists.txt @@ -55,7 +55,7 @@ foreach(tar torture_ticalcs test_ticalcs_2) ${PROJECT_SOURCE_DIR}/../src) target_link_directories(${tar} PRIVATE ${PROJECT_BINARY_DIR}/..) - target_link_libraries(${tar} PRIVATE ticonv_objlib tifiles2_objlib ticables2_objlib ticalcs2_objlib) + target_link_libraries(${tar} PRIVATE lib_ticonv lib_tifiles2 lib_ticables2 lib_ticalcs2) endforeach() add_custom_target(ticalcs2_check diff --git a/libticonv/trunk/CMakeLists.txt b/libticonv/trunk/CMakeLists.txt index 35778f0d..dfb02d56 100644 --- a/libticonv/trunk/CMakeLists.txt +++ b/libticonv/trunk/CMakeLists.txt @@ -28,29 +28,28 @@ option(USE_ICONV "Use libiconv at runtime for libticonv (whether to link with th pkg_check_modules(glib REQUIRED IMPORTED_TARGET glib-2.0) # auto-creation of all targets with flags etc., alongside with internal deps -create_targets_both_lib_types(ticonv) +create_lib_target_with_deps(ticonv) if(LINUX) - target_link_libraries(ticonv_objlib PRIVATE Threads::Threads) + target_link_libraries(lib_ticonv PRIVATE Threads::Threads) endif() -target_link_libraries(ticonv_objlib PRIVATE PkgConfig::glib) -target_link_libraries(ticonv_shared PRIVATE PkgConfig::glib) +target_link_libraries(lib_ticonv PRIVATE PkgConfig::glib) -set_target_properties(ticonv_shared PROPERTIES VERSION 9.0.4 SOVERSION 9) +set_target_properties(lib_ticonv PROPERTIES VERSION 9.0.4 SOVERSION 9) if(USE_ICONV) find_package(Iconv REQUIRED) add_compile_definitions(USE_ICONV) if(Iconv_FOUND AND NOT Iconv_IS_BUILT_IN) - target_include_directories(ticonv_objlib PRIVATE ${Iconv_INCLUDE_DIRS}) - target_link_libraries(ticonv_shared PRIVATE ${Iconv_LIBRARIES}) + target_include_directories(lib_ticonv PRIVATE ${Iconv_INCLUDE_DIRS}) + target_link_libraries(lib_ticonv PRIVATE ${Iconv_LIBRARIES}) elseif(NOT Iconv_FOUND) message(FATAL_ERROR "USE_ICONV true but it is not built-in and libiconv could not be found!") endif() endif() # public export define -target_compile_definitions(ticonv_objlib PUBLIC TICONV_EXPORTS) +target_compile_definitions(lib_ticonv PUBLIC TICONV_EXPORTS) # tests add_subdirectory(tests) diff --git a/libticonv/trunk/tests/CMakeLists.txt b/libticonv/trunk/tests/CMakeLists.txt index 066ba424..c18fa08d 100644 --- a/libticonv/trunk/tests/CMakeLists.txt +++ b/libticonv/trunk/tests/CMakeLists.txt @@ -22,7 +22,7 @@ foreach(tar torture_ticonv test_ticonv) ${PROJECT_SOURCE_DIR}/../src) target_link_directories(${tar} PRIVATE ${PROJECT_BINARY_DIR}/..) - target_link_libraries(${tar} PRIVATE PkgConfig::glib ticonv_objlib) + target_link_libraries(${tar} PRIVATE PkgConfig::glib lib_ticonv) endforeach() add_custom_target(ticonv_check diff --git a/libtifiles/trunk/CMakeLists.txt b/libtifiles/trunk/CMakeLists.txt index b4daec52..587bd142 100644 --- a/libtifiles/trunk/CMakeLists.txt +++ b/libtifiles/trunk/CMakeLists.txt @@ -55,24 +55,23 @@ find_package(LibArchive REQUIRED) pkg_check_modules(glib REQUIRED IMPORTED_TARGET glib-2.0) # auto-creation of all targets with flags etc., alongside with internal deps -create_targets_both_lib_types(tifiles2 ticonv) +create_lib_target_with_deps(tifiles2 ticonv) if(LINUX) - target_link_libraries(tifiles2_objlib PRIVATE Threads::Threads) + target_link_libraries(lib_tifiles2 PRIVATE Threads::Threads) endif() -target_link_libraries(tifiles2_objlib PRIVATE PkgConfig::glib ZLIB::ZLIB LibArchive::LibArchive) -target_link_libraries(tifiles2_shared PRIVATE PkgConfig::glib ZLIB::ZLIB LibArchive::LibArchive) +target_link_libraries(lib_tifiles2 PRIVATE PkgConfig::glib ZLIB::ZLIB LibArchive::LibArchive) -set_target_properties(tifiles2_shared PROPERTIES VERSION 11.0.2 SOVERSION 11) +set_target_properties(lib_tifiles2 PROPERTIES VERSION 11.0.2 SOVERSION 11) # Takes care of the i18n po/pot/gmo/mo files if(ENABLE_NLS) i18n_mo_from_po_pot() - add_dependencies(tifiles2_objlib potfiles_1) + add_dependencies(lib_tifiles2 potfiles_1) endif() # public export define -target_compile_definitions(tifiles2_objlib PUBLIC TIFILES_EXPORTS) +target_compile_definitions(lib_tifiles2 PUBLIC TIFILES_EXPORTS) # tests add_subdirectory(tests) diff --git a/libtifiles/trunk/tests/CMakeLists.txt b/libtifiles/trunk/tests/CMakeLists.txt index 891095bd..1c46ecdf 100644 --- a/libtifiles/trunk/tests/CMakeLists.txt +++ b/libtifiles/trunk/tests/CMakeLists.txt @@ -24,7 +24,7 @@ foreach(tar torture_tifiles test_tifiles_2) ${PROJECT_SOURCE_DIR}/../src) target_link_directories(${tar} PRIVATE ${PROJECT_BINARY_DIR}/..) - target_link_libraries(${tar} PRIVATE PkgConfig::glib LibArchive::LibArchive ticonv_objlib tifiles2_objlib) + target_link_libraries(${tar} PRIVATE PkgConfig::glib LibArchive::LibArchive lib_ticonv lib_tifiles2) endforeach() add_custom_target(tifiles2_check diff --git a/tifileutil/CMakeLists.txt b/tifileutil/CMakeLists.txt index 48e59222..ec366e83 100644 --- a/tifileutil/CMakeLists.txt +++ b/tifileutil/CMakeLists.txt @@ -35,11 +35,11 @@ target_include_directories(tifileutil PRIVATE ${CMAKE_SOURCE_DIR}/libticonv/trunk/src ${CMAKE_SOURCE_DIR}/libtifiles/trunk/src) -add_dependencies(tifileutil ticonv_shared tifiles2_shared) +add_dependencies(tifileutil lib_ticonv lib_tifiles2) target_link_directories(tifileutil PRIVATE ${CMAKE_BINARY_DIR}/libticonv/trunk ${CMAKE_BINARY_DIR}/libtifiles/trunk) -target_link_libraries(tifileutil PRIVATE PkgConfig::glib LibArchive::LibArchive ticonv_objlib tifiles2_objlib) +target_link_libraries(tifileutil PRIVATE PkgConfig::glib LibArchive::LibArchive lib_ticonv lib_tifiles2) # Takes care of the i18n po/pot/gmo/mo files if(ENABLE_NLS)