# CMakeLists.txt for libgnucash/core-utils add_subdirectory(test) ### libgnc-core-utils set (core_utils_SOURCES binreloc.c gnc-prefs.c gnc-environment.c gnc-filepath-utils.cpp gnc-gkeyfile-utils.c gnc-glib-utils.c gnc-unicode.cpp gnc-locale-utils.c gnc-locale-utils.cpp gnc-path.c gnc-version.c ) # Add dependency on config.h set_source_files_properties (${core_utils_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H}) set(core_utils_noinst_HEADERS binreloc.h gnc-prefs.h gnc-prefs-p.h gnc-environment.h gnc-filepath-utils.h gnc-gkeyfile-utils.h gnc-glib-utils.h gnc-unicode.h gnc-locale-utils.h gnc-locale-utils.hpp gnc-path.h gnc-version.h ) add_library(gnc-core-utils ${core_utils_SOURCES} ${core_utils_noinst_HEADERS}) add_dependencies(gnc-core-utils gnc-vcs-info) target_include_directories(gnc-core-utils PUBLIC ${CMAKE_SOURCE_DIR}/common ${CMAKE_BINARY_DIR}/common ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${GTK_MAC_INCLUDE_DIRS}) target_link_libraries(gnc-core-utils PUBLIC PkgConfig::GLIB2 PRIVATE ${Boost_LIBRARIES} ${GOBJECT_LDFLAGS} ${GTK_MAC_LDFLAGS} ${ICU_LIBRARIES} "$<$:${OSX_EXTRA_LIBRARIES}>") target_compile_definitions(gnc-core-utils PRIVATE G_LOG_DOMAIN=\"gnc.core-utils\" $<$:GNC_VCS=\"git\"> ${GTK_MAC_CFLAGS_OTHER}) target_compile_options(gnc-core-utils PRIVATE $<$:${OSX_EXTRA_COMPILE_FLAGS}>) install(TARGETS gnc-core-utils LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ) if (COVERAGE) add_coverage_target(gnc-core-utils) endif() ### gncla-dir.h set(prefix ${CMAKE_INSTALL_PREFIX}) set(datadir ${CMAKE_INSTALL_FULL_DATADIR}) set(bindir ${CMAKE_INSTALL_FULL_BINDIR}) set(libdir ${CMAKE_INSTALL_FULL_LIBDIR}) set(sysconfdir ${CMAKE_INSTALL_FULL_SYSCONFDIR}) set(localedir "${CMAKE_INSTALL_FULL_DATAROOTDIR}/locale") configure_file(gncla-dir.h.in gncla-dir.h) ### Build rules for gnc-vcs-info.h # When building from a distribution tarball simply use the one # found in the source tree. # When building from a git working directory extract the neede information from git. # Otherwise work from the PROJECT_VERSION variable and today's date, but annotate # the version info to indicate it's inaccurate. if (GENERATE_VCS_INFO) file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/gnc-vcs-info.h.in "/* Autogenerated. Do not change. */ #define GNC_VCS_REV \"@GNC_VCS_REV@\" #define GNC_VCS_REV_DATE \"@GNC_VCS_REV_DATE@\" #define GNC_VCS_REV_YEAR \"@GNC_VCS_REV_YEAR@\" #define GNC_VCS_REV_Y_M \"@GNC_VCS_REV_Y_M@\"") if (BUILDING_FROM_VCS) add_custom_target(gnc-vcs-info ALL BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/gnc-vcs-info.h COMMAND ${CMAKE_COMMAND} -D SRC=${CMAKE_CURRENT_BINARY_DIR}/gnc-vcs-info.h.in -D DST=${CMAKE_CURRENT_BINARY_DIR}/gnc-vcs-info.h -D SRC_DIR=${CMAKE_SOURCE_DIR} -D SHELL="${SHELL}" -P ${CMAKE_SOURCE_DIR}/cmake/git2version-info.cmake) else() add_custom_target(gnc-vcs-info ALL BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/gnc-vcs-info.h COMMAND ${CMAKE_COMMAND} -D SRC=${CMAKE_CURRENT_BINARY_DIR}/gnc-vcs-info.h.in -D DST=${CMAKE_CURRENT_BINARY_DIR}/gnc-vcs-info.h -D PROJECT_VERSION=${PROJECT_VERSION} -P ${CMAKE_SOURCE_DIR}/cmake/no-vcs2version-info.cmake) endif() else() add_custom_target(gnc-vcs-info DEPENDS ${VCS_INFO_FILE}) endif() dist_add_generated (${GENERATE_VCS_INFO} gnc-vcs-info.h) # Dist files set_local_dist(core_utils_DIST_local ${core_utils_SOURCES} ${core_utils_noinst_HEADERS} CMakeLists.txt gncla-dir.h.in) set(core_utils_DIST ${core_utils_DIST_local} ${test_core_utils_DIST} PARENT_SCOPE)