Advance Wayland and KDE package bring-up
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -0,0 +1,344 @@
|
||||
#=============================================================================
|
||||
# SPDX-FileCopyrightText: 2011 Alex Neundorf <neundorf@kde.org>
|
||||
# SPDX-FileCopyrightText: 2014-2015 Alex Merry <alex.merry@kde.org>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#=============================================================================
|
||||
|
||||
# We need to set a language to find CMake packages installed in
|
||||
# architecture-dependent locations (like /usr/lib64).
|
||||
# We only set this for the tests, making sure it does not interfere
|
||||
# with other files (as ECM itself is architecture-independent).
|
||||
project(ECMTests C CXX)
|
||||
include(../modules/QtVersionOption.cmake)
|
||||
|
||||
find_package(Qt${QT_MAJOR_VERSION} COMPONENTS Core LinguistTools Quick CONFIG)
|
||||
set_package_properties(
|
||||
Qt${QT_MAJOR_VERSION}LinguistTools
|
||||
PROPERTIES
|
||||
URL "https://www.qt.io/"
|
||||
DESCRIPTION "Qt linguist tools."
|
||||
TYPE OPTIONAL
|
||||
PURPOSE "Required to run tests for the ECMPoQmTools module."
|
||||
)
|
||||
|
||||
set_package_properties(
|
||||
Qt${QT_MAJOR_VERSION}Core
|
||||
PROPERTIES
|
||||
URL "https://www.qt.io/"
|
||||
DESCRIPTION "Qt core library."
|
||||
TYPE OPTIONAL
|
||||
PURPOSE "Required to run tests for the ECMQtDeclareLoggingCategory module, and for some tests of the KDEInstallDirs module."
|
||||
)
|
||||
|
||||
add_subdirectory(ECMAddTests)
|
||||
add_subdirectory(ECMGenerateExportHeaderTest)
|
||||
add_subdirectory(ECMGenerateHeadersTest)
|
||||
add_subdirectory(ECMSetupVersionTest)
|
||||
add_subdirectory(ECMGeneratePkgConfigFile)
|
||||
|
||||
if (TARGET Qt6::Core)
|
||||
set(QT_VERSION_OPT "-DBUILD_WITH_QT6=ON")
|
||||
else()
|
||||
set(QT_VERSION_OPT "-DBUILD_WITH_QT6=OFF")
|
||||
endif()
|
||||
|
||||
# a macro for tests that have a simple format where the name matches the
|
||||
# directory and project
|
||||
macro(add_test_variant NAME BASE COMMAND)
|
||||
string(REPLACE "." "/" src_dir "${BASE}")
|
||||
string(REPLACE "." "/" build_dir "${NAME}")
|
||||
string(REGEX REPLACE "[^.]*\\." "" proj "${NAME}")
|
||||
if (NOT ${NAME}_EXTRA_OPTIONS)
|
||||
set(_build_opts --build-options ${QT_VERSION_OPT})
|
||||
else()
|
||||
set(_build_opts ${${NAME}_EXTRA_OPTIONS} ${QT_VERSION_OPT})
|
||||
endif()
|
||||
add_test(${NAME} ${CMAKE_CTEST_COMMAND}
|
||||
--build-and-test
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/${src_dir}"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/${build_dir}"
|
||||
--build-two-config
|
||||
--build-generator ${CMAKE_GENERATOR}
|
||||
--build-makeprogram ${CMAKE_MAKE_PROGRAM}
|
||||
--build-project ${proj}
|
||||
${_build_opts}
|
||||
--test-command ${COMMAND} ${ARGN})
|
||||
endmacro()
|
||||
macro(add_test_macro NAME)
|
||||
add_test_variant("${NAME}" "${NAME}" ${ARGN})
|
||||
endmacro()
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/find-modules)
|
||||
|
||||
add_subdirectory(ECMCheckOutboundLicenseTest)
|
||||
|
||||
add_test_macro(ExecuteCoreModules dummy)
|
||||
add_test_macro(ExecuteKDEModules dummy)
|
||||
add_test_macro(KDEFetchTranslations dummy)
|
||||
|
||||
add_test_variant(KDEInstallDirsTest.vars_in_sync_no_args
|
||||
KDEInstallDirsTest.vars_in_sync dummy)
|
||||
add_test_macro(KDEInstallDirsTest.not_cache_variable dummy)
|
||||
|
||||
set(KDEInstallDirsTest.vars_in_sync_kde_arg_EXTRA_OPTIONS
|
||||
--build-options -DKDE_INSTALL_BINDIR=altbin
|
||||
-DBINDIR_expected_value=altbin
|
||||
-DCMAKE_WARN_DEPRECATED=TRUE
|
||||
)
|
||||
add_test_variant(KDEInstallDirsTest.vars_in_sync_kde_arg
|
||||
KDEInstallDirsTest.vars_in_sync dummy)
|
||||
|
||||
set(KDEInstallDirsTest.vars_in_sync_cmake_arg_EXTRA_OPTIONS
|
||||
--build-options -DCMAKE_INSTALL_BINDIR=altbin
|
||||
-DBINDIR_expected_value=altbin
|
||||
-DCMAKE_WARN_DEPRECATED=TRUE
|
||||
)
|
||||
add_test_variant(KDEInstallDirsTest.vars_in_sync_cmake_arg
|
||||
KDEInstallDirsTest.vars_in_sync dummy)
|
||||
|
||||
# KDEInstallDirs6 explicitly sets KDE_INSTALL_DIRS_NO_DEPRECATED to false,
|
||||
# hence this test makes no sense in that case
|
||||
if(TARGET Qt5::Core)
|
||||
set(KDEInstallDirsTest.vars_in_sync_oldstyle_arg_EXTRA_OPTIONS
|
||||
--build-options -DBIN_INSTALL_DIR=altbin
|
||||
-DBINDIR_expected_value=altbin
|
||||
-DCMAKE_WARN_DEPRECATED=TRUE
|
||||
)
|
||||
add_test_variant(KDEInstallDirsTest.vars_in_sync_oldstyle_arg
|
||||
KDEInstallDirsTest.vars_in_sync dummy)
|
||||
endif()
|
||||
|
||||
set(KDEInstallDirsTest.relative_or_absolute_usr_EXTRA_OPTIONS
|
||||
--build-options -DCMAKE_INSTALL_PREFIX=/usr
|
||||
-DKDE_INSTALL_USE_QT_SYS_PATHS=FALSE
|
||||
-DAUTOSTARTDIR_should_be_absolute=TRUE
|
||||
-DCONFDIR_should_be_absolute=TRUE
|
||||
-DSYSCONFDIR_should_be_absolute=TRUE
|
||||
)
|
||||
add_test_variant(KDEInstallDirsTest.relative_or_absolute_usr
|
||||
KDEInstallDirsTest.relative_or_absolute dummy)
|
||||
|
||||
if (TARGET Qt5::qmake OR TARGET Qt6::Core)
|
||||
set(KDEInstallDirsTest.relative_or_absolute_qt_EXTRA_OPTIONS
|
||||
--build-options -DCMAKE_INSTALL_PREFIX=/tmp
|
||||
-DKDE_INSTALL_USE_QT_SYS_PATHS=TRUE
|
||||
-DPLUGINDIR_should_be_absolute=TRUE
|
||||
-DQMLDIR_should_be_absolute=TRUE
|
||||
-DQTQCHDIR_should_be_absolute=TRUE
|
||||
-DQTPLUGINDIR_should_be_absolute=TRUE
|
||||
-DQTQUICKIMPORTSDIR_should_be_absolute=TRUE
|
||||
)
|
||||
add_test_variant(KDEInstallDirsTest.relative_or_absolute_qt
|
||||
KDEInstallDirsTest.relative_or_absolute dummy)
|
||||
endif ()
|
||||
if (TARGET Qt${QT_MAJOR_VERSION}::Core)
|
||||
set(ECMQtDeclareLoggingCategoryTest_EXTRA_OPTIONS
|
||||
--build-target all
|
||||
--build-options
|
||||
"-DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_CURRENT_BINARY_DIR}/ECMQtDeclareLoggingCategoryTest/InstallDirectory"
|
||||
)
|
||||
add_test_macro(ECMQtDeclareLoggingCategoryTest
|
||||
${CMAKE_COMMAND} -P "${CMAKE_CURRENT_BINARY_DIR}/ECMQtDeclareLoggingCategoryTest/check.cmake"
|
||||
)
|
||||
endif()
|
||||
|
||||
add_test_macro(FindModules dummy)
|
||||
add_test_macro(UseFindModules dummy)
|
||||
|
||||
set(ECMAddAppIconTest_EXTRA_OPTIONS
|
||||
--build-target all
|
||||
--build-options
|
||||
"-DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_CURRENT_BINARY_DIR}/ECMAddAppIconTest/InstallDirectory"
|
||||
)
|
||||
add_test_macro(ECMAddAppIconTest
|
||||
${CMAKE_COMMAND} -P "${CMAKE_CURRENT_BINARY_DIR}/ECMAddAppIconTest/check_files.cmake"
|
||||
)
|
||||
|
||||
set(ECMInstallIconsTest_EXTRA_OPTIONS
|
||||
--build-target install
|
||||
--build-options
|
||||
"-DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_CURRENT_BINARY_DIR}/ECMInstallIconsTest/InstallDirectory"
|
||||
)
|
||||
add_test_macro(ECMInstallIconsTest
|
||||
${CMAKE_COMMAND} -P "${CMAKE_CURRENT_BINARY_DIR}/ECMInstallIconsTest/check_tree.cmake"
|
||||
)
|
||||
|
||||
set(KDEPackageAppTemplatesTest_EXTRA_OPTIONS
|
||||
--build-target install
|
||||
--build-options
|
||||
"-DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_CURRENT_BINARY_DIR}/KDEPackageAppTemplatesTest/InstallDirectory"
|
||||
)
|
||||
add_test_macro(KDEPackageAppTemplatesTest
|
||||
${CMAKE_COMMAND} -P "${CMAKE_CURRENT_BINARY_DIR}/KDEPackageAppTemplatesTest/check.cmake"
|
||||
)
|
||||
|
||||
if (TARGET Qt${QT_MAJOR_VERSION}::Core AND TARGET Qt${QT_MAJOR_VERSION}::lconvert)
|
||||
set(ECMPoQmToolsTest_EXTRA_OPTIONS
|
||||
--build-target install
|
||||
--build-options
|
||||
"-DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_CURRENT_BINARY_DIR}/ECMPoQmToolsTest/InstallDirectory"
|
||||
)
|
||||
add_test_macro(ECMPoQmToolsTest
|
||||
${CMAKE_COMMAND} -P "${CMAKE_CURRENT_BINARY_DIR}/ECMPoQmToolsTest/check.cmake"
|
||||
)
|
||||
endif()
|
||||
|
||||
set_package_properties(
|
||||
Qt${QT_MAJOR_VERSION}Quick
|
||||
PROPERTIES
|
||||
URL "https://www.qt.io/"
|
||||
DESCRIPTION "Qt Quick library."
|
||||
TYPE OPTIONAL
|
||||
PURPOSE "Required to run tests for the ECMQMLModules module."
|
||||
)
|
||||
if (TARGET Qt${QT_MAJOR_VERSION}::Quick)
|
||||
set(ECMFindQmlModuleTest.nonexistent_EXTRA_OPTIONS
|
||||
--build-options -DQML_MODULE_NAME=org.kde.ecmtest42 -DQML_MODULE_VERSION=2.0 -DEXPECTED_FOUND_VARAIBLE=FALSE
|
||||
)
|
||||
add_test_variant(ECMFindQmlModuleTest.nonexistent ECMFindQmlModuleTest dummy)
|
||||
set(ECMFindQmlModuleTest.existent_EXTRA_OPTIONS
|
||||
--build-options -DQML_MODULE_NAME=org.kde.ecmtest -DQML_MODULE_VERSION=2.0 -DEXPECTED_FOUND_VARAIBLE=TRUE -DBUILD_WITH_QT6=ON
|
||||
)
|
||||
add_test_variant(ECMFindQmlModuleTest.existent ECMFindQmlModuleTest dummy)
|
||||
|
||||
|
||||
set(ECMFindQmlModuleTest.missmatching_version_EXTRA_OPTIONS
|
||||
--build-options -DQML_MODULE_NAME=org.kde.ecmtest -DQML_MODULE_VERSION=2.9 -DEXPECTED_FOUND_VARAIBLE=FALSE
|
||||
)
|
||||
add_test_variant(ECMFindQmlModuleTest.missmatching_version ECMFindQmlModuleTest dummy)
|
||||
if (QT_MAJOR_VERSION VERSION_GREATER 5)
|
||||
set(ECMFindQmlModuleTest.later_version_found_EXTRA_OPTIONS
|
||||
--build-options -DQML_MODULE_NAME=org.kde.ecmtest -DQML_MODULE_VERSION=1.9 -DEXPECTED_FOUND_VARAIBLE=TRUE
|
||||
)
|
||||
add_test_variant(ECMFindQmlModuleTest.later_version_found ECMFindQmlModuleTest dummy)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (TARGET Qt5::Quick)
|
||||
set(ECMQmlModuleTest.static_full_qt5_EXTRA_OPTIONS
|
||||
--build-target install
|
||||
--build-options -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_CURRENT_BINARY_DIR}/ECMQmlModuleTest/static_full_qt5/install
|
||||
-DBUILD_SHARED_LIBS=OFF
|
||||
-DQT_MAJOR_VERSION=5
|
||||
)
|
||||
add_test_variant(ECMQmlModuleTest.static_full_qt5 ECMQmlModuleTest
|
||||
${CMAKE_COMMAND} -P "${CMAKE_CURRENT_BINARY_DIR}/ECMQmlModuleTest/static_full_qt5/check.cmake"
|
||||
)
|
||||
|
||||
set(ECMQmlModuleTest.shared_full_qt5_EXTRA_OPTIONS
|
||||
--build-target install
|
||||
--build-options -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_CURRENT_BINARY_DIR}/ECMQmlModuleTest/shared_full_qt5/install
|
||||
-DBUILD_SHARED_LIBS=ON
|
||||
-DQT_MAJOR_VERSION=5
|
||||
)
|
||||
add_test_variant(ECMQmlModuleTest.shared_full_qt5 ECMQmlModuleTest
|
||||
${CMAKE_COMMAND} -P "${CMAKE_CURRENT_BINARY_DIR}/ECMQmlModuleTest/shared_full_qt5/check.cmake"
|
||||
)
|
||||
|
||||
set(ECMQmlModuleTest.static_qmlonly_qt5_EXTRA_OPTIONS
|
||||
--build-target install
|
||||
--build-options -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_CURRENT_BINARY_DIR}/ECMQmlModuleTest/static_qmlonly_qt5/install
|
||||
-DBUILD_SHARED_LIBS=OFF
|
||||
-DQML_ONLY=ON
|
||||
-DQT_MAJOR_VERSION=5
|
||||
)
|
||||
add_test_variant(ECMQmlModuleTest.static_qmlonly_qt5 ECMQmlModuleTest
|
||||
${CMAKE_COMMAND} -P "${CMAKE_CURRENT_BINARY_DIR}/ECMQmlModuleTest/static_qmlonly_qt5/check.cmake"
|
||||
)
|
||||
|
||||
set(ECMQmlModuleTest.shared_qmlonly_qt5_EXTRA_OPTIONS
|
||||
--build-target install
|
||||
--build-options -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_CURRENT_BINARY_DIR}/ECMQmlModuleTest/shared_qmlonly_qt5/install
|
||||
-DBUILD_SHARED_LIBS=ON
|
||||
-DQML_ONLY=ON
|
||||
-DQT_MAJOR_VERSION=5
|
||||
)
|
||||
add_test_variant(ECMQmlModuleTest.shared_qmlonly_qt5 ECMQmlModuleTest
|
||||
${CMAKE_COMMAND} -P "${CMAKE_CURRENT_BINARY_DIR}/ECMQmlModuleTest/shared_qmlonly_qt5/check.cmake"
|
||||
)
|
||||
|
||||
set(ECMQmlModuleTest.shared_depends_qt5_EXTRA_OPTIONS
|
||||
--build-target install
|
||||
--build-options -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_CURRENT_BINARY_DIR}/ECMQmlModuleTest/shared_depends_qt5/install
|
||||
-DBUILD_SHARED_LIBS=ON
|
||||
-DDEPENDS=ON
|
||||
-DQT_MAJOR_VERSION=5
|
||||
)
|
||||
add_test_variant(ECMQmlModuleTest.shared_depends_qt5 ECMQmlModuleTest
|
||||
${CMAKE_COMMAND} -P "${CMAKE_CURRENT_BINARY_DIR}/ECMQmlModuleTest/shared_depends_qt5/check.cmake"
|
||||
)
|
||||
endif()
|
||||
|
||||
if (TARGET Qt6::Quick)
|
||||
set(ECMQmlModuleTest.static_full_qt6_EXTRA_OPTIONS
|
||||
--build-target install
|
||||
--build-options -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_CURRENT_BINARY_DIR}/ECMQmlModuleTest/static_full_qt6/install
|
||||
-DBUILD_SHARED_LIBS=OFF
|
||||
-DQT_MAJOR_VERSION=6
|
||||
)
|
||||
add_test_variant(ECMQmlModuleTest.static_full_qt6 ECMQmlModuleTest
|
||||
${CMAKE_COMMAND} -P "${CMAKE_CURRENT_BINARY_DIR}/ECMQmlModuleTest/static_full_qt6/check.cmake"
|
||||
)
|
||||
|
||||
set(ECMQmlModuleTest.shared_full_qt6_EXTRA_OPTIONS
|
||||
--build-target install
|
||||
--build-options -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_CURRENT_BINARY_DIR}/ECMQmlModuleTest/shared_full_qt5/install
|
||||
-DBUILD_SHARED_LIBS=ON
|
||||
-DQT_MAJOR_VERSION=6
|
||||
)
|
||||
add_test_variant(ECMQmlModuleTest.shared_full_qt6 ECMQmlModuleTest
|
||||
${CMAKE_COMMAND} -P "${CMAKE_CURRENT_BINARY_DIR}/ECMQmlModuleTest/shared_full_qt6/check.cmake"
|
||||
)
|
||||
|
||||
set(ECMQmlModuleTest.static_qmlonly_qt6_EXTRA_OPTIONS
|
||||
--build-target install
|
||||
--build-options -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_CURRENT_BINARY_DIR}/ECMQmlModuleTest/static_qmlonly_qt6/install
|
||||
-DBUILD_SHARED_LIBS=OFF
|
||||
-DQML_ONLY=ON
|
||||
-DQT_MAJOR_VERSION=6
|
||||
)
|
||||
add_test_variant(ECMQmlModuleTest.static_qmlonly_qt6 ECMQmlModuleTest
|
||||
${CMAKE_COMMAND} -P "${CMAKE_CURRENT_BINARY_DIR}/ECMQmlModuleTest/static_qmlonly_qt6/check.cmake"
|
||||
)
|
||||
|
||||
set(ECMQmlModuleTest.shared_qmlonly_qt6_EXTRA_OPTIONS
|
||||
--build-target install
|
||||
--build-options -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_CURRENT_BINARY_DIR}/ECMQmlModuleTest/shared_qmlonly_qt6/install
|
||||
-DBUILD_SHARED_LIBS=ON
|
||||
-DQML_ONLY=ON
|
||||
-DQT_MAJOR_VERSION=6
|
||||
)
|
||||
add_test_variant(ECMQmlModuleTest.shared_qmlonly_qt6 ECMQmlModuleTest
|
||||
${CMAKE_COMMAND} -P "${CMAKE_CURRENT_BINARY_DIR}/ECMQmlModuleTest/shared_qmlonly_qt6/check.cmake"
|
||||
)
|
||||
|
||||
set(ECMQmlModuleTest.shared_depends_qt6_EXTRA_OPTIONS
|
||||
--build-target install
|
||||
--build-options -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_CURRENT_BINARY_DIR}/ECMQmlModuleTest/shared_depends_qt6/install
|
||||
-DBUILD_SHARED_LIBS=ON
|
||||
-DDEPENDS=ON
|
||||
-DQT_MAJOR_VERSION=6
|
||||
)
|
||||
add_test_variant(ECMQmlModuleTest.shared_depends_qt6 ECMQmlModuleTest
|
||||
${CMAKE_COMMAND} -P "${CMAKE_CURRENT_BINARY_DIR}/ECMQmlModuleTest/shared_depends_qt6/check.cmake"
|
||||
)
|
||||
endif()
|
||||
|
||||
set(ECMConfiguredInstallTest_EXTRA_OPTIONS
|
||||
--build-target install
|
||||
--build-options
|
||||
"-DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_CURRENT_BINARY_DIR}/ECMConfiguredInstallTest/InstallDirectory"
|
||||
)
|
||||
add_test_macro(ECMConfiguredInstallTest
|
||||
${CMAKE_COMMAND} -P "${CMAKE_CURRENT_BINARY_DIR}/ECMConfiguredInstallTest/check_tree.cmake"
|
||||
)
|
||||
|
||||
set(ECMGenerateDBusServiceFileTest_EXTRA_OPTIONS
|
||||
--build-target install
|
||||
--build-options
|
||||
"-DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_CURRENT_BINARY_DIR}/ECMGenerateDBusServiceFileTest/InstallDirectory"
|
||||
)
|
||||
add_test_macro(ECMGenerateDBusServiceFileTest
|
||||
${CMAKE_COMMAND} -P "${CMAKE_CURRENT_BINARY_DIR}/ECMGenerateDBusServiceFileTest/check_tree.cmake"
|
||||
)
|
||||
BIN
Binary file not shown.
|
After Width: | Height: | Size: 4.0 KiB |
BIN
Binary file not shown.
|
After Width: | Height: | Size: 1.8 KiB |
BIN
Binary file not shown.
|
After Width: | Height: | Size: 423 B |
BIN
Binary file not shown.
|
After Width: | Height: | Size: 146 B |
+137
@@ -0,0 +1,137 @@
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
project(ECMAddAppIconTest)
|
||||
|
||||
set(CMAKE_MODULE_PATH
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../modules
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../find-modules
|
||||
)
|
||||
|
||||
include(ECMAddAppIcon)
|
||||
|
||||
if(WIN32)
|
||||
set(icon_extension_to_test "rc")
|
||||
elseif(APPLE)
|
||||
set(icon_extension_to_test "icns")
|
||||
endif()
|
||||
|
||||
#### Test 1: ecm_add_app_icon with only regular icons and no OUTFILE_BASENAME, for sources var ####
|
||||
set(ICONS_1 16-category-name.png 128-category-name.png)
|
||||
ecm_add_app_icon(OUT_1 ICONS ${ICONS_1})
|
||||
|
||||
list(LENGTH OUT_1 out_count)
|
||||
|
||||
if(WIN32 OR APPLE)
|
||||
if(out_count EQUAL 0)
|
||||
message(FATAL_ERROR "ecm_add_app_icon() hasn't produced anything")
|
||||
endif()
|
||||
|
||||
if(NOT OUT_1 MATCHES "OUT_1.${icon_extension_to_test}")
|
||||
message(FATAL_ERROR "ecm_add_app_icon() did not fall back to target name for icon name: ${OUT_1}")
|
||||
endif()
|
||||
else()
|
||||
if(NOT out_count EQUAL 0)
|
||||
message(FATAL_ERROR "ecm_add_app_icon() produced something unexpectedly.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
add_custom_target(t_1 ALL DEPENDS ${OUT_1})
|
||||
list(APPEND OUT "${OUT_1}")
|
||||
|
||||
#### Test 2: ecm_add_app_icon with regular and sidebar icons and OUTFILE_BASENAME set, for sources var ####
|
||||
set(ICONS_2 16-category-name.png 128-category-name.png)
|
||||
set(SIDEBAR_ICONS_2 16-category-name-sidebar.png 128-category-name-sidebar.png)
|
||||
|
||||
ecm_add_app_icon(OUT_2 ICONS ${ICONS_2} SIDEBAR_ICONS ${SIDEBAR_ICONS_2} OUTFILE_BASENAME "SuperBasename")
|
||||
|
||||
list(LENGTH OUT_2 out_count)
|
||||
|
||||
if(WIN32 OR APPLE)
|
||||
if(out_count EQUAL 0)
|
||||
message(FATAL_ERROR "ecm_add_app_icon() hasn't produced anything")
|
||||
endif()
|
||||
|
||||
if(NOT OUT_2 MATCHES "SuperBasename.${icon_extension_to_test}")
|
||||
message(FATAL_ERROR "ecm_add_app_icon() did not respect OUTFILE_BASENAME: ${OUT_2}")
|
||||
endif()
|
||||
else()
|
||||
if(NOT out_count EQUAL 0)
|
||||
message(FATAL_ERROR "ecm_add_app_icon() produced something unexpectedly.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
list(APPEND expected_icons "icon_16x16.png" "icon_128x128.png" "sidebar_16x16.png" "sidebar_32x32.png")
|
||||
foreach(expected_icon ${expected_icons})
|
||||
list(APPEND OUT_2 "${CMAKE_CURRENT_BINARY_DIR}/SuperBasename.iconset/${expected_icon}")
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
add_custom_target(t_2 ALL DEPENDS ${OUT_2})
|
||||
list(APPEND OUT "${OUT_2}")
|
||||
|
||||
#### Test 3: ecm_add_app_icon with only regular icons and no OUTFILE_BASENAME, for target ####
|
||||
set(ICONS_3 16-category-name.png 128-category-name.png)
|
||||
|
||||
add_executable(app_3)
|
||||
target_sources(app_3 PRIVATE main.cpp)
|
||||
|
||||
ecm_add_app_icon(app_3 ICONS ${ICONS_1})
|
||||
|
||||
get_target_property(OUT_3 app_3 SOURCES)
|
||||
list(REMOVE_ITEM OUT_3 main.cpp)
|
||||
list(LENGTH OUT_3 out_count)
|
||||
|
||||
if(WIN32 OR APPLE)
|
||||
if(out_count EQUAL 0)
|
||||
message(FATAL_ERROR "ecm_add_app_icon() hasn't produced anything")
|
||||
endif()
|
||||
|
||||
if(NOT OUT_3 MATCHES "app_3.${icon_extension_to_test}")
|
||||
message(FATAL_ERROR "ecm_add_app_icon() did not fall back to target name for icon name: ${OUT_1}")
|
||||
endif()
|
||||
else()
|
||||
if(NOT out_count EQUAL 0)
|
||||
message(FATAL_ERROR "ecm_add_app_icon() produced something unexpectedly.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
list(APPEND OUT "${OUT_3}")
|
||||
|
||||
#### Test 4: ecm_add_app_icon with regular and sidebar icons and OUTFILE_BASENAME set, for target ####
|
||||
set(ICONS_4 16-category-name.png 128-category-name.png)
|
||||
set(SIDEBAR_ICONS_4 16-category-name-sidebar.png 128-category-name-sidebar.png)
|
||||
|
||||
add_executable(app_4)
|
||||
target_sources(app_4 PRIVATE main.cpp)
|
||||
|
||||
ecm_add_app_icon(app_4 ICONS ${ICONS_4} SIDEBAR_ICONS ${SIDEBAR_ICONS_4} OUTFILE_BASENAME "SuperBasename4")
|
||||
|
||||
get_target_property(OUT_4 app_4 SOURCES)
|
||||
list(REMOVE_ITEM OUT_4 main.cpp)
|
||||
list(LENGTH OUT_4 out_count)
|
||||
|
||||
if(WIN32 OR APPLE)
|
||||
if(out_count EQUAL 0)
|
||||
message(FATAL_ERROR "ecm_add_app_icon() hasn't produced anything")
|
||||
endif()
|
||||
|
||||
if(NOT OUT_4 MATCHES "SuperBasename4.${icon_extension_to_test}")
|
||||
message(FATAL_ERROR "ecm_add_app_icon() did not respect OUTFILE_BASENAME: ${OUT_4}")
|
||||
endif()
|
||||
else()
|
||||
if(NOT out_count EQUAL 0)
|
||||
message(FATAL_ERROR "ecm_add_app_icon() produced something unexpectedly.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
list(APPEND expected_icons "icon_16x16.png" "icon_128x128.png" "sidebar_16x16.png" "sidebar_32x32.png")
|
||||
foreach(expected_icon ${expected_icons})
|
||||
list(APPEND OUT_4 "${CMAKE_CURRENT_BINARY_DIR}/SuperBasename4.iconset/${expected_icon}")
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
list(APPEND OUT "${OUT_4}")
|
||||
|
||||
#### this will be run by CTest ####
|
||||
configure_file(check_files.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/check_files.cmake" @ONLY)
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
set(FILES "@OUT@")
|
||||
|
||||
if(WIN32 OR APPLE)
|
||||
foreach(f ${FILES})
|
||||
if(NOT EXISTS "${f}")
|
||||
message(SEND_ERROR "${f} was not found")
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
@@ -0,0 +1,4 @@
|
||||
int main(int, char**)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
if (QT_MAJOR_VERSION EQUAL "6")
|
||||
set(QT_VERSION_OPT "-DBUILD_WITH_QT6=ON")
|
||||
else()
|
||||
set(QT_VERSION_OPT "-DBUILD_WITH_QT6=OFF")
|
||||
endif()
|
||||
|
||||
macro(add_check NAME)
|
||||
string(REPLACE "." "/" dir "${NAME}")
|
||||
string(REGEX REPLACE "[^.]*\\." "" proj "${NAME}")
|
||||
add_test(
|
||||
NAME ecm_add_tests-${NAME}
|
||||
COMMAND
|
||||
${CMAKE_CTEST_COMMAND}
|
||||
--build-and-test
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/${dir}"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/${dir}"
|
||||
--build-two-config
|
||||
--build-generator ${CMAKE_GENERATOR}
|
||||
--build-makeprogram ${CMAKE_MAKE_PROGRAM}
|
||||
--build-project ${proj}
|
||||
--build-options -DBUILD_TESTING:BOOL=ON ${QT_VERSION_OPT}
|
||||
${${NAME}_EXTRA_OPTIONS}
|
||||
--test-command "${CMAKE_CTEST_COMMAND}"
|
||||
)
|
||||
add_test(
|
||||
NAME ecm_add_tests_did_run-${NAME}
|
||||
COMMAND "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_SOURCE_DIR}/check_files.cmake" ${ARGN}
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${dir}"
|
||||
)
|
||||
set_property(TEST ecm_add_tests_did_run-${NAME}
|
||||
APPEND
|
||||
PROPERTY DEPENDS "ecm_add_tests-${NAME}"
|
||||
)
|
||||
endmacro()
|
||||
|
||||
add_check(single_tests
|
||||
test1.txt
|
||||
test2.txt
|
||||
test3.txt
|
||||
test4.txt
|
||||
test5.txt
|
||||
test6.txt
|
||||
test7_dir/test7.txt
|
||||
)
|
||||
add_check(multi_tests
|
||||
test1.txt
|
||||
test2.txt
|
||||
test3.txt
|
||||
test4.txt
|
||||
test5.txt
|
||||
test6.txt
|
||||
test7.txt
|
||||
test8.txt
|
||||
test9.txt
|
||||
test1011_dir/test10.txt
|
||||
test1011_dir/test11.txt
|
||||
)
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
set(i 0)
|
||||
set(in_file_args FALSE)
|
||||
while (i LESS CMAKE_ARGC)
|
||||
if (in_file_args)
|
||||
if (NOT EXISTS "${CMAKE_ARGV${i}}")
|
||||
message(FATAL_ERROR "${CMAKE_ARGV${i}} does not exist")
|
||||
endif()
|
||||
elseif (CMAKE_ARGV${i} STREQUAL "-P")
|
||||
# skip script name
|
||||
math(EXPR i "${i} + 1")
|
||||
set(in_file_args TRUE)
|
||||
endif()
|
||||
math(EXPR i "${i} + 1")
|
||||
endwhile()
|
||||
|
||||
+196
@@ -0,0 +1,196 @@
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
project(ECMAddTests)
|
||||
|
||||
set(ECM_MODULE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../../modules)
|
||||
set(CMAKE_MODULE_PATH "${ECM_MODULE_DIR}")
|
||||
|
||||
add_library(testhelper STATIC ../testhelper.cpp)
|
||||
target_include_directories(testhelper PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/..")
|
||||
|
||||
# Link to QtCore for WinMain on Windows
|
||||
include(QtVersionOption)
|
||||
find_package(Qt${QT_MAJOR_VERSION}Core REQUIRED)
|
||||
target_link_libraries(testhelper PUBLIC Qt${QT_MAJOR_VERSION}::Core)
|
||||
|
||||
enable_testing()
|
||||
|
||||
include(ECMAddTests)
|
||||
include(../../test_helpers.cmake)
|
||||
|
||||
# clean up to avoid false-positives from check_files.cmake
|
||||
file(REMOVE
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/test1.txt"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/test2.txt"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/test3.txt"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/test4.txt"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/test5.txt"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/test6.txt"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/test7.txt"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/test8.txt"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/test9.txt"
|
||||
)
|
||||
file(REMOVE_RECURSE
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/test1011_dir"
|
||||
)
|
||||
|
||||
set(exp_target_names "test1;test2;test3")
|
||||
set(exp_test_names "test1;test2;test3")
|
||||
ecm_add_tests(
|
||||
test1.cpp
|
||||
test2.cpp
|
||||
test3.cpp
|
||||
LINK_LIBRARIES testhelper
|
||||
TARGET_NAMES_VAR target_names
|
||||
TEST_NAMES_VAR test_names
|
||||
)
|
||||
assert_vars_setequal(target_names exp_target_names)
|
||||
assert_vars_setequal(test_names exp_test_names)
|
||||
# check targets exist
|
||||
get_property(_dummy TARGET test1 PROPERTY TYPE)
|
||||
get_property(_dummy TARGET test2 PROPERTY TYPE)
|
||||
get_property(_dummy TARGET test3 PROPERTY TYPE)
|
||||
# check tests exists
|
||||
get_property(_dummy TEST test1 PROPERTY TIMEOUT)
|
||||
get_property(_dummy TEST test2 PROPERTY TIMEOUT)
|
||||
get_property(_dummy TEST test3 PROPERTY TIMEOUT)
|
||||
get_property(_is_win32 TARGET test1 PROPERTY WIN32_EXECUTABLE)
|
||||
if (_is_win32)
|
||||
message(FATAL_ERROR "test1 is a WIN32 executable when it should not be")
|
||||
endif()
|
||||
get_property(_is_bundle TARGET test1 PROPERTY MACOSX_BUNDLE)
|
||||
if (_is_bundle)
|
||||
message(FATAL_ERROR "test1 is an OS/X bundle when it should not be")
|
||||
endif()
|
||||
get_property(_is_win32 TARGET test2 PROPERTY WIN32_EXECUTABLE)
|
||||
if (_is_win32)
|
||||
message(FATAL_ERROR "test2 is a WIN32 executable when it should not be")
|
||||
endif()
|
||||
get_property(_is_bundle TARGET test2 PROPERTY MACOSX_BUNDLE)
|
||||
if (_is_bundle)
|
||||
message(FATAL_ERROR "test2 is an OS/X bundle when it should not be")
|
||||
endif()
|
||||
|
||||
|
||||
ecm_add_tests(
|
||||
test4.cpp
|
||||
test5.cpp
|
||||
LINK_LIBRARIES testhelper
|
||||
NAME_PREFIX pref_
|
||||
)
|
||||
get_property(_dummy TARGET test4 PROPERTY TYPE)
|
||||
get_property(_dummy TARGET test5 PROPERTY TYPE)
|
||||
get_property(_dummy TEST pref_test4 PROPERTY TIMEOUT)
|
||||
get_property(_dummy TEST pref_test5 PROPERTY TIMEOUT)
|
||||
get_property(_is_win32 TARGET test4 PROPERTY WIN32_EXECUTABLE)
|
||||
if (_is_win32)
|
||||
message(FATAL_ERROR "test4 is a WIN32 executable when it should not be")
|
||||
endif()
|
||||
get_property(_is_bundle TARGET test4 PROPERTY MACOSX_BUNDLE)
|
||||
if (_is_bundle)
|
||||
message(FATAL_ERROR "test4 is an OS/X bundle when it should not be")
|
||||
endif()
|
||||
get_property(_is_win32 TARGET test5 PROPERTY WIN32_EXECUTABLE)
|
||||
if (_is_win32)
|
||||
message(FATAL_ERROR "test5 is a WIN32 executable when it should not be")
|
||||
endif()
|
||||
get_property(_is_bundle TARGET test5 PROPERTY MACOSX_BUNDLE)
|
||||
if (_is_bundle)
|
||||
message(FATAL_ERROR "test5 is an OS/X bundle when it should not be")
|
||||
endif()
|
||||
|
||||
|
||||
ecm_add_tests(
|
||||
test6.cpp
|
||||
test7.cpp
|
||||
LINK_LIBRARIES testhelper
|
||||
GUI
|
||||
)
|
||||
get_property(_dummy TARGET test6 PROPERTY TYPE)
|
||||
get_property(_dummy TARGET test7 PROPERTY TYPE)
|
||||
get_property(_dummy TEST test6 PROPERTY TIMEOUT)
|
||||
get_property(_dummy TEST test7 PROPERTY TIMEOUT)
|
||||
get_property(_is_win32 TARGET test6 PROPERTY WIN32_EXECUTABLE)
|
||||
if (NOT _is_win32)
|
||||
message(FATAL_ERROR "test6 is not a WIN32 executable when it should be")
|
||||
endif()
|
||||
get_property(_is_bundle TARGET test6 PROPERTY MACOSX_BUNDLE)
|
||||
if (NOT _is_bundle)
|
||||
message(FATAL_ERROR "test6 is not an OS/X bundle when it should be")
|
||||
endif()
|
||||
get_property(_is_win32 TARGET test7 PROPERTY WIN32_EXECUTABLE)
|
||||
if (NOT _is_win32)
|
||||
message(FATAL_ERROR "test7 is not a WIN32 executable when it should be")
|
||||
endif()
|
||||
get_property(_is_bundle TARGET test7 PROPERTY MACOSX_BUNDLE)
|
||||
if (NOT _is_bundle)
|
||||
message(FATAL_ERROR "test7 is not an OS/X bundle when it should be")
|
||||
endif()
|
||||
|
||||
|
||||
set(exp_target_names "test8;test9")
|
||||
set(exp_test_names "p_test8;p_test9")
|
||||
ecm_add_tests(
|
||||
test8.cpp
|
||||
test9.cpp
|
||||
LINK_LIBRARIES testhelper
|
||||
NAME_PREFIX p_
|
||||
GUI
|
||||
TARGET_NAMES_VAR target_names
|
||||
TEST_NAMES_VAR test_names
|
||||
)
|
||||
assert_vars_setequal(target_names exp_target_names)
|
||||
assert_vars_setequal(test_names exp_test_names)
|
||||
get_property(_dummy TARGET test8 PROPERTY TYPE)
|
||||
get_property(_dummy TARGET test9 PROPERTY TYPE)
|
||||
get_property(_dummy TEST p_test8 PROPERTY TIMEOUT)
|
||||
get_property(_dummy TEST p_test9 PROPERTY TIMEOUT)
|
||||
get_property(_is_win32 TARGET test8 PROPERTY WIN32_EXECUTABLE)
|
||||
if (NOT _is_win32)
|
||||
message(FATAL_ERROR "test8 is not a WIN32 executable when it should be")
|
||||
endif()
|
||||
get_property(_is_bundle TARGET test8 PROPERTY MACOSX_BUNDLE)
|
||||
if (NOT _is_bundle)
|
||||
message(FATAL_ERROR "test8 is not an OS/X bundle when it should be")
|
||||
endif()
|
||||
get_property(_is_win32 TARGET test9 PROPERTY WIN32_EXECUTABLE)
|
||||
if (NOT _is_win32)
|
||||
message(FATAL_ERROR "test9 is not a WIN32 executable when it should be")
|
||||
endif()
|
||||
get_property(_is_bundle TARGET test9 PROPERTY MACOSX_BUNDLE)
|
||||
if (NOT _is_bundle)
|
||||
message(FATAL_ERROR "test9 is not an OS/X bundle when it should be")
|
||||
endif()
|
||||
|
||||
|
||||
set(exp_workingdir "${CMAKE_CURRENT_BINARY_DIR}/test1011_dir")
|
||||
file(MAKE_DIRECTORY "${exp_workingdir}") # cmake does not create that for us, will complain otherwise
|
||||
ecm_add_tests(
|
||||
test10.cpp
|
||||
test11.cpp
|
||||
LINK_LIBRARIES testhelper
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/test1011_dir"
|
||||
)
|
||||
get_property(_dummy TARGET test10 PROPERTY TYPE)
|
||||
get_property(_dummy TARGET test11 PROPERTY TYPE)
|
||||
get_property(_dummy TEST test10 PROPERTY TIMEOUT)
|
||||
get_property(_dummy TEST test11 PROPERTY TIMEOUT)
|
||||
get_property(_working_dir TEST test10 PROPERTY WORKING_DIRECTORY)
|
||||
assert_vars_setequal(_working_dir exp_workingdir)
|
||||
get_property(_working_dir TEST test11 PROPERTY WORKING_DIRECTORY)
|
||||
assert_vars_setequal(_working_dir exp_workingdir)
|
||||
get_property(_is_win32 TARGET test10 PROPERTY WIN32_EXECUTABLE)
|
||||
if (_is_win32)
|
||||
message(FATAL_ERROR "test10 is a WIN32 executable when it should not be")
|
||||
endif()
|
||||
get_property(_is_bundle TARGET test10 PROPERTY MACOSX_BUNDLE)
|
||||
if (_is_bundle)
|
||||
message(FATAL_ERROR "test10 is an OS/X bundle when it should not be")
|
||||
endif()
|
||||
get_property(_is_win32 TARGET test11 PROPERTY WIN32_EXECUTABLE)
|
||||
if (_is_win32)
|
||||
message(FATAL_ERROR "test11 is a WIN32 executable when it should not be")
|
||||
endif()
|
||||
get_property(_is_bundle TARGET test11 PROPERTY MACOSX_BUNDLE)
|
||||
if (_is_bundle)
|
||||
message(FATAL_ERROR "test11 is an OS/X bundle when it should not be")
|
||||
endif()
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
#include "testhelper.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
make_test_file("test1.txt");
|
||||
return 0;
|
||||
}
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
#include "testhelper.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
make_test_file("test10.txt");
|
||||
return 0;
|
||||
}
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
#include "testhelper.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
make_test_file("test11.txt");
|
||||
return 0;
|
||||
}
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
#include "testhelper.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
make_test_file("test2.txt");
|
||||
return 0;
|
||||
}
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
#include "testhelper.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
make_test_file("test3.txt");
|
||||
return 0;
|
||||
}
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
#include "testhelper.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
make_test_file("test4.txt");
|
||||
return 0;
|
||||
}
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
#include "testhelper.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
make_test_file("test5.txt");
|
||||
return 0;
|
||||
}
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
#include "testhelper.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
make_test_file("test6.txt");
|
||||
return 0;
|
||||
}
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
#include "testhelper.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
make_test_file("test7.txt");
|
||||
return 0;
|
||||
}
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
#include "testhelper.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
make_test_file("test8.txt");
|
||||
return 0;
|
||||
}
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
#include "testhelper.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
make_test_file("test9.txt");
|
||||
return 0;
|
||||
}
|
||||
|
||||
+149
@@ -0,0 +1,149 @@
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
project(ECMAddTests)
|
||||
|
||||
set(ECM_MODULE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../../modules)
|
||||
set(CMAKE_MODULE_PATH "${ECM_MODULE_DIR}")
|
||||
|
||||
add_library(testhelper STATIC ../testhelper.cpp)
|
||||
target_include_directories(testhelper PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/..")
|
||||
|
||||
# Link to QtCore for WinMain on Windows
|
||||
include(QtVersionOption)
|
||||
find_package(Qt${QT_MAJOR_VERSION}Core REQUIRED)
|
||||
target_link_libraries(testhelper PUBLIC Qt${QT_MAJOR_VERSION}::Core)
|
||||
|
||||
enable_testing()
|
||||
|
||||
include(ECMAddTests)
|
||||
include(../../test_helpers.cmake)
|
||||
|
||||
# clean up to avoid false-positives from check_files.cmake
|
||||
file(REMOVE
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/test1.txt"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/test2.txt"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/test3.txt"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/test4.txt"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/test5.txt"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/test6.txt"
|
||||
)
|
||||
file(REMOVE_RECURSE
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/test7_dir"
|
||||
)
|
||||
|
||||
ecm_add_test(test1.cpp
|
||||
LINK_LIBRARIES testhelper
|
||||
)
|
||||
# check target exists
|
||||
get_property(_dummy TARGET test1 PROPERTY TYPE)
|
||||
# check test exists
|
||||
get_property(_dummy TEST test1 PROPERTY TIMEOUT)
|
||||
get_property(_is_win32 TARGET test1 PROPERTY WIN32_EXECUTABLE)
|
||||
if (_is_win32)
|
||||
message(FATAL_ERROR "test1 is a WIN32 executable when it should not be")
|
||||
endif()
|
||||
get_property(_is_bundle TARGET test1 PROPERTY MACOSX_BUNDLE)
|
||||
if (_is_bundle)
|
||||
message(FATAL_ERROR "test1 is an OS/X bundle when it should not be")
|
||||
endif()
|
||||
|
||||
|
||||
ecm_add_test(test2.cpp
|
||||
LINK_LIBRARIES testhelper
|
||||
TEST_NAME named_test
|
||||
)
|
||||
get_property(_dummy TARGET named_test PROPERTY TYPE)
|
||||
get_property(_dummy TEST named_test PROPERTY TIMEOUT)
|
||||
get_property(_is_win32 TARGET named_test PROPERTY WIN32_EXECUTABLE)
|
||||
if (_is_win32)
|
||||
message(FATAL_ERROR "named_test is a WIN32 executable when it should not be")
|
||||
endif()
|
||||
get_property(_is_bundle TARGET named_test PROPERTY MACOSX_BUNDLE)
|
||||
if (_is_bundle)
|
||||
message(FATAL_ERROR "named_test is an OS/X bundle when it should not be")
|
||||
endif()
|
||||
|
||||
|
||||
ecm_add_test(test3.cpp
|
||||
LINK_LIBRARIES testhelper
|
||||
NAME_PREFIX prefix_
|
||||
)
|
||||
get_property(_dummy TARGET test3 PROPERTY TYPE)
|
||||
get_property(_dummy TEST prefix_test3 PROPERTY TIMEOUT)
|
||||
get_property(_is_win32 TARGET test3 PROPERTY WIN32_EXECUTABLE)
|
||||
if (_is_win32)
|
||||
message(FATAL_ERROR "test3 is a WIN32 executable when it should not be")
|
||||
endif()
|
||||
get_property(_is_bundle TARGET test3 PROPERTY MACOSX_BUNDLE)
|
||||
if (_is_bundle)
|
||||
message(FATAL_ERROR "test3 is an OS/X bundle when it should not be")
|
||||
endif()
|
||||
|
||||
|
||||
ecm_add_test(test4.cpp
|
||||
LINK_LIBRARIES testhelper
|
||||
GUI
|
||||
)
|
||||
get_property(_dummy TARGET test4 PROPERTY TYPE)
|
||||
get_property(_dummy TEST test4 PROPERTY TIMEOUT)
|
||||
get_property(_is_win32 TARGET test4 PROPERTY WIN32_EXECUTABLE)
|
||||
if (NOT _is_win32)
|
||||
message(FATAL_ERROR "test4 is not a WIN32 executable when it should be")
|
||||
endif()
|
||||
get_property(_is_bundle TARGET test4 PROPERTY MACOSX_BUNDLE)
|
||||
if (NOT _is_bundle)
|
||||
message(FATAL_ERROR "test4 is not an OS/X bundle when it should be")
|
||||
endif()
|
||||
|
||||
|
||||
ecm_add_test(test5.cpp
|
||||
LINK_LIBRARIES testhelper
|
||||
TEST_NAME combined_test
|
||||
NAME_PREFIX another_prefix_
|
||||
GUI
|
||||
)
|
||||
get_property(_dummy TARGET combined_test PROPERTY TYPE)
|
||||
get_property(_dummy TEST another_prefix_combined_test PROPERTY TIMEOUT)
|
||||
get_property(_is_win32 TARGET combined_test PROPERTY WIN32_EXECUTABLE)
|
||||
if (NOT _is_win32)
|
||||
message(FATAL_ERROR "combined_test is not a WIN32 executable when it should be")
|
||||
endif()
|
||||
get_property(_is_bundle TARGET combined_test PROPERTY MACOSX_BUNDLE)
|
||||
if (NOT _is_bundle)
|
||||
message(FATAL_ERROR "combined_test is not an OS/X bundle when it should be")
|
||||
endif()
|
||||
|
||||
|
||||
ecm_add_test(test6.cpp test6body.cpp
|
||||
LINK_LIBRARIES testhelper
|
||||
TEST_NAME multifile_test
|
||||
)
|
||||
get_property(_dummy TARGET multifile_test PROPERTY TYPE)
|
||||
get_property(_dummy TEST multifile_test PROPERTY TIMEOUT)
|
||||
get_property(_is_win32 TARGET multifile_test PROPERTY WIN32_EXECUTABLE)
|
||||
if (_is_win32)
|
||||
message(FATAL_ERROR "multifile_test is a WIN32 executable when it should not be")
|
||||
endif()
|
||||
get_property(_is_bundle TARGET multifile_test PROPERTY MACOSX_BUNDLE)
|
||||
if (_is_bundle)
|
||||
message(FATAL_ERROR "multifile_test is an OS/X bundle when it should not be")
|
||||
endif()
|
||||
|
||||
|
||||
set(exp_workingdir "${CMAKE_CURRENT_BINARY_DIR}/test7_dir")
|
||||
file(MAKE_DIRECTORY "${exp_workingdir}") # cmake does not create that for us, will complain otherwise
|
||||
ecm_add_test(test7.cpp
|
||||
LINK_LIBRARIES testhelper
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/test7_dir"
|
||||
)
|
||||
get_property(_dummy TARGET test7 PROPERTY TYPE)
|
||||
get_property(_dummy TEST test7 PROPERTY TIMEOUT)
|
||||
get_property(_working_dir TEST test7 PROPERTY WORKING_DIRECTORY)
|
||||
assert_vars_setequal(_working_dir exp_workingdir)
|
||||
get_property(_is_win32 TARGET test7 PROPERTY WIN32_EXECUTABLE)
|
||||
if (_is_win32)
|
||||
message(FATAL_ERROR "test7 is a WIN32 executable when it should not be")
|
||||
endif()
|
||||
get_property(_is_bundle TARGET test7 PROPERTY MACOSX_BUNDLE)
|
||||
if (_is_bundle)
|
||||
message(FATAL_ERROR "test7 is an OS/X bundle when it should not be")
|
||||
endif()
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
#include "testhelper.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
make_test_file("test1.txt");
|
||||
return 0;
|
||||
}
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
#include "testhelper.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
make_test_file("test2.txt");
|
||||
return 0;
|
||||
}
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
#include "testhelper.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
make_test_file("test3.txt");
|
||||
return 0;
|
||||
}
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
#include "testhelper.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
make_test_file("test4.txt");
|
||||
return 0;
|
||||
}
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
#include "testhelper.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
make_test_file("test5.txt");
|
||||
return 0;
|
||||
}
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
void test_body();
|
||||
|
||||
int main()
|
||||
{
|
||||
test_body();
|
||||
return 0;
|
||||
}
|
||||
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
#include "testhelper.h"
|
||||
|
||||
void test_body()
|
||||
{
|
||||
make_test_file("test6.txt");
|
||||
}
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
#include "testhelper.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
make_test_file("test7.txt");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
#include "testhelper.h"
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
|
||||
void make_test_file(const char *filename)
|
||||
{
|
||||
std::ofstream(filename) << "test" << std::endl;
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
void make_test_file(const char *filename);
|
||||
+92
@@ -0,0 +1,92 @@
|
||||
set(ECM_MODULE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../modules)
|
||||
set(CMAKE_MODULE_PATH
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../modules
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../find-modules
|
||||
)
|
||||
|
||||
include(ECMCheckOutboundLicense)
|
||||
|
||||
# check relative and absolute input paths
|
||||
ecm_check_outbound_license(
|
||||
LICENSES LGPL-2.1-only
|
||||
TEST_NAME absolute-path-handling
|
||||
FILES
|
||||
testdata/BSD-2-Clause.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/testdata/LGPL-2.1-or-later.cpp
|
||||
)
|
||||
|
||||
# check test case generation without TEST_NAME statement
|
||||
ecm_check_outbound_license(
|
||||
LICENSES LGPL-2.1-only
|
||||
FILES
|
||||
testdata/BSD-2-Clause.cpp
|
||||
)
|
||||
|
||||
# check multi license case
|
||||
ecm_check_outbound_license(
|
||||
LICENSES LGPL-2.1-only GPL-3.0-only
|
||||
TEST_NAME multiple-licenses
|
||||
FILES
|
||||
testdata/BSD-2-Clause.cpp
|
||||
)
|
||||
|
||||
|
||||
# check for valid LGPL-2.1-only
|
||||
ecm_check_outbound_license(
|
||||
LICENSES LGPL-2.1-only
|
||||
TEST_NAME valid-LGPL-2.1-only
|
||||
FILES
|
||||
testdata/BSD-2-Clause.cpp
|
||||
testdata/LGPL-2.1-or-later.cpp
|
||||
)
|
||||
|
||||
# check for valid LGPL-3.0-only
|
||||
ecm_check_outbound_license(
|
||||
LICENSES LGPL-3.0-only
|
||||
TEST_NAME valid-LGPL-3.0-only
|
||||
FILES
|
||||
testdata/BSD-2-Clause.cpp
|
||||
testdata/LGPL-2.1-or-later.cpp
|
||||
testdata/LGPL-3.0-only.cpp
|
||||
)
|
||||
|
||||
# check for valid GPL-2.0-only
|
||||
ecm_check_outbound_license(
|
||||
LICENSES GPL-2.0-only
|
||||
TEST_NAME valid-GPL-2.0-only
|
||||
FILES
|
||||
testdata/BSD-2-Clause.cpp
|
||||
testdata/LGPL-2.1-or-later.cpp
|
||||
testdata/GPL-2.0-only.cpp
|
||||
)
|
||||
|
||||
# check for valid GPL-3.0-only
|
||||
ecm_check_outbound_license(
|
||||
LICENSES GPL-3.0-only
|
||||
TEST_NAME valid-GPL-3.0-only
|
||||
FILES
|
||||
testdata/BSD-2-Clause.cpp
|
||||
testdata/LGPL-2.1-or-later.cpp
|
||||
testdata/LGPL-3.0-only.cpp
|
||||
testdata/GPL-3.0-only.cpp
|
||||
)
|
||||
|
||||
# check for invalid GPL-3.0-only
|
||||
ecm_check_outbound_license(
|
||||
LICENSES LGPL-2.1-only
|
||||
TEST_NAME invalid-LGPL-2.1-only
|
||||
FILES
|
||||
testdata/LGPL-2.0-only.cpp
|
||||
testdata/GPL-3.0-only.cpp
|
||||
WILL_FAIL
|
||||
)
|
||||
|
||||
# check for invalid GPL-3.0-only
|
||||
ecm_check_outbound_license(
|
||||
LICENSES GPL-3.0-only
|
||||
TEST_NAME invalid-GPL-3.0-only
|
||||
FILES
|
||||
testdata/GPL-2.0-only.cpp
|
||||
testdata/GPL-3.0-only.cpp
|
||||
WILL_FAIL
|
||||
)
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
/*
|
||||
SPDX-FileCopyrightText: 2020 Jane Doe <nomail@example.com>
|
||||
SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
// nothing in here, it is only a test
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
/*
|
||||
SPDX-FileCopyrightText: 2020 John Doe <nomail@example.com>
|
||||
SPDX-License-Identifier: GPL-2.0-only
|
||||
*/
|
||||
|
||||
// nothing in here, it is only a test
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
/*
|
||||
SPDX-FileCopyrightText: 2020 John Doe <nomail@example.com>
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
// nothing in here, it is only a test
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
/*
|
||||
SPDX-FileCopyrightText: 2020 John Doe <nomail@example.com>
|
||||
SPDX-License-Identifier: GPL-3.0-only
|
||||
*/
|
||||
|
||||
// nothing in here, it is only a test
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
/*
|
||||
SPDX-FileCopyrightText: 2020 John Doe <nomail@example.com>
|
||||
SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*/
|
||||
|
||||
// nothing in here, it is only a test
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
/*
|
||||
SPDX-FileCopyrightText: 2020 Jane Doe <nomail@example.com>
|
||||
SPDX-License-Identifier: LGPL-3.0-only
|
||||
*/
|
||||
|
||||
// nothing in here, it is only a test
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
project(ECMConfiguredInstallTest)
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../modules)
|
||||
|
||||
# make sure the test install dir is clean
|
||||
file(REMOVE_RECURSE "${CMAKE_INSTALL_PREFIX}")
|
||||
include(ECMConfiguredInstall)
|
||||
|
||||
# run test
|
||||
|
||||
set(FOO myFoo)
|
||||
set(BAR myBar)
|
||||
|
||||
ecm_install_configured_files(INPUT configured.txt DESTINATION ${CMAKE_INSTALL_PREFIX}/test)
|
||||
|
||||
ecm_install_configured_files(INPUT configured_atOnly.txt.in DESTINATION ${CMAKE_INSTALL_PREFIX}/test @ONLY ESCAPE_QUOTES)
|
||||
|
||||
ecm_install_configured_files(INPUT multi1.txt.in ${CMAKE_CURRENT_SOURCE_DIR}/multi2.txt.in DESTINATION ${CMAKE_INSTALL_PREFIX}/test)
|
||||
|
||||
# this will be run by CTest
|
||||
configure_file(check_tree.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/check_tree.cmake" @ONLY)
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
set(EXPECTED "@CMAKE_CURRENT_SOURCE_DIR@/expected")
|
||||
set(ACTUAL "@CMAKE_INSTALL_PREFIX@")
|
||||
|
||||
# Compares files in two directories, emits a fatal error if the top level files are different
|
||||
# Takes a directory of expected files, and a directory of output files
|
||||
function(compare_dirs expected output )
|
||||
file(GLOB files "${expected}/*")
|
||||
foreach(file ${files})
|
||||
get_filename_component(name ${file} NAME)
|
||||
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E compare_files ${file} "${output}/${name}"
|
||||
RESULT_VARIABLE test_result
|
||||
)
|
||||
If (NOT test_result EQUAL 0)
|
||||
message(FATAL_ERROR "Test failed: ${file} doesn't match ${output}/${name}!")
|
||||
endif()
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
compare_dirs(${EXPECTED} ${ACTUAL}/test )
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
[General]
|
||||
Foo=@FOO@
|
||||
Bar=${BAR}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
[General]
|
||||
Foo=@FOO@
|
||||
Bar=${BAR}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
[General]
|
||||
Foo=myFoo
|
||||
Bar=myBar
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
[General]
|
||||
Foo=myFoo
|
||||
Bar=${BAR}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
TestMulti1
|
||||
Foo=myFoo
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
TestMulti2
|
||||
Foo=myFoo
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
TestMulti1
|
||||
Foo=@FOO@
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
TestMulti2
|
||||
Foo=@FOO@
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
project(extra-cmake-modules)
|
||||
|
||||
set(ECM_FIND_MODULE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../find-modules)
|
||||
set(ECM_MODULE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../modules)
|
||||
set(CMAKE_MODULE_PATH "${ECM_FIND_MODULE_DIR}" "${ECM_MODULE_DIR}")
|
||||
|
||||
set(KDE_INSTALL_FULL_QMLDIR ${CMAKE_CURRENT_SOURCE_DIR}/qmlinstall)
|
||||
|
||||
include(QtVersionOption)
|
||||
include(ECMFindQmlModule)
|
||||
|
||||
ecm_find_qmlmodule(${QML_MODULE_NAME} ${QML_MODULE_VERSION} ${QML_MODULE_FIND_ARGS})
|
||||
|
||||
if (EXPECTED_FOUND_VARAIBLE AND NOT org.kde.ecmtest-QMLModule_FOUND)
|
||||
message(WARNING "org.kde.ecmtest-QMLModule_FOUND: ${org.kde.ecmtest-QMLModule_FOUND}")
|
||||
message(FATAL_ERROR "Expected \"${QML_MODULE_NAME} ${QML_MODULE_VERSION} ${QML_MODULE_FIND_ARGS}\" to be found, but it is not found")
|
||||
endif()
|
||||
if (NOT EXPECTED_FOUND_VARAIBLE AND org.kde.ecmtest-QMLModule_FOUND)
|
||||
message(WARNING "org.kde.ecmtest-QMLModule_FOUND: ${org.kde.ecmtest-QMLModule_FOUND}")
|
||||
message(FATAL_ERROR "Expected \"${QML_MODULE_NAME} ${QML_MODULE_VERSION} ${QML_MODULE_FIND_ARGS}\" to be not found, but it is found")
|
||||
endif()
|
||||
|
||||
if (QT_MAJOR_VERSION STREQUAL 6 AND org.kde.ecmtest-QMLModule_FOUND AND NOT "${org.kde.ecmtest-QMLModule_VERSION}" STREQUAL "2.0")
|
||||
message(FATAL_ERROR "Did not find correct version from qmldir")
|
||||
endif()
|
||||
|
||||
add_executable(dummy main.c)
|
||||
@@ -0,0 +1,4 @@
|
||||
int main()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
module org.kde.ecmtest
|
||||
Dummy 2.0 Dummy.qml
|
||||
# KDE-qmldir-Version: 2.0
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
project(ECMGenerateDBusServiceFileTest)
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../modules)
|
||||
|
||||
# make sure the test install dir is clean
|
||||
file(REMOVE_RECURSE "${CMAKE_INSTALL_PREFIX}")
|
||||
include(ECMGenerateDBusServiceFile)
|
||||
|
||||
# run test
|
||||
|
||||
ecm_generate_dbus_service_file(
|
||||
NAME org.kde.kded5
|
||||
EXECUTABLE /usr/bin/kded5
|
||||
DESTINATION ${CMAKE_INSTALL_PREFIX}/test
|
||||
)
|
||||
|
||||
ecm_generate_dbus_service_file(
|
||||
NAME org.kde.kded5.withSystemD
|
||||
EXECUTABLE /usr/bin/kded5
|
||||
SYSTEMD_SERVICE plasma-kded.service
|
||||
DESTINATION ${CMAKE_INSTALL_PREFIX}/test
|
||||
RENAME org.kde.kded5.withSystemD.renamed.service
|
||||
)
|
||||
|
||||
# this will be run by CTest
|
||||
configure_file(check_tree.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/check_tree.cmake" @ONLY)
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
if (WIN32)
|
||||
set(EXPECTED "@CMAKE_CURRENT_SOURCE_DIR@/windowsexpected")
|
||||
else ()
|
||||
set(EXPECTED "@CMAKE_CURRENT_SOURCE_DIR@/expected")
|
||||
endif (WIN32)
|
||||
|
||||
set(ACTUAL "@CMAKE_INSTALL_PREFIX@")
|
||||
|
||||
# Compares files in two directories, emits a fatal error if the top level files are different
|
||||
# Takes a directory of expected files, and a directory of output files
|
||||
function(compare_dirs expected output )
|
||||
file(GLOB files "${expected}/*")
|
||||
foreach(file ${files})
|
||||
get_filename_component(name ${file} NAME)
|
||||
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E compare_files ${file} "${output}/${name}"
|
||||
RESULT_VARIABLE test_result
|
||||
)
|
||||
If (NOT test_result EQUAL 0)
|
||||
message(FATAL_ERROR "Test failed: ${file} doesn't match ${output}/${name}!")
|
||||
endif()
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
compare_dirs(${EXPECTED} ${ACTUAL}/test )
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
[D-BUS Service]
|
||||
Name=org.kde.kded5
|
||||
Exec=/usr/bin/kded5
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
[D-BUS Service]
|
||||
Name=org.kde.kded5.withSystemD
|
||||
Exec=/usr/bin/kded5
|
||||
SystemdService=plasma-kded.service
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
[D-BUS Service]
|
||||
Name=org.kde.kded5
|
||||
Exec=kded5
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
[D-BUS Service]
|
||||
Name=org.kde.kded5.withSystemD
|
||||
Exec=kded5
|
||||
SystemdService=plasma-kded.service
|
||||
+122
@@ -0,0 +1,122 @@
|
||||
set(installation_path "${CMAKE_CURRENT_BINARY_DIR}/installation/")
|
||||
|
||||
macro(add_generate_export_header_library_test _exclude_deprecated_before_and_at)
|
||||
if("${ARGV1}" STREQUAL "WITH_GROUP")
|
||||
set(_set_group_option "-DSET_GROUP=TRUE")
|
||||
set(_library_buildname "library-${_exclude_deprecated_before_and_at}-group")
|
||||
else()
|
||||
set(_library_buildname "library-${_exclude_deprecated_before_and_at}")
|
||||
endif()
|
||||
add_test(NAME ecm_generate_export_header-build-${_library_buildname}
|
||||
COMMAND ${CMAKE_CTEST_COMMAND}
|
||||
--build-and-test
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/library"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/${_library_buildname}"
|
||||
--build-two-config
|
||||
--build-generator "${CMAKE_GENERATOR}"
|
||||
--build-makeprogram ${CMAKE_MAKE_PROGRAM}
|
||||
--build-project library
|
||||
--build-target install
|
||||
--build-options
|
||||
"-DEXCLUDE_DEPRECATED_BEFORE_AND_AT=${_exclude_deprecated_before_and_at}"
|
||||
"-DCMAKE_INSTALL_PREFIX:PATH=${installation_path}/${_library_buildname}"
|
||||
${_set_group_option}
|
||||
--test-command dummy
|
||||
)
|
||||
endmacro()
|
||||
|
||||
macro(add_generate_export_header_consumer_test _test_variant _exclude_deprecated_before_and_at _group_test_mode _consumer_build)
|
||||
set(_extra_build_options ${ARGN})
|
||||
if(_group_test_mode STREQUAL "GROUPLESS")
|
||||
set(_library "library-${_exclude_deprecated_before_and_at}")
|
||||
else()
|
||||
set(_library "library-${_exclude_deprecated_before_and_at}-group")
|
||||
endif()
|
||||
add_test(NAME ecm_generate_export_header-${_consumer_build}
|
||||
COMMAND ${CMAKE_CTEST_COMMAND}
|
||||
--build-and-test
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/consumer"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/${_consumer_build}"
|
||||
--build-two-config
|
||||
--build-generator "${CMAKE_GENERATOR}"
|
||||
--build-makeprogram ${CMAKE_MAKE_PROGRAM}
|
||||
--build-project consumer
|
||||
--build-options
|
||||
"-DTEST_VARIANT:STRING=${_test_variant}"
|
||||
"-DDEPRECATED_EXCLUDED_BEFORE_AND_AT:STRING=${_exclude_deprecated_before_and_at}"
|
||||
"-DLIBRARY:STRING=${_library}"
|
||||
"-DGROUP_MODE:STRING=${_group_test_mode}"
|
||||
${_extra_build_options}
|
||||
--test-command dummy
|
||||
)
|
||||
set_tests_properties(ecm_generate_export_header-${_consumer_build}
|
||||
PROPERTIES DEPENDS "ecm_generate_export_header-build-${_library}")
|
||||
endmacro()
|
||||
|
||||
macro(add_generate_export_header_consumer_disable_deprecated_before_and_at_test
|
||||
_disable_deprecated_before_and_at
|
||||
_exclude_deprecated_before_and_at
|
||||
_group_test_mode
|
||||
)
|
||||
set(_consumer_build "consumer-${_disable_deprecated_before_and_at}-${_exclude_deprecated_before_and_at}-${_group_test_mode}")
|
||||
set(_extra_build_options
|
||||
"-DLIBRARY_DISABLE_DEPRECATED_BEFORE_AND_AT:STRING=${_disable_deprecated_before_and_at}"
|
||||
)
|
||||
add_generate_export_header_consumer_test(DISABLE_DEPRECATED_BEFORE_AND_AT
|
||||
${_exclude_deprecated_before_and_at}
|
||||
${_group_test_mode}
|
||||
${_consumer_build}
|
||||
${_extra_build_options}
|
||||
)
|
||||
endmacro()
|
||||
|
||||
macro(add_generate_export_header_consumer_no_deprecated_test _exclude_deprecated_before_and_at _group_test_mode)
|
||||
set(_consumer_build "consumer-NO-DEPRECATED-${_exclude_deprecated_before_and_at}-${_group_test_mode}")
|
||||
add_generate_export_header_consumer_test(NO_DEPRECATED
|
||||
${_exclude_deprecated_before_and_at}
|
||||
${_group_test_mode}
|
||||
${_consumer_build}
|
||||
)
|
||||
endmacro()
|
||||
|
||||
# prepare list of versions
|
||||
set(library_versions 0 2.0.0 CURRENT)
|
||||
list(LENGTH library_versions library_versions_count)
|
||||
math(EXPR _last_index ${library_versions_count}-1)
|
||||
|
||||
# test generating the library with different EXCLUDE_DEPRECATED_BEFORE_AND_AT values
|
||||
# also install the generated libraries together incl. exported cmake targets, for use in tests below
|
||||
# TODO: wariant with DEPRECATED_BASE_VERSION
|
||||
foreach(_group_arg "" "WITH_GROUP")
|
||||
foreach(_index RANGE ${_last_index})
|
||||
list(GET library_versions ${_index} _exclude_deprecated_before_and_at)
|
||||
add_generate_export_header_library_test(${_exclude_deprecated_before_and_at} ${_group_arg})
|
||||
endforeach()
|
||||
endforeach()
|
||||
|
||||
|
||||
set(group_test_modes "GROUPLESS" "GROUP_USE_DIRECT" "GROUP_USE_GROUP")
|
||||
|
||||
# test using the library, built with different EXCLUDE_DEPRECATED_BEFORE_AND_AT values,
|
||||
# while using different DISABLE_DEPRECATED_BEFORE_AND_AT values
|
||||
# TODO: test DEPRECATED_WARNINGS_SINCE
|
||||
foreach(_group_test_mode ${group_test_modes})
|
||||
foreach(_exclude_index RANGE ${_last_index})
|
||||
list(GET library_versions ${_exclude_index} _exclude_deprecated_before_and_at)
|
||||
# using disabled API limit below the excluded API limit is not supported and
|
||||
# caught by the code generated from the ecm_generate_export_header,
|
||||
# so testing those combination will not work, so start from the excluded API limit
|
||||
foreach(_disable_index RANGE ${_exclude_index} ${_last_index})
|
||||
list(GET library_versions ${_disable_index} _disable_deprecated_before_and_at)
|
||||
add_generate_export_header_consumer_disable_deprecated_before_and_at_test(${_disable_deprecated_before_and_at} ${_exclude_deprecated_before_and_at} ${_group_test_mode})
|
||||
endforeach()
|
||||
endforeach()
|
||||
endforeach()
|
||||
|
||||
# test with NO_DEPRECATED
|
||||
foreach(_group_test_mode ${group_test_modes})
|
||||
foreach(_exclude_index RANGE ${_last_index})
|
||||
list(GET library_versions ${_exclude_index} _exclude_deprecated_before_and_at)
|
||||
add_generate_export_header_consumer_no_deprecated_test(${_exclude_deprecated_before_and_at} ${_group_test_mode})
|
||||
endforeach()
|
||||
endforeach()
|
||||
+68
@@ -0,0 +1,68 @@
|
||||
cmake_minimum_required(VERSION 3.0.0)
|
||||
|
||||
project(consumer)
|
||||
|
||||
include(CheckCXXSourceCompiles)
|
||||
|
||||
include(../../test_helpers.cmake)
|
||||
|
||||
include("${CMAKE_CURRENT_BINARY_DIR}/../installation/${LIBRARY}/lib/library/LibraryTargets.cmake")
|
||||
|
||||
# map any "CURRENT" value to library version string
|
||||
# keep version in sync with the one used in library/CMakeLists.txt
|
||||
set(library_version 2.40.0)
|
||||
if(LIBRARY_DISABLE_DEPRECATED_BEFORE_AND_AT STREQUAL "CURRENT")
|
||||
set(LIBRARY_DISABLE_DEPRECATED_BEFORE_AND_AT ${library_version})
|
||||
endif()
|
||||
if(DEPRECATED_EXCLUDED_BEFORE_AND_AT STREQUAL "CURRENT")
|
||||
set(DEPRECATED_EXCLUDED_BEFORE_AND_AT ${library_version})
|
||||
endif()
|
||||
|
||||
# load the test variant specific testAPI method
|
||||
include(testAPI_${TEST_VARIANT}.cmake)
|
||||
|
||||
# for each API element test their visibility to the compiler and if a warning is emitted
|
||||
set(_code "Enum enumerator = Enumerator_deprecatedAt2_0;")
|
||||
testAPI(_code DEPRECATED_AT 2.0 CXX_STANDARD 11 BUILD_TIME_ONLY_DISABLABLE NO_WARNING)
|
||||
|
||||
set(_code "Enum enumerator = Enumerator_deprecatedAt2_0;")
|
||||
# we do not yet support enumerator warnings with MSVC
|
||||
if(MSVC)
|
||||
testAPI(_code DEPRECATED_AT 2.0 CXX_STANDARD 17 BUILD_TIME_ONLY_DISABLABLE NO_WARNING)
|
||||
else()
|
||||
testAPI(_code DEPRECATED_AT 2.0 CXX_STANDARD 17 BUILD_TIME_ONLY_DISABLABLE)
|
||||
endif()
|
||||
|
||||
set(_code "Enum enumerator = Enumerator_deprecatedAt2_12;")
|
||||
testAPI(_code DEPRECATED_AT 2.12 CXX_STANDARD 11 NO_WARNING)
|
||||
|
||||
set(_code "Enum enumerator = Enumerator_deprecatedAt2_12;")
|
||||
# we do not yet support enumerator warnings with MSVC
|
||||
if(MSVC)
|
||||
testAPI(_code DEPRECATED_AT 2.12 CXX_STANDARD 17 NO_WARNING)
|
||||
else()
|
||||
testAPI(_code DEPRECATED_AT 2.12 CXX_STANDARD 17)
|
||||
endif()
|
||||
|
||||
set(_code "Enum enumerator = Enumerator_not_deprecated;")
|
||||
testAPI(_code)
|
||||
|
||||
set(_code "function_deprecatedAt2_0();")
|
||||
testAPI(_code DEPRECATED_AT 2.0)
|
||||
|
||||
set(_code "function_deprecatedAt2_12();")
|
||||
testAPI(_code DEPRECATED_AT 2.12)
|
||||
|
||||
set(_code "function_not_deprecated();")
|
||||
testAPI(_code)
|
||||
|
||||
set(_code "Class().method_deprecatedAt2_0();")
|
||||
testAPI(_code DEPRECATED_AT 2.0 BUILD_TIME_ONLY_DISABLABLE)
|
||||
|
||||
set(_code "Class().method_deprecatedAt2_12();")
|
||||
testAPI(_code DEPRECATED_AT 2.12 BUILD_TIME_ONLY_DISABLABLE)
|
||||
|
||||
set(_code "Class().method_not_deprecated();")
|
||||
testAPI(_code)
|
||||
|
||||
add_executable(dummy main.cpp)
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
int main(int, char**)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
+91
@@ -0,0 +1,91 @@
|
||||
function(generate_hex_number _var_name _version)
|
||||
set(_hexnumber 0)
|
||||
|
||||
set(version_regex "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$")
|
||||
string(REGEX REPLACE ${version_regex} "\\1" _version_major "${_version}")
|
||||
string(REGEX REPLACE ${version_regex} "\\2" _version_minor "${_version}")
|
||||
string(REGEX REPLACE ${version_regex} "\\3" _version_patch "${_version}")
|
||||
set(_outputformat)
|
||||
set(_outputformat OUTPUT_FORMAT HEXADECIMAL)
|
||||
math(EXPR _hexnumber "${_version_major}*65536 + ${_version_minor}*256 + ${_version_patch}" ${_outputformat})
|
||||
set(${_var_name} ${_hexnumber} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
|
||||
generate_hex_number(disable_deprecated_before_and_at_hexnumber ${LIBRARY_DISABLE_DEPRECATED_BEFORE_AND_AT})
|
||||
|
||||
if(GROUP_MODE STREQUAL "GROUP_USE_GROUP")
|
||||
set(_deprecation_macros_base_name "LIBGROUP")
|
||||
else()
|
||||
set(_deprecation_macros_base_name "LIBRARY")
|
||||
endif()
|
||||
|
||||
function(testAPI code_var_name)
|
||||
set(options BUILD_TIME_ONLY_DISABLABLE NO_WARNING)
|
||||
set(oneValueArgs DEPRECATED_AT CXX_STANDARD)
|
||||
set(multiValueArgs)
|
||||
cmake_parse_arguments(ARGS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
|
||||
if((NOT ARGS_DEPRECATED_AT) OR
|
||||
(ARGS_BUILD_TIME_ONLY_DISABLABLE AND ARGS_DEPRECATED_AT VERSION_GREATER DEPRECATED_EXCLUDED_BEFORE_AND_AT) OR
|
||||
(ARGS_DEPRECATED_AT VERSION_GREATER LIBRARY_DISABLE_DEPRECATED_BEFORE_AND_AT))
|
||||
set(_build_result_expected TRUE)
|
||||
else()
|
||||
set(_build_result_expected FALSE)
|
||||
endif()
|
||||
|
||||
if (ARGS_CXX_STANDARD)
|
||||
if(MSVC)
|
||||
# C++11 is default for MSVC, no /std:c++11 flag available to set
|
||||
if (NOT ARGS_CXX_STANDARD STREQUAL "11")
|
||||
set(std_flag "/std:c++${ARGS_CXX_STANDARD}")
|
||||
endif()
|
||||
else()
|
||||
set(std_flag "-std=c++${ARGS_CXX_STANDARD}")
|
||||
endif()
|
||||
else()
|
||||
set(std_flag)
|
||||
endif()
|
||||
|
||||
set(CMAKE_REQUIRED_FLAGS "${std_flag}")
|
||||
set(CMAKE_REQUIRED_LIBRARIES library)
|
||||
set(CMAKE_REQUIRED_DEFINITIONS "-D${_deprecation_macros_base_name}_DISABLE_DEPRECATED_BEFORE_AND_AT=${disable_deprecated_before_and_at_hexnumber}")
|
||||
|
||||
set(_code "
|
||||
#include <library.hpp>
|
||||
int main(int, char**)
|
||||
{
|
||||
${${code_var_name}}
|
||||
}
|
||||
")
|
||||
|
||||
unset(_result CACHE) # clear out as check_cxx_source_compiles caches the result
|
||||
check_cxx_source_compiles("${_code}" _result)
|
||||
|
||||
assert_var_bool_value(_result ${_build_result_expected})
|
||||
|
||||
# check warning
|
||||
if(_build_result_expected)
|
||||
if(NOT ARGS_NO_WARNING AND
|
||||
((ARGS_BUILD_TIME_ONLY_DISABLABLE) OR
|
||||
(NOT ARGS_BUILD_TIME_ONLY_DISABLABLE AND ARGS_DEPRECATED_AT AND
|
||||
ARGS_DEPRECATED_AT VERSION_GREATER LIBRARY_DISABLE_DEPRECATED_BEFORE_AND_AT)))
|
||||
set(_dep_warning_as_error_result_expected FALSE)
|
||||
else()
|
||||
set(_dep_warning_as_error_result_expected TRUE)
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
# warning C4996 warns about deprecated declarations
|
||||
set(dep_warning_as_error_flag "-we4996")
|
||||
else()
|
||||
set(dep_warning_as_error_flag "-Werror=deprecated-declarations")
|
||||
endif()
|
||||
|
||||
set(CMAKE_REQUIRED_FLAGS "${std_flag} ${dep_warning_as_error_flag}")
|
||||
set(CMAKE_REQUIRED_DEFINITIONS) # unset LIBRARY_DISABLE_DEPRECATED_BEFORE_AND_AT, as LIBRARY_DEPRECATED_WARNINGS_SINCE defaults to it
|
||||
unset(_dep_warning_result CACHE) # clear out as check_cxx_source_compiles caches the result
|
||||
check_cxx_source_compiles("${_code}" _dep_warning_result)
|
||||
assert_var_bool_value(_dep_warning_result ${_dep_warning_as_error_result_expected})
|
||||
endif()
|
||||
endfunction()
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
if(GROUP_MODE STREQUAL "GROUP_USE_GROUP")
|
||||
set(_deprecation_macros_base_name "LIBGROUP")
|
||||
else()
|
||||
set(_deprecation_macros_base_name "LIBRARY")
|
||||
endif()
|
||||
|
||||
function(testAPI code_var_name)
|
||||
set(options BUILD_TIME_ONLY_DISABLABLE NO_WARNING)
|
||||
set(oneValueArgs DEPRECATED_AT CXX_STANDARD)
|
||||
set(multiValueArgs)
|
||||
cmake_parse_arguments(ARGS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
|
||||
if((NOT ARGS_DEPRECATED_AT) OR
|
||||
(ARGS_BUILD_TIME_ONLY_DISABLABLE AND ARGS_DEPRECATED_AT VERSION_GREATER DEPRECATED_EXCLUDED_BEFORE_AND_AT))
|
||||
set(_build_result_expected TRUE)
|
||||
else()
|
||||
set(_build_result_expected FALSE)
|
||||
endif()
|
||||
|
||||
if (ARGS_CXX_STANDARD)
|
||||
if(MSVC)
|
||||
# C++11 is default for MSVC, no /std:c++11 flag available to set
|
||||
if (NOT ARGS_CXX_STANDARD STREQUAL "11")
|
||||
set(std_flag "/std:c++${ARGS_CXX_STANDARD}")
|
||||
endif()
|
||||
else()
|
||||
set(std_flag "-std=c++${ARGS_CXX_STANDARD}")
|
||||
endif()
|
||||
else()
|
||||
set(std_flag)
|
||||
endif()
|
||||
|
||||
set(CMAKE_REQUIRED_FLAGS "${std_flag}")
|
||||
set(CMAKE_REQUIRED_LIBRARIES library)
|
||||
set(CMAKE_REQUIRED_DEFINITIONS "-D${_deprecation_macros_base_name}_NO_DEPRECATED")
|
||||
|
||||
set(_code "
|
||||
#include <library.hpp>
|
||||
int main(int, char**)
|
||||
{
|
||||
${${code_var_name}}
|
||||
}
|
||||
")
|
||||
|
||||
unset(_result CACHE) # clear out as check_cxx_source_compiles caches the result
|
||||
check_cxx_source_compiles("${_code}" _result)
|
||||
|
||||
assert_var_bool_value(_result ${_build_result_expected})
|
||||
|
||||
# check warning
|
||||
if(_build_result_expected)
|
||||
if(ARGS_BUILD_TIME_ONLY_DISABLABLE AND NOT ARGS_NO_WARNING)
|
||||
set(_dep_warning_as_error_result_expected FALSE)
|
||||
else()
|
||||
set(_dep_warning_as_error_result_expected TRUE)
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
# warning C4996 warns about deprecated declarations
|
||||
set(dep_warning_as_error_flag "-we4996")
|
||||
else()
|
||||
set(dep_warning_as_error_flag "-Werror=deprecated-declarations")
|
||||
endif()
|
||||
|
||||
set(CMAKE_REQUIRED_FLAGS "${std_flag} ${dep_warning_as_error_flag}")
|
||||
set(CMAKE_REQUIRED_DEFINITIONS) # unset LIBRARY_DISABLE_DEPRECATED_BEFORE_AND_AT, as LIBRARY_DEPRECATED_WARNINGS_SINCE defaults to it
|
||||
unset(_dep_warning_result CACHE) # clear out as check_cxx_source_compiles caches the result
|
||||
check_cxx_source_compiles("${_code}" _dep_warning_result)
|
||||
assert_var_bool_value(_dep_warning_result ${_dep_warning_as_error_result_expected})
|
||||
endif()
|
||||
endfunction()
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
cmake_minimum_required(VERSION 3.0.0)
|
||||
|
||||
project(format_version)
|
||||
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../modules)
|
||||
include(ECMGenerateExportHeader)
|
||||
|
||||
include(../../test_helpers.cmake)
|
||||
|
||||
set(_current_version "4.5.6")
|
||||
|
||||
# check 0: with CURRENT_VERSION
|
||||
ecm_export_header_format_version(0
|
||||
CURRENT_VERSION ${_current_version}
|
||||
STRING_VAR _versionstring
|
||||
HEXNUMBER_VAR _hexnumber
|
||||
)
|
||||
|
||||
assert_var_str_value(_versionstring "0")
|
||||
assert_var_str_value(_hexnumber "0")
|
||||
|
||||
# check 0: no CURRENT_VERSION
|
||||
ecm_export_header_format_version(0
|
||||
STRING_VAR _versionstring
|
||||
HEXNUMBER_VAR _hexnumber
|
||||
)
|
||||
|
||||
assert_var_str_value(_versionstring "0")
|
||||
assert_var_str_value(_hexnumber "0")
|
||||
|
||||
# check some version: with CURRENT_VERSION
|
||||
ecm_export_header_format_version(1.2.3
|
||||
CURRENT_VERSION ${_current_version}
|
||||
STRING_VAR _versionstring
|
||||
HEXNUMBER_VAR _hexnumber
|
||||
)
|
||||
|
||||
assert_var_str_value(_versionstring "1.2.3")
|
||||
assert_var_str_value(_hexnumber "0x10203")
|
||||
|
||||
# check some version: no CURRENT_VERSION
|
||||
ecm_export_header_format_version(1.2.3
|
||||
STRING_VAR _versionstring
|
||||
HEXNUMBER_VAR _hexnumber
|
||||
)
|
||||
|
||||
assert_var_str_value(_versionstring "1.2.3")
|
||||
assert_var_str_value(_hexnumber "0x10203")
|
||||
|
||||
# check CURRENT
|
||||
ecm_export_header_format_version(CURRENT
|
||||
CURRENT_VERSION ${_current_version}
|
||||
STRING_VAR _versionstring
|
||||
HEXNUMBER_VAR _hexnumber
|
||||
)
|
||||
|
||||
assert_var_str_value(_versionstring "4.5.6")
|
||||
assert_var_str_value(_hexnumber "0x40506")
|
||||
|
||||
add_executable(dummy main.cpp)
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
int main(int, char**)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
cmake_minimum_required(VERSION 3.0.0)
|
||||
|
||||
# keep version in sync with the one used in consumer/CMakeLists.txt for the library
|
||||
# ideally would be send over by an exported target property,
|
||||
# but exporting custom properties via EXPORT_PROPERTIES only was added in CMake 3.12
|
||||
project(library VERSION 2.40.0)
|
||||
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../modules)
|
||||
include(ECMGenerateExportHeader)
|
||||
|
||||
set(_public_includedir "include/library")
|
||||
|
||||
add_library(library library.cpp)
|
||||
target_include_directories(library
|
||||
PUBLIC
|
||||
"$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>"
|
||||
"$<INSTALL_INTERFACE:${_public_includedir}>"
|
||||
)
|
||||
|
||||
if(SET_GROUP)
|
||||
set(_group_args GROUP_BASE_NAME LIBGROUP)
|
||||
endif()
|
||||
|
||||
ecm_generate_export_header(library
|
||||
${_group_args}
|
||||
VERSION ${library_VERSION}
|
||||
DEPRECATION_VERSIONS 2.0 2.12
|
||||
EXCLUDE_DEPRECATED_BEFORE_AND_AT ${EXCLUDE_DEPRECATED_BEFORE_AND_AT}
|
||||
)
|
||||
|
||||
install(TARGETS library DESTINATION lib EXPORT library_targets)
|
||||
|
||||
install(EXPORT library_targets FILE LibraryTargets.cmake DESTINATION lib/library)
|
||||
install(FILES
|
||||
library.hpp
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/library_export.h"
|
||||
DESTINATION ${_public_includedir}
|
||||
)
|
||||
|
||||
add_executable(dummy main.cpp)
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
#include "library.hpp"
|
||||
|
||||
#if LIBRARY_BUILD_DEPRECATED_SINCE(2, 0)
|
||||
void function_deprecatedAt2_0()
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
#if LIBRARY_BUILD_DEPRECATED_SINCE(2, 12)
|
||||
void function_deprecatedAt2_12()
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
void function_not_deprecated()
|
||||
{
|
||||
}
|
||||
|
||||
#if LIBRARY_BUILD_DEPRECATED_SINCE(2, 0)
|
||||
void Class::method_deprecatedAt2_0()
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
#if LIBRARY_BUILD_DEPRECATED_SINCE(2, 12)
|
||||
void Class::method_deprecatedAt2_12()
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
void Class::method_not_deprecated()
|
||||
{
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
#include <library_export.h>
|
||||
|
||||
enum Enum {
|
||||
#if LIBRARY_BUILD_DEPRECATED_SINCE(2, 0)
|
||||
Enumerator_deprecatedAt2_0 LIBRARY_ENUMERATOR_DEPRECATED_VERSION(2, 0, "Deprecated at 2.0"),
|
||||
#endif
|
||||
Enumerator_not_deprecated,
|
||||
#if LIBRARY_ENABLE_DEPRECATED_SINCE(2, 12)
|
||||
Enumerator_deprecatedAt2_12 LIBRARY_ENUMERATOR_DEPRECATED_VERSION(2, 12, "Deprecated at 2.12"),
|
||||
#endif
|
||||
};
|
||||
|
||||
#if LIBRARY_ENABLE_DEPRECATED_SINCE(2, 0)
|
||||
LIBRARY_EXPORT
|
||||
LIBRARY_DEPRECATED_VERSION(2, 0, "Deprecated at 2.0")
|
||||
void function_deprecatedAt2_0();
|
||||
#endif
|
||||
|
||||
#if LIBRARY_ENABLE_DEPRECATED_SINCE(2, 12)
|
||||
LIBRARY_EXPORT
|
||||
LIBRARY_DEPRECATED_VERSION(2, 12, "Deprecated at 2.12")
|
||||
void function_deprecatedAt2_12();
|
||||
#endif
|
||||
|
||||
LIBRARY_EXPORT void function_not_deprecated();
|
||||
|
||||
class LIBRARY_EXPORT Class {
|
||||
public:
|
||||
#if LIBRARY_BUILD_DEPRECATED_SINCE(2, 0)
|
||||
LIBRARY_DEPRECATED_VERSION(2, 0, "Deprecated at 2.0")
|
||||
virtual void method_deprecatedAt2_0();
|
||||
#endif
|
||||
|
||||
#if LIBRARY_BUILD_DEPRECATED_SINCE(2, 12)
|
||||
LIBRARY_DEPRECATED_VERSION(2, 12, "Deprecated at 2.12")
|
||||
virtual void method_deprecatedAt2_12();
|
||||
#endif
|
||||
|
||||
virtual void method_not_deprecated();
|
||||
};
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
int main(int, char**)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
set(MODULES_DIR "${ECM_SOURCE_DIR}/modules")
|
||||
configure_file(run_test.cmake.config "${CMAKE_CURRENT_BINARY_DIR}/test/CMakeLists.txt" @ONLY)
|
||||
file(GLOB sources "*.h" "*.hpp")
|
||||
file(COPY ${sources} CommonHeader DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/test)
|
||||
file(COPY headsubdir DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/test/)
|
||||
|
||||
add_test(
|
||||
NAME ECMGenerateHeaders
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test
|
||||
COMMAND ${CMAKE_COMMAND} .)
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
// convenience header
|
||||
#include "headtest1.h"
|
||||
#include "headtest2.h"
|
||||
#include "headtest4.h"
|
||||
+403
@@ -0,0 +1,403 @@
|
||||
project(ECMGenerateHeadersTest)
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
set(CMAKE_MODULE_PATH "@MODULES_DIR@")
|
||||
set(CMAKE_CURRENT_SOURCE_DIR "@CMAKE_CURRENT_SOURCE_DIR@")
|
||||
set(CMAKE_CURRENT_BINARY_DIR "@CMAKE_CURRENT_BINARY_DIR@")
|
||||
|
||||
include(ECMGenerateHeaders)
|
||||
|
||||
function (check_files)
|
||||
set(options)
|
||||
set(oneValueArgs GENERATED ORIGINALS)
|
||||
set(multiValueArgs)
|
||||
cmake_parse_arguments(CF "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
list(LENGTH CF_GENERATED count)
|
||||
math(EXPR last "${count}-1")
|
||||
foreach(i RANGE ${last})
|
||||
list(GET CF_GENERATED ${i} generated_file)
|
||||
list(GET CF_ORIGINALS ${i} original_file)
|
||||
if (NOT EXISTS "${generated_file}")
|
||||
message(FATAL_ERROR "${generated_file} was not generated")
|
||||
endif()
|
||||
file(READ "${generated_file}" file_contents)
|
||||
string(STRIP "${file_contents}" file_contents)
|
||||
set (exp_contents "#include \"${original_file}\" // IWYU pragma: export")
|
||||
if (NOT "${file_contents}" STREQUAL "${exp_contents}")
|
||||
message(FATAL_ERROR "${generated_file} contains '${file_contents}' instead of '${exp_contents}'")
|
||||
endif()
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
###########################################################
|
||||
|
||||
message(STATUS "Test 1: no optional arguments")
|
||||
set(camelcase_headers)
|
||||
set(expfiles "${CMAKE_CURRENT_BINARY_DIR}/HeadTest1"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/HeadTest2")
|
||||
set(origfiles headtest1.h headtest2.h)
|
||||
file(REMOVE ${expfiles})
|
||||
ecm_generate_headers(
|
||||
camelcase_headers
|
||||
HEADER_NAMES HeadTest1 HeadTest2
|
||||
)
|
||||
if (NOT "${expfiles}" STREQUAL "${camelcase_headers}")
|
||||
message(FATAL_ERROR "camelcase_headers was set to \"${camelcase_headers}\" instead of \"${expfiles}\"")
|
||||
endif()
|
||||
check_files(GENERATED ${expfiles}
|
||||
ORIGINALS ${origfiles})
|
||||
|
||||
|
||||
###########################################################
|
||||
|
||||
message(STATUS "Test 2: RELATIVE")
|
||||
set(camelcase_headers)
|
||||
set(expfiles "${CMAKE_CURRENT_BINARY_DIR}/HeadTest2"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/HeadTest3")
|
||||
set(origfiles headtest2.h headtest3.h)
|
||||
file(REMOVE ${expfiles})
|
||||
ecm_generate_headers(
|
||||
camelcase_headers
|
||||
HEADER_NAMES HeadTest2 HeadTest3
|
||||
RELATIVE headsubdir
|
||||
)
|
||||
if (NOT "${expfiles}" STREQUAL "${camelcase_headers}")
|
||||
message(FATAL_ERROR "camelcase_headers was set to \"${camelcase_headers}\" instead of \"${expfiles}\"")
|
||||
endif()
|
||||
check_files(GENERATED ${expfiles}
|
||||
ORIGINALS ${origfiles})
|
||||
|
||||
|
||||
###########################################################
|
||||
|
||||
message(STATUS "Test 3: OUTPUT_DIR")
|
||||
set(camelcase_headers)
|
||||
set(expfiles "${CMAKE_CURRENT_BINARY_DIR}/testdir/HeadTest1"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/testdir/HeadTest2")
|
||||
set(origfiles headtest1.h headtest2.h)
|
||||
file(REMOVE ${expfiles})
|
||||
ecm_generate_headers(
|
||||
camelcase_headers
|
||||
HEADER_NAMES HeadTest1 HeadTest2
|
||||
OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/testdir"
|
||||
)
|
||||
if (NOT "${expfiles}" STREQUAL "${camelcase_headers}")
|
||||
message(FATAL_ERROR "camelcase_headers was set to \"${camelcase_headers}\" instead of \"${expfiles}\"")
|
||||
endif()
|
||||
check_files(GENERATED ${expfiles}
|
||||
ORIGINALS ${origfiles})
|
||||
|
||||
|
||||
###########################################################
|
||||
|
||||
message(STATUS "Test 4: PREFIX")
|
||||
set(camelcase_headers)
|
||||
set(expfiles "${CMAKE_CURRENT_BINARY_DIR}/Module/HeadTest1"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/Module/HeadTest2")
|
||||
set(intermediatefiles module/headtest1.h module/headtest2.h)
|
||||
set(origfiles "${CMAKE_CURRENT_SOURCE_DIR}/headtest1.h"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/headtest2.h")
|
||||
file(REMOVE ${expfiles} ${intermediatefiles})
|
||||
ecm_generate_headers(
|
||||
camelcase_headers
|
||||
HEADER_NAMES HeadTest1 HeadTest2
|
||||
PREFIX Module
|
||||
)
|
||||
if (NOT "${expfiles}" STREQUAL "${camelcase_headers}")
|
||||
message(FATAL_ERROR "camelcase_headers was set to \"${camelcase_headers}\" instead of \"${expfiles}\"")
|
||||
endif()
|
||||
check_files(GENERATED ${expfiles}
|
||||
ORIGINALS ${intermediatefiles})
|
||||
check_files(GENERATED ${expfiles}
|
||||
ORIGINALS ${intermediatefiles})
|
||||
|
||||
|
||||
###########################################################
|
||||
|
||||
message(STATUS "Test 5: REQUIRED_HEADERS")
|
||||
set(camelcase_headers)
|
||||
set(req_headers)
|
||||
set(expfiles "${CMAKE_CURRENT_BINARY_DIR}/HeadTest1"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/HeadTest2")
|
||||
set(origfiles headtest1.h headtest2.h)
|
||||
set(origpaths "${CMAKE_CURRENT_SOURCE_DIR}/headtest1.h"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/headtest2.h")
|
||||
file(REMOVE ${expfiles})
|
||||
ecm_generate_headers(
|
||||
camelcase_headers
|
||||
HEADER_NAMES HeadTest1 HeadTest2
|
||||
REQUIRED_HEADERS req_headers
|
||||
)
|
||||
if (NOT "${origpaths}" STREQUAL "${req_headers}")
|
||||
message(FATAL_ERROR "REQUIRED_HEADERS var was set to \"${req_headers}\" instead of \"${origpaths}\"")
|
||||
endif()
|
||||
if (NOT "${expfiles}" STREQUAL "${camelcase_headers}")
|
||||
message(FATAL_ERROR "camelcase_headers was set to \"${camelcase_headers}\" instead of \"${expfiles}\"")
|
||||
endif()
|
||||
check_files(GENERATED ${expfiles}
|
||||
ORIGINALS ${origfiles})
|
||||
|
||||
|
||||
###########################################################
|
||||
|
||||
message(STATUS "Test 6: RELATIVE and REQUIRED_HEADERS")
|
||||
set(camelcase_headers)
|
||||
set(req_headers)
|
||||
set(expfiles "${CMAKE_CURRENT_BINARY_DIR}/HeadTest2"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/HeadTest3")
|
||||
set(origfiles headtest2.h headtest3.h)
|
||||
set(origpaths "${CMAKE_CURRENT_SOURCE_DIR}/headsubdir/headtest2.h"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/headsubdir/headtest3.h")
|
||||
file(REMOVE ${expfiles})
|
||||
ecm_generate_headers(
|
||||
camelcase_headers
|
||||
HEADER_NAMES HeadTest2 HeadTest3
|
||||
RELATIVE headsubdir
|
||||
REQUIRED_HEADERS req_headers
|
||||
)
|
||||
if (NOT "${origpaths}" STREQUAL "${req_headers}")
|
||||
message(FATAL_ERROR "REQUIRED_HEADERS var was set to \"${req_headers}\" instead of \"${origpaths}\"")
|
||||
endif()
|
||||
if (NOT "${expfiles}" STREQUAL "${camelcase_headers}")
|
||||
message(FATAL_ERROR "camelcase_headers was set to \"${camelcase_headers}\" instead of \"${expfiles}\"")
|
||||
endif()
|
||||
check_files(GENERATED ${expfiles}
|
||||
ORIGINALS ${origfiles})
|
||||
|
||||
|
||||
###########################################################
|
||||
|
||||
message(STATUS "Test 7: OUTPUT_DIR and REQUIRED_HEADERS")
|
||||
set(camelcase_headers)
|
||||
set(req_headers)
|
||||
set(expfiles "${CMAKE_CURRENT_BINARY_DIR}/testdir/HeadTest1"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/testdir/HeadTest2")
|
||||
set(origfiles headtest1.h headtest2.h)
|
||||
set(origpaths "${CMAKE_CURRENT_SOURCE_DIR}/headtest1.h"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/headtest2.h")
|
||||
file(REMOVE ${expfiles})
|
||||
ecm_generate_headers(
|
||||
camelcase_headers
|
||||
HEADER_NAMES HeadTest1 HeadTest2
|
||||
OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/testdir"
|
||||
REQUIRED_HEADERS req_headers
|
||||
)
|
||||
if (NOT "${origpaths}" STREQUAL "${req_headers}")
|
||||
message(FATAL_ERROR "REQUIRED_HEADERS var was set to \"${req_headers}\" instead of \"${origpaths}\"")
|
||||
endif()
|
||||
if (NOT "${expfiles}" STREQUAL "${camelcase_headers}")
|
||||
message(FATAL_ERROR "camelcase_headers was set to \"${camelcase_headers}\" instead of \"${expfiles}\"")
|
||||
endif()
|
||||
check_files(GENERATED ${expfiles}
|
||||
ORIGINALS ${origfiles})
|
||||
|
||||
|
||||
###########################################################
|
||||
|
||||
message(STATUS "Test 8: PREFIX and REQUIRED_HEADERS")
|
||||
set(camelcase_headers)
|
||||
set(req_headers)
|
||||
set(expfiles "${CMAKE_CURRENT_BINARY_DIR}/Module/HeadTest1"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/Module/HeadTest2")
|
||||
set(intermediatefiles module/headtest1.h module/headtest2.h)
|
||||
set(origfiles "${CMAKE_CURRENT_SOURCE_DIR}/headtest1.h"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/headtest2.h")
|
||||
set(origpaths ${origfiles})
|
||||
file(REMOVE ${expfiles} ${intermediatefiles})
|
||||
ecm_generate_headers(
|
||||
camelcase_headers
|
||||
HEADER_NAMES HeadTest1 HeadTest2
|
||||
PREFIX Module
|
||||
REQUIRED_HEADERS req_headers
|
||||
)
|
||||
if (NOT "${origpaths}" STREQUAL "${req_headers}")
|
||||
message(FATAL_ERROR "REQUIRED_HEADERS var was set to \"${req_headers}\" instead of \"${origpaths}\"")
|
||||
endif()
|
||||
if (NOT "${expfiles}" STREQUAL "${camelcase_headers}")
|
||||
message(FATAL_ERROR "camelcase_headers was set to \"${camelcase_headers}\" instead of \"${expfiles}\"")
|
||||
endif()
|
||||
check_files(GENERATED ${expfiles}
|
||||
ORIGINALS ${intermediatefiles})
|
||||
check_files(GENERATED ${expfiles}
|
||||
ORIGINALS ${intermediatefiles})
|
||||
|
||||
|
||||
###########################################################
|
||||
|
||||
message(STATUS "Test 9: REQUIRED_HEADERS (duplicate var)")
|
||||
set(all_headers)
|
||||
set(expfiles "${CMAKE_CURRENT_BINARY_DIR}/HeadTest1"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/HeadTest2")
|
||||
set(origfiles headtest1.h headtest2.h)
|
||||
set(origpaths "${CMAKE_CURRENT_SOURCE_DIR}/headtest1.h"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/headtest2.h")
|
||||
file(REMOVE ${expfiles})
|
||||
ecm_generate_headers(
|
||||
all_headers
|
||||
HEADER_NAMES HeadTest1 HeadTest2
|
||||
REQUIRED_HEADERS all_headers
|
||||
)
|
||||
list(SORT all_headers)
|
||||
set(exp_headers ${expfiles} ${origpaths})
|
||||
list(SORT exp_headers)
|
||||
if (NOT "${exp_headers}" STREQUAL "${all_headers}")
|
||||
message(FATAL_ERROR "combined headers var was set to \"${all_headers}\" instead of \"${exp_headers}\"")
|
||||
endif()
|
||||
check_files(GENERATED ${expfiles}
|
||||
ORIGINALS ${origfiles})
|
||||
|
||||
|
||||
###########################################################
|
||||
|
||||
message(STATUS "Test 10: ORIGINAL CAMELCASE")
|
||||
set(forward_headers)
|
||||
set(expfiles "${CMAKE_CURRENT_BINARY_DIR}/CamelCaseHeadTest1"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/CamelCaseHeadTest2")
|
||||
set(origfiles CamelCaseHeadTest1.h CamelCaseHeadTest2.h)
|
||||
file(REMOVE ${expfiles})
|
||||
ecm_generate_headers(
|
||||
forward_headers
|
||||
ORIGINAL CAMELCASE
|
||||
HEADER_NAMES CamelCaseHeadTest1 CamelCaseHeadTest2
|
||||
)
|
||||
if (NOT "${expfiles}" STREQUAL "${forward_headers}")
|
||||
message(FATAL_ERROR "forward_headers was set to \"${forward_headers}\" instead of \"${expfiles}\"")
|
||||
endif()
|
||||
check_files(GENERATED ${expfiles}
|
||||
ORIGINALS ${origfiles})
|
||||
|
||||
|
||||
###########################################################
|
||||
|
||||
message(STATUS "Test 11: PREFIX and ORIGINAL CAMELCASE")
|
||||
set(forward_headers)
|
||||
set(expfiles "${CMAKE_CURRENT_BINARY_DIR}/Module/CamelCaseHeadTest1"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/Module/CamelCaseHeadTest2")
|
||||
set(intermediatefiles Module/CamelCaseHeadTest1.h Module/CamelCaseHeadTest2.h)
|
||||
set(origfiles "${CMAKE_CURRENT_SOURCE_DIR}/headtest1.h"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/headtest2.h")
|
||||
file(REMOVE ${expfiles} ${intermediatefiles})
|
||||
ecm_generate_headers(
|
||||
forward_headers
|
||||
ORIGINAL CAMELCASE
|
||||
HEADER_NAMES CamelCaseHeadTest1 CamelCaseHeadTest2
|
||||
PREFIX Module
|
||||
)
|
||||
if (NOT "${expfiles}" STREQUAL "${forward_headers}")
|
||||
message(FATAL_ERROR "forward_headers was set to \"${forward_headers}\" instead of \"${expfiles}\"")
|
||||
endif()
|
||||
check_files(GENERATED ${expfiles}
|
||||
ORIGINALS ${intermediatefiles})
|
||||
check_files(GENERATED ${expfiles}
|
||||
ORIGINALS ${intermediatefiles})
|
||||
|
||||
###########################################################
|
||||
|
||||
message(STATUS "Test 12: COMMON_HEADER")
|
||||
|
||||
set(camelcase_headers)
|
||||
set(expfiles "${CMAKE_CURRENT_BINARY_DIR}/HeadTest1"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/HeadTest2"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/HeadTest4"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/CommonHeader")
|
||||
set(origfiles headtest1.h headtest2.h)
|
||||
file(REMOVE ${expfiles})
|
||||
ecm_generate_headers(
|
||||
camelcase_headers
|
||||
ORIGINAL LOWERCASE
|
||||
HEADER_NAMES HeadTest1 HeadTest2 HeadTest4
|
||||
COMMON_HEADER CommonHeader
|
||||
)
|
||||
if (NOT "${expfiles}" STREQUAL "${camelcase_headers}")
|
||||
message(FATAL_ERROR "camelcase_headers was set to \"${camelcase_headers}\" instead of \"${expfiles}\"")
|
||||
endif()
|
||||
check_files(GENERATED ${expfiles}
|
||||
ORIGINALS ${origfiles})
|
||||
|
||||
file(READ CommonHeader file_contents)
|
||||
string(STRIP "${file_contents}" file_contents)
|
||||
file(READ "${CMAKE_CURRENT_BINARY_DIR}/CommonHeader" exp_contents)
|
||||
string(STRIP "${exp_contents}" exp_contents)
|
||||
if (NOT "${file_contents}" STREQUAL "${exp_contents}")
|
||||
message(FATAL_ERROR "${generated_file} contains '${file_contents}' instead of '${exp_contents}'")
|
||||
endif()
|
||||
|
||||
|
||||
###########################################################
|
||||
|
||||
message(STATUS "Test 13: multiple classes and COMMON_HEADER")
|
||||
|
||||
set(camelcase_headers)
|
||||
set(expfiles "${CMAKE_CURRENT_BINARY_DIR}/HeadTest1"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/HeadTest2"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/HeadTest2Add1"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/HeadTest2Add2"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/HeadTest4"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/CommonHeader")
|
||||
set(origfiles headtest1.h headtest2.h headtest4.h)
|
||||
file(REMOVE ${expfiles})
|
||||
ecm_generate_headers(
|
||||
camelcase_headers
|
||||
ORIGINAL LOWERCASE
|
||||
HEADER_NAMES HeadTest1 HeadTest2,HeadTest2Add1,HeadTest2Add2 HeadTest4
|
||||
COMMON_HEADER CommonHeader
|
||||
)
|
||||
if (NOT "${expfiles}" STREQUAL "${camelcase_headers}")
|
||||
message(FATAL_ERROR "camelcase_headers was set to \"${camelcase_headers}\" instead of \"${expfiles}\"")
|
||||
endif()
|
||||
check_files(GENERATED ${expfiles}
|
||||
ORIGINALS ${origfiles})
|
||||
|
||||
file(READ CommonHeader file_contents)
|
||||
string(STRIP "${file_contents}" file_contents)
|
||||
file(READ "${CMAKE_CURRENT_BINARY_DIR}/CommonHeader" exp_contents)
|
||||
string(STRIP "${exp_contents}" exp_contents)
|
||||
if (NOT "${file_contents}" STREQUAL "${exp_contents}")
|
||||
message(FATAL_ERROR "${generated_file} contains '${file_contents}' instead of '${exp_contents}'")
|
||||
endif()
|
||||
|
||||
###########################################################
|
||||
|
||||
message(STATUS "Test 14: HEADER_EXTENSION")
|
||||
set(camelcase_headers)
|
||||
set(expfiles "${CMAKE_CURRENT_BINARY_DIR}/HeadTest1"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/HeadTest2")
|
||||
set(origfiles headtest1.hpp headtest2.hpp)
|
||||
file(REMOVE ${expfiles})
|
||||
ecm_generate_headers(
|
||||
camelcase_headers
|
||||
HEADER_NAMES HeadTest1 HeadTest2
|
||||
HEADER_EXTENSION hpp
|
||||
)
|
||||
if (NOT "${expfiles}" STREQUAL "${camelcase_headers}")
|
||||
message(FATAL_ERROR "camelcase_headers was set to \"${camelcase_headers}\" instead of \"${expfiles}\"")
|
||||
endif()
|
||||
check_files(GENERATED ${expfiles}
|
||||
ORIGINALS ${origfiles})
|
||||
|
||||
###########################################################
|
||||
|
||||
message(STATUS "Test 15: Generated headers")
|
||||
set(camelcase_headers)
|
||||
set(expfiles "${CMAKE_CURRENT_BINARY_DIR}/HeadTest15")
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/headtest15.h"
|
||||
COMMAND touch ${CMAKE_CURRENT_BINARY_DIR}/headtest15.h
|
||||
)
|
||||
|
||||
set(origfiles headtest15.h)
|
||||
file(REMOVE ${expfiles})
|
||||
file(RELATIVE_PATH rel_path ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
|
||||
ecm_generate_headers(
|
||||
camelcase_headers
|
||||
HEADER_NAMES HeadTest15
|
||||
RELATIVE ${rel_path}
|
||||
)
|
||||
if (NOT "${expfiles}" STREQUAL "${camelcase_headers}")
|
||||
message(FATAL_ERROR "camelcase_headers was set to \"${camelcase_headers}\" instead of \"${expfiles}\"")
|
||||
endif()
|
||||
check_files(GENERATED ${expfiles}
|
||||
ORIGINALS ${origfiles})
|
||||
|
||||
# vim:ft=cmake
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
set(MODULES_DIR "${ECM_SOURCE_DIR}/modules")
|
||||
configure_file(run_test.cmake.config "${CMAKE_CURRENT_BINARY_DIR}/run_test.cmake" @ONLY)
|
||||
|
||||
add_test(
|
||||
NAME ECMGeneratePkgConfigFile
|
||||
COMMAND ${CMAKE_COMMAND} -P "${CMAKE_CURRENT_BINARY_DIR}/run_test.cmake")
|
||||
|
||||
add_subdirectory(test_imported_targets)
|
||||
add_subdirectory(test_no_interface_include_dirs)
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
|
||||
prefix=/usr
|
||||
exec_prefix=${prefix}
|
||||
libdir=${prefix}/lib
|
||||
includedir=${prefix}/include/KF5CoreAddons
|
||||
|
||||
Name: KF5CoreAddons
|
||||
Description: KF5CoreAddons test
|
||||
URL: https://www.kde.org/
|
||||
Version: 5.43
|
||||
Libs: -L${prefix}/lib -lKF5CoreAddons
|
||||
Cflags: -I${prefix}/include/KF5CoreAddons
|
||||
Requires: Qt5Core
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
|
||||
prefix=/usr
|
||||
exec_prefix=${prefix}
|
||||
libdir=${prefix}/lib
|
||||
includedir=/usr/KCoreAddons
|
||||
|
||||
Name: KF5CoreAddons2
|
||||
Description: Addons to QtCore
|
||||
URL: https://www.kde.org/
|
||||
Version: 5.43
|
||||
Libs: -L${prefix}/lib -lKF5CoreAddons2
|
||||
Cflags: -I/usr/KCoreAddons
|
||||
Requires: Qt5Core
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
|
||||
prefix=/usr
|
||||
exec_prefix=${prefix}
|
||||
libdir=${prefix}/lib
|
||||
includedir=/usr/KCoreAddons
|
||||
|
||||
Name: KF5CoreAddons3
|
||||
Description: KF5CoreAddons3 library.
|
||||
URL: https://www.kde.org/
|
||||
Version: 5.43
|
||||
Libs: -L${prefix}/lib -lKF5CoreAddons3
|
||||
Cflags: -I/usr/KCoreAddons
|
||||
Requires: Qt5Core
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
|
||||
prefix=/usr
|
||||
exec_prefix=${prefix}
|
||||
libdir=${prefix}/lib
|
||||
includedir=/usr/KCoreAddons
|
||||
|
||||
Name: KF5CoreAddons4
|
||||
Description: KF5CoreAddons4 library.
|
||||
URL: https://www.kde.org/
|
||||
Version: 5.43
|
||||
Libs: -L${prefix}/lib -lKF5CoreAddons4
|
||||
Cflags: -I/usr/KCoreAddons
|
||||
Requires: Public1 Public2
|
||||
Requires.private: Private1 Private2
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
|
||||
prefix=/usr
|
||||
exec_prefix=${prefix}
|
||||
libdir=${prefix}/lib
|
||||
includedir=/usr/KCoreAddons
|
||||
|
||||
Name: KF5CoreAddons5
|
||||
Description: KF5CoreAddons test
|
||||
URL: https://www.example.org/
|
||||
Version: 5.43
|
||||
Libs: -L${prefix}/lib -lKF5CoreAddons5
|
||||
Cflags: -I/usr/KCoreAddons
|
||||
Requires: Qt5Core
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
prefix=/usr
|
||||
exec_prefix=${prefix}
|
||||
libdir=${prefix}/lib
|
||||
includedir=/usr/include/Attica
|
||||
|
||||
Name: KF6Attica
|
||||
Description: Qt library to access Open Collaboration Services
|
||||
URL: https://www.kde.org/
|
||||
Version: 6.7.0
|
||||
Libs: -L${prefix}/lib -lKF6Attica
|
||||
Cflags: -I/usr/include/Attica -I${prefix}/include/foo -I${prefix}/include/bar
|
||||
Requires: Qt6Core Qt6Network
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
maintainer: mpyne
|
||||
description: Addons to QtCore
|
||||
tier: 1
|
||||
type: functional
|
||||
platforms:
|
||||
- name: Linux
|
||||
- name: FreeBSD
|
||||
- name: Windows
|
||||
- name: MacOSX
|
||||
- name: Android
|
||||
portingAid: false
|
||||
deprecated: false
|
||||
release: true
|
||||
libraries:
|
||||
- qmake: KCoreAddons
|
||||
cmake: "KF5::CoreAddons"
|
||||
cmakename: KF5CoreAddons
|
||||
|
||||
public_lib: true
|
||||
group: Frameworks
|
||||
subgroup: Tier 1
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
maintainer: mpyne
|
||||
description:
|
||||
tier: 1
|
||||
type: functional
|
||||
platforms:
|
||||
- name: Linux
|
||||
- name: FreeBSD
|
||||
- name: Windows
|
||||
- name: MacOSX
|
||||
- name: Android
|
||||
portingAid: false
|
||||
deprecated: false
|
||||
release: true
|
||||
libraries:
|
||||
- qmake: KCoreAddons
|
||||
cmake: "KF5::CoreAddons"
|
||||
cmakename: KF5CoreAddons
|
||||
|
||||
public_lib: true
|
||||
group: Frameworks
|
||||
subgroup: Tier 1
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
maintainer: mpyne
|
||||
tier: 1
|
||||
type: functional
|
||||
platforms:
|
||||
- name: Linux
|
||||
- name: FreeBSD
|
||||
- name: Windows
|
||||
- name: MacOSX
|
||||
- name: Android
|
||||
portingAid: false
|
||||
deprecated: false
|
||||
release: true
|
||||
libraries:
|
||||
- qmake: KCoreAddons
|
||||
cmake: "KF5::CoreAddons"
|
||||
cmakename: KF5CoreAddons
|
||||
|
||||
public_lib: true
|
||||
group: Frameworks
|
||||
subgroup: Tier 1
|
||||
+161
@@ -0,0 +1,161 @@
|
||||
set(CMAKE_MODULE_PATH "@MODULES_DIR@")
|
||||
set(CMAKE_CURRENT_SOURCE_DIR "@CMAKE_CURRENT_SOURCE_DIR@")
|
||||
set(CMAKE_CURRENT_BINARY_DIR "@CMAKE_CURRENT_BINARY_DIR@")
|
||||
|
||||
set(CMAKE_INSTALL_PREFIX "/usr")
|
||||
|
||||
include(ECMGeneratePkgConfigFile)
|
||||
include(ECMSetupVersion)
|
||||
|
||||
|
||||
function (compare_files)
|
||||
set(options)
|
||||
set(oneValueArgs GENERATED ORIGINALS)
|
||||
set(multiValueArgs)
|
||||
cmake_parse_arguments(CF "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
list(LENGTH CF_GENERATED count)
|
||||
math(EXPR last "${count}-1")
|
||||
foreach(i RANGE ${last})
|
||||
list(GET CF_GENERATED ${i} generated_file)
|
||||
if (NOT EXISTS "${generated_file}")
|
||||
message(FATAL_ERROR "${generated_file} was not generated")
|
||||
endif()
|
||||
file(READ "${generated_file}" file_contents)
|
||||
string(STRIP "${file_contents}" file_contents)
|
||||
|
||||
list(GET CF_ORIGINALS ${i} original_file)
|
||||
if (NOT EXISTS "${original_file}")
|
||||
message(FATAL_ERROR "Original ${original_file} was not found")
|
||||
endif()
|
||||
file(READ "${original_file}" original_contents)
|
||||
string(STRIP "${original_contents}" original_contents)
|
||||
|
||||
if(NOT original_contents STREQUAL file_contents)
|
||||
message(FATAL_ERROR "Different files: ${original_file} ${generated_file}")
|
||||
endif()
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
###########################################################
|
||||
|
||||
|
||||
ecm_setup_version(5.43 VARIABLE_PREFIX KCOREADDONS
|
||||
VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/kcoreaddons_version.h"
|
||||
PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KF5CoreAddonsConfigVersion.cmake"
|
||||
SOVERSION 5)
|
||||
|
||||
message(STATUS "Test 1: no optional arguments")
|
||||
set(origfiles "${CMAKE_CURRENT_SOURCE_DIR}/KF5CoreAddons.pc")
|
||||
|
||||
ecm_generate_pkgconfig_file(BASE_NAME KF5CoreAddons
|
||||
DESCRIPTION "KF5CoreAddons test"
|
||||
DEPS Qt5Core
|
||||
FILENAME_VAR OutputFile)
|
||||
|
||||
compare_files(GENERATED ${OutputFile}
|
||||
ORIGINALS ${origfiles})
|
||||
file(REMOVE ${OutputFile})
|
||||
|
||||
message(STATUS "Test2: no description parameter, metainfo.yaml with description found")
|
||||
set(origfiles "${CMAKE_CURRENT_SOURCE_DIR}/KF5CoreAddons2.pc")
|
||||
|
||||
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/metainfo_with_description.yaml
|
||||
DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
|
||||
file(RENAME ${CMAKE_CURRENT_BINARY_DIR}/metainfo_with_description.yaml ${CMAKE_CURRENT_BINARY_DIR}/metainfo.yaml)
|
||||
|
||||
ecm_generate_pkgconfig_file(BASE_NAME KF5CoreAddons2
|
||||
DEPS Qt5Core
|
||||
INCLUDE_INSTALL_DIR /usr/KCoreAddons
|
||||
FILENAME_VAR OutputFile)
|
||||
|
||||
compare_files(GENERATED ${OutputFile}
|
||||
ORIGINALS ${origfiles})
|
||||
file(REMOVE ${OutputFile})
|
||||
file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/metainfo.yaml)
|
||||
|
||||
message(STATUS "Test3: no description parameter, metainfo.yaml with empty description found")
|
||||
set(origfiles "${CMAKE_CURRENT_SOURCE_DIR}/KF5CoreAddons3.pc")
|
||||
|
||||
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/metainfo_with_empty_description.yaml
|
||||
DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
|
||||
file(RENAME ${CMAKE_CURRENT_BINARY_DIR}/metainfo_with_empty_description.yaml ${CMAKE_CURRENT_BINARY_DIR}/metainfo.yaml)
|
||||
|
||||
ecm_generate_pkgconfig_file(BASE_NAME KF5CoreAddons3
|
||||
DEPS Qt5Core
|
||||
INCLUDE_INSTALL_DIR /usr/KCoreAddons
|
||||
FILENAME_VAR OutputFile)
|
||||
|
||||
compare_files(GENERATED ${OutputFile}
|
||||
ORIGINALS ${origfiles})
|
||||
file(REMOVE ${OutputFile})
|
||||
file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/metainfo.yaml)
|
||||
|
||||
message(STATUS "Test4: no description parameter, metainfo.yaml without description")
|
||||
set(origfiles "${CMAKE_CURRENT_SOURCE_DIR}/KF5CoreAddons3.pc")
|
||||
|
||||
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/metainfo_without_description.yaml
|
||||
DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
|
||||
file(RENAME ${CMAKE_CURRENT_BINARY_DIR}/metainfo_without_description.yaml ${CMAKE_CURRENT_BINARY_DIR}/metainfo.yaml)
|
||||
|
||||
ecm_generate_pkgconfig_file(BASE_NAME KF5CoreAddons3
|
||||
DEPS Qt5Core
|
||||
INCLUDE_INSTALL_DIR /usr/KCoreAddons
|
||||
FILENAME_VAR OutputFile)
|
||||
|
||||
compare_files(GENERATED ${OutputFile}
|
||||
ORIGINALS ${origfiles})
|
||||
file(REMOVE ${OutputFile})
|
||||
file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/metainfo.yaml)
|
||||
|
||||
message(STATUS "Test5: with public and private dependencies")
|
||||
set(origfiles "${CMAKE_CURRENT_SOURCE_DIR}/KF5CoreAddons4.pc")
|
||||
|
||||
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/metainfo_without_description.yaml
|
||||
DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
|
||||
file(RENAME ${CMAKE_CURRENT_BINARY_DIR}/metainfo_without_description.yaml ${CMAKE_CURRENT_BINARY_DIR}/metainfo.yaml)
|
||||
|
||||
ecm_generate_pkgconfig_file(BASE_NAME KF5CoreAddons4
|
||||
DEPS Public1 PRIVATE Private1 Private2 PUBLIC Public2
|
||||
INCLUDE_INSTALL_DIR /usr/KCoreAddons
|
||||
FILENAME_VAR OutputFile)
|
||||
|
||||
compare_files(GENERATED ${OutputFile}
|
||||
ORIGINALS ${origfiles})
|
||||
file(REMOVE ${OutputFile})
|
||||
file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/metainfo.yaml)
|
||||
|
||||
message(STATUS "Test 6: with an URL parameter")
|
||||
set(origfiles "${CMAKE_CURRENT_SOURCE_DIR}/KF5CoreAddons5.pc")
|
||||
|
||||
ecm_generate_pkgconfig_file(BASE_NAME KF5CoreAddons5
|
||||
DESCRIPTION "KF5CoreAddons test"
|
||||
URL "https://www.example.org/"
|
||||
DEPS Qt5Core
|
||||
INCLUDE_INSTALL_DIR /usr/KCoreAddons
|
||||
FILENAME_VAR OutputFile)
|
||||
|
||||
compare_files(GENERATED ${OutputFile}
|
||||
ORIGINALS ${origfiles})
|
||||
file(REMOVE ${OutputFile})
|
||||
|
||||
message(STATUS "Test7: Custom defines")
|
||||
set(origfiles "${CMAKE_CURRENT_SOURCE_DIR}/KF6Attica.pc")
|
||||
set(prefix "/usr")
|
||||
|
||||
ecm_setup_version(6.7.0 VARIABLE_PREFIX ATTICA
|
||||
VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/attica_version.h"
|
||||
PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KF6AtticaConfigVersion.cmake"
|
||||
SOVERSION 6)
|
||||
|
||||
ecm_generate_pkgconfig_file(BASE_NAME KF6Attica
|
||||
DESCRIPTION "Qt library to access Open Collaboration Services"
|
||||
LIB_NAME KF6Attica
|
||||
INCLUDE_INSTALL_DIR /usr/include/Attica
|
||||
DEFINES -I\${prefix}/include/foo -I\${prefix}/include/bar
|
||||
DEPS Qt6Core Qt6Network
|
||||
FILENAME_VAR OutputFile
|
||||
)
|
||||
|
||||
compare_files(GENERATED ${OutputFile}
|
||||
ORIGINALS ${origfiles})
|
||||
file(REMOVE ${OutputFile})
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
project(ECMGeneratePkgConfigFile_imported_vars VERSION 0.1)
|
||||
|
||||
set(ECM_MODULE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../modules")
|
||||
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../../modules;${CMAKE_CURRENT_SOURCE_DIR}/../../../kde-modules")
|
||||
|
||||
enable_language(CXX)
|
||||
|
||||
include(ECMGeneratePkgConfigFile)
|
||||
include(ECMSetupVersion)
|
||||
|
||||
# KDEInstallDirs can't be used
|
||||
set(EGPF_KDE_INSTALL_INCLUDEDIR_KF "include/KF6")
|
||||
|
||||
set(InputFile "${CMAKE_CURRENT_SOURCE_DIR}/EGPF_imported_include_dirs_control.pc")
|
||||
|
||||
set(CMAKE_INSTALL_PREFIX "/usr")
|
||||
set(CMAKE_INSTALL_LIBDIR "lib")
|
||||
|
||||
ecm_setup_version(0.1 VARIABLE_PREFIX EGPF_lib
|
||||
SOVERSION 0)
|
||||
|
||||
add_library(EGPF_lib)
|
||||
target_sources(EGPF_lib PRIVATE main.cpp)
|
||||
set_target_properties(EGPF_lib PROPERTIES
|
||||
VERSION 0.1
|
||||
SOVERSION 0
|
||||
EXPORT_NAME "EGPF_lib"
|
||||
)
|
||||
|
||||
target_include_directories(EGPF_lib INTERFACE "$<INSTALL_INTERFACE:${EGPF_KDE_INSTALL_INCLUDEDIR_KF}/Attica;${EGPF_KDE_INSTALL_INCLUDEDIR_KF}/EGPF_lib;${EGPF_KDE_INSTALL_INCLUDEDIR_KF}/other_dir>"
|
||||
PUBLIC
|
||||
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../:${CMAKE_CURRENT_BINARY_DIR}/..>"
|
||||
)
|
||||
|
||||
ecm_generate_pkgconfig_file(BASE_NAME EGPF_lib
|
||||
DESCRIPTION "Testing additional include dirs in Cflags"
|
||||
INCLUDE_INSTALL_DIR ${EGPF_KDE_INSTALL_INCLUDEDIR_KF}/Attica/
|
||||
FILENAME_VAR OutputFile
|
||||
)
|
||||
|
||||
add_test(
|
||||
NAME ECMGeneratePkgConfigFileTest.imported_include_dirs
|
||||
COMMAND ${CMAKE_COMMAND} -E compare_files --ignore-eol "${InputFile}" "${OutputFile}"
|
||||
)
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
|
||||
prefix=/usr
|
||||
exec_prefix=${prefix}
|
||||
libdir=${prefix}/lib
|
||||
includedir=${prefix}/include/KF6/Attica/
|
||||
|
||||
Name: EGPF_lib
|
||||
Description: Testing additional include dirs in Cflags
|
||||
URL: https://www.kde.org/
|
||||
Version: 0.1
|
||||
Libs: -L${prefix}/lib -lEGPF_lib
|
||||
Cflags: -I${prefix}/include/KF6/Attica -I${prefix}/include/KF6/EGPF_lib -I${prefix}/include/KF6/other_dir
|
||||
Requires:
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
int main(int, char**)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
project(ECMGeneratePkgConfigFile_no_interface_include_directories VERSION 0.1)
|
||||
|
||||
set(ECM_MODULE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../modules")
|
||||
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../../modules;${CMAKE_CURRENT_SOURCE_DIR}/../../../kde-modules")
|
||||
|
||||
enable_language(CXX)
|
||||
|
||||
include(ECMGeneratePkgConfigFile)
|
||||
include(ECMSetupVersion)
|
||||
|
||||
# KDEInstallDirs can't be used
|
||||
set(EGPF_KDE_INSTALL_INCLUDEDIR_KF "include/KF6")
|
||||
|
||||
set(InputFile "${CMAKE_CURRENT_SOURCE_DIR}/EGPF_no_interface_include_directories.pc")
|
||||
|
||||
set(CMAKE_INSTALL_PREFIX "/usr")
|
||||
set(CMAKE_INSTALL_LIBDIR "lib")
|
||||
|
||||
ecm_setup_version(0.1 VARIABLE_PREFIX EGPF_lib_without_interface
|
||||
SOVERSION 0)
|
||||
|
||||
add_library(EGPF_lib_without_interface)
|
||||
target_sources(EGPF_lib_without_interface PRIVATE main.cpp)
|
||||
set_target_properties(EGPF_lib_without_interface PROPERTIES
|
||||
VERSION 0.1
|
||||
SOVERSION 0
|
||||
)
|
||||
|
||||
ecm_generate_pkgconfig_file(BASE_NAME EGPF_lib_without_interface
|
||||
DESCRIPTION "Testing generated pkgconfig file without interface_include_directories"
|
||||
INCLUDE_INSTALL_DIR ${EGPF_KDE_INSTALL_INCLUDEDIR_KF}
|
||||
FILENAME_VAR OutputFile
|
||||
)
|
||||
|
||||
add_test(
|
||||
NAME ECMGeneratePkgConfigFileTest.no_interface_include_directories
|
||||
COMMAND ${CMAKE_COMMAND} -E compare_files --ignore-eol "${InputFile}" "${OutputFile}"
|
||||
)
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
|
||||
prefix=/usr
|
||||
exec_prefix=${prefix}
|
||||
libdir=${prefix}/lib
|
||||
includedir=${prefix}/include/KF6
|
||||
|
||||
Name: EGPF_lib_without_interface
|
||||
Description: Testing generated pkgconfig file without interface_include_directories
|
||||
URL: https://www.kde.org/
|
||||
Version: 0.1
|
||||
Libs: -L${prefix}/lib -lEGPF_lib_without_interface
|
||||
Cflags: -I${prefix}/include/KF6
|
||||
Requires:
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user