You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
cpp-utilities/cmake/templates/Config.cmake.in

89 lines
4.8 KiB

@PACKAGE_INIT@
# provide meta-data
set(@META_PROJECT_NAME@_varname "@META_PROJECT_VARNAME_UPPER@")
set(@META_PROJECT_NAME@_static_varname "@META_PROJECT_VARNAME_UPPER@")
set(@META_PROJECT_VARNAME_UPPER@_DISPLAY_NAME "@META_APP_NAME@")
set(@META_PROJECT_VARNAME_UPPER@_AUTHOR "@META_APP_AUTHOR@")
set(@META_PROJECT_VARNAME_UPPER@_VERSION "@META_APP_VERSION@")
set(@META_PROJECT_VARNAME_UPPER@_VERSION_MAJOR "@META_VERSION_MAJOR@")
set(@META_PROJECT_VARNAME_UPPER@_VERSION_MINOR "@META_VERSION_MINOR@")
set(@META_PROJECT_VARNAME_UPPER@_VERSION_PATCH "@META_VERSION_PATCH@")
set(@META_PROJECT_VARNAME_UPPER@_GIT_REV_COUNT "@META_GIT_REV_COUNT@")
set(@META_PROJECT_VARNAME_UPPER@_GIT_LAST_COMMIT_ID "@META_GIT_LAST_COMMIT_ID@")
set(@META_PROJECT_VARNAME_UPPER@_URL "@META_APP_URL@")
set(@META_PROJECT_VARNAME_UPPER@_DESCRIPTION "@META_APP_DESCRIPTION@")
# define general config
set(@META_PROJECT_VARNAME_UPPER@_IS_HEADER_ONLY @META_HEADER_ONLY_LIB@)
set(@META_PROJECT_VARNAME_UPPER@_HAS_SHARED_LIB @BUILD_SHARED_LIBS@)
set(@META_PROJECT_VARNAME_UPPER@_HAS_STATIC_LIB @BUILD_STATIC_LIBS@)
set(@META_PROJECT_VARNAME_UPPER@_INCLUDE_DIRS "@PACKAGE_HEADER_INSTALL_DESTINATION@")
set(@META_PROJECT_VARNAME_UPPER@_BIN_DIR "@PACKAGE_BIN_INSTALL_DESTINATION@")
set(@META_PROJECT_VARNAME_UPPER@_LIB_DIR "@PACKAGE_LIB_INSTALL_DESTINATION@")
set(@META_PROJECT_VARNAME_UPPER@_MODULE_DIRS "@PACKAGE_CMAKE_MODULE_INSTALL_DESTINATION@")
set(@META_PROJECT_VARNAME_UPPER@_CONFIG_DIRS "@PACKAGE_CMAKE_CONFIG_INSTALL_DESTINATION@")
set(@META_PROJECT_VARNAME_UPPER@_PRIVATE_QT_MODULES "@QT_MODULES@")
set(@META_PROJECT_VARNAME_UPPER@_PRIVATE_KF_MODULES "@KF_MODULES@")
set(@META_PROJECT_VARNAME_UPPER@_PUBLIC_QT_MODULES "@META_PUBLIC_QT_MODULES@")
set(@META_PROJECT_VARNAME_UPPER@_PUBLIC_KF_MODULES "@META_PUBLIC_KF_MODULES@")
set(@META_PROJECT_VARNAME_UPPER@_HAS_QT_TRANSLATION_FILES @APP_SPECIFIC_QT_TRANSLATIONS_AVAILABLE@)
set(@META_PROJECT_VARNAME_UPPER@_QT_RESOURCES @QT_RESOURCES@)
# define shared library config
if(@META_PROJECT_VARNAME_UPPER@_HAS_SHARED_LIB)
set(@META_PROJECT_VARNAME_UPPER@_SHARED_LIB "@TARGET_PREFIX@@META_PROJECT_NAME@@TARGET_SUFFIX@")
set(@META_PROJECT_VARNAME_UPPER@_SHARED_LIB_DEPENDS @META_PUBLIC_SHARED_LIB_DEPENDS@)
set(@META_PROJECT_VARNAME_UPPER@_SHARED_LIB_COMPILE_DEFINITIONS @META_PUBLIC_SHARED_LIB_COMPILE_DEFINITIONS@)
set(PC_PKG_SHARED_@TARGET_PREFIX@@META_PROJECT_NAME@@TARGET_SUFFIX@ "@TARGET_PREFIX@@META_PROJECT_NAME@@TARGET_SUFFIX@")
if(NOT TARGET "${@META_PROJECT_VARNAME_UPPER@_SHARED_LIB}")
include("${CMAKE_CURRENT_LIST_DIR}/@META_PROJECT_NAME@SharedTargets.cmake")
endif()
endif()
# define static library config
if(@META_PROJECT_VARNAME_UPPER@_HAS_STATIC_LIB)
set(@META_PROJECT_VARNAME_UPPER@_STATIC_LIB "@TARGET_PREFIX@@META_PROJECT_NAME@@TARGET_SUFFIX@_static")
set(@META_PROJECT_VARNAME_UPPER@_STATIC_LIB_DEPENDS @META_PUBLIC_STATIC_LIB_DEPENDS@ @META_PRIVATE_STATIC_LIB_DEPENDS@)
set(@META_PROJECT_VARNAME_UPPER@_STATIC_LIB_COMPILE_DEFINITIONS @META_PUBLIC_STATIC_LIB_COMPILE_DEFINITIONS@)
set(PC_PKG_STATIC_@TARGET_PREFIX@@META_PROJECT_NAME@@TARGET_SUFFIX@_static "@TARGET_PREFIX@@META_PROJECT_NAME@@TARGET_SUFFIX@_static")
if(NOT TARGET "${@META_PROJECT_VARNAME_UPPER@_STATIC_LIB}")
include("${CMAKE_CURRENT_LIST_DIR}/@META_PROJECT_NAME@StaticTargets.cmake")
endif()
endif()
# set default target: prefer shared lib over static lib
if(@META_PROJECT_VARNAME_UPPER@_HAS_SHARED_LIB)
set(@META_PROJECT_VARNAME_UPPER@_LIB "@TARGET_PREFIX@@META_PROJECT_NAME@@TARGET_SUFFIX@")
else()
set(@META_PROJECT_VARNAME_UPPER@_LIB "@TARGET_PREFIX@@META_PROJECT_NAME@@TARGET_SUFFIX@_static")
endif()
# define macro to ease use of library
macro(use_@META_PROJECT_VARNAME@)
# make CMake modules of the project available
list(APPEND CMAKE_MODULE_PATH ${@META_PROJECT_VARNAME_UPPER@_MODULE_DIRS})
# link against library (also "link" against header-only libs to get compile defs and interface link libs)
link_directories(${@META_PROJECT_VARNAME_UPPER@_LIB_DIR})
include(3rdParty)
if(NOT ARGV0)
set(@META_PROJECT_VARNAME_UPPER@_LINKAGE AUTO_LINKAGE)
else()
set(@META_PROJECT_VARNAME_UPPER@_LINKAGE "${ARG0}")
endif()
link_against_library(@META_PROJECT_VARNAME_UPPER@ "${@META_PROJECT_VARNAME_UPPER@_LINKAGE}" REQUIRED)
# add required Qt and KF modules
list(APPEND IMPORTED_QT_MODULES
${@META_PROJECT_VARNAME_UPPER@_PUBLIC_QT_MODULES}
${@META_PROJECT_VARNAME_UPPER@_PRIVATE_QT_MODULES}
)
list(APPEND IMPORTED_KF_MODULES
${@META_PROJECT_VARNAME_UPPER@_PUBLIC_KF_MODULES}
${@META_PROJECT_VARNAME_UPPER@_PRIVATE_KF_MODULES}
)
# add required translations to APP_SPECIFIC_QT_TRANSLATION_FILES_ARRAY
if(@META_PROJECT_VARNAME_UPPER@_HAS_QT_TRANSLATION_FILES)
list(APPEND APP_SPECIFIC_QT_TRANSLATION_FILES @META_PROJECT_NAME@)
endif()
endmacro()