[libcalamares] Improve CMake bits

- use modern CMake commands, target-based
- make DLLEXPORT_PRO local to the build of libcalamares
- improve locality of includes
This commit is contained in:
Adriaan de Groot 2024-02-18 23:19:43 +01:00
parent 4eba859236
commit cefb437324

View File

@ -10,9 +10,6 @@
# (non-GUI) jobs. # (non-GUI) jobs.
# #
add_definitions(-DDLLEXPORT_PRO)
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CalamaresConfig.h.in ${CMAKE_CURRENT_BINARY_DIR}/CalamaresConfig.h) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CalamaresConfig.h.in ${CMAKE_CURRENT_BINARY_DIR}/CalamaresConfig.h)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CalamaresVersion.h.in ${CMAKE_CURRENT_BINARY_DIR}/CalamaresVersion.h) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CalamaresVersion.h.in ${CMAKE_CURRENT_BINARY_DIR}/CalamaresVersion.h)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CalamaresVersionX.h.in ${CMAKE_CURRENT_BINARY_DIR}/CalamaresVersionX.h) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CalamaresVersionX.h.in ${CMAKE_CURRENT_BINARY_DIR}/CalamaresVersionX.h)
@ -98,11 +95,18 @@ set_target_properties(
PROPERTIES PROPERTIES
VERSION ${CALAMARES_VERSION_SHORT} VERSION ${CALAMARES_VERSION_SHORT}
SOVERSION ${CALAMARES_SOVERSION} SOVERSION ${CALAMARES_SOVERSION}
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_INSTALL_FULL_INCLUDEDIR}/libcalamares
) )
target_link_libraries(calamares LINK_PUBLIC yamlcpp::yamlcpp ${qtname}::Core ${qtname}::Network) target_link_libraries(calamares LINK_PUBLIC yamlcpp::yamlcpp ${qtname}::Core ${qtname}::Network)
target_link_libraries(calamares LINK_PUBLIC ${kfname}::CoreAddons) target_link_libraries(calamares LINK_PUBLIC ${kfname}::CoreAddons)
target_compile_definitions(calamares PRIVATE DLLEXPORT_PRO)
target_include_directories(calamares PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
target_include_directories(calamares PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:include/libcalamares>
)
target_include_directories(calamares PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>)
### OPTIONAL Automount support (requires dbus) ### OPTIONAL Automount support (requires dbus)
# #
# #