aboutsummaryrefslogtreecommitdiff
path: root/tests/CMakeLists.txt
diff options
context:
space:
mode:
authorAlex Merry <alex.merry@kde.org>2014-12-17 20:33:32 +0000
committerAlex Merry <alex.merry@kde.org>2014-12-28 15:43:52 +0000
commit107f255620b6284de118aa1f358ab6cf99862ae9 (patch)
treed3f023bd38a2ff748ed0ebf4439493bff6a8ee03 /tests/CMakeLists.txt
parent69939eef4f828e881edd387b129128cb252f7ab3 (diff)
downloadextra-cmake-modules-107f255620b6284de118aa1f358ab6cf99862ae9.tar.gz
extra-cmake-modules-107f255620b6284de118aa1f358ab6cf99862ae9.tar.bz2
Make KDEInstallDirs provide KDE_INSTALL_* variables.
Creating variables whose names start with CMAKE_ is a bad idea for modules distributed outside CMake itself. Since the module is called KDEInstallDirs, having a KDE_INSTALL_ prefix for the variables is clear and intuitive. Both CMAKE_INSTALL_* variables and the older KDELibs4-compatible variables are provided, unless KDE_INSTALL_DIRS_NO_DEPRECATED is set to TRUE before the module is included. Even then, the CMAKE_INSTALL_* variables provided by the GNUInstallDirs module will still be set and understood (for compatibility with that module), unless KDE_INSTALL_DIRS_NO_CMAKE_VARIABLES is set to TRUE. REVIEW: 121646
Diffstat (limited to 'tests/CMakeLists.txt')
-rw-r--r--tests/CMakeLists.txt45
1 files changed, 31 insertions, 14 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 0ee544a5..fe160b8c 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -10,20 +10,24 @@ add_subdirectory(ECMGeneratePkgConfigFile)
# a macro for tests that have a simple format where the name matches the
# directory and project
-macro(ADD_TEST_MACRO NAME COMMAND)
- string(REPLACE "." "/" dir "${NAME}")
- string(REGEX REPLACE "[^.]*\\." "" proj "${NAME}")
- add_test(${NAME} ${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}
- ${${NAME}_EXTRA_OPTIONS}
- --test-command ${COMMAND} ${ARGN})
-endmacro(ADD_TEST_MACRO)
+macro(add_test_variant NAME BASE COMMAND)
+ string(REPLACE "." "/" src_dir "${BASE}")
+ string(REPLACE "." "/" build_dir "${NAME}")
+ string(REGEX REPLACE "[^.]*\\." "" proj "${NAME}")
+ 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}
+ ${${NAME}_EXTRA_OPTIONS}
+ --test-command ${COMMAND} ${ARGN})
+endmacro()
+macro(add_test_macro NAME)
+ add_test_variant("${NAME}" "${NAME}" ${ARGN})
+endmacro()
find_package(Qt5LinguistTools CONFIG)
@@ -32,9 +36,22 @@ add_test_macro(ExecuteKDEModules dummy)
add_test_macro(KDEInstallDirsTest.vars_defined dummy)
add_test_macro(KDEInstallDirsTest.not_cache_variable dummy)
+
+add_test_variant(KDEInstallDirsTest.vars_in_sync_no_args
+ KDEInstallDirsTest.vars_in_sync dummy)
+
+set(KDEInstallDirsTest.vars_in_sync_args_EXTRA_OPTIONS
+ --build-options -DCMAKE_INSTALL_DATADIR=altdata
+ -DKDE_INSTALL_BINDIR=altbin
+ -DLIB_INSTALL_DIR=altlib
+ )
+add_test_variant(KDEInstallDirsTest.vars_in_sync_args
+ KDEInstallDirsTest.vars_in_sync dummy)
+
set(KDEInstallDirsTest.usr_vars_defined_EXTRA_OPTIONS
--build-options -DCMAKE_INSTALL_PREFIX=/usr)
add_test_macro(KDEInstallDirsTest.usr_vars_defined dummy)
+
find_package(Qt5Core QUIET)
if (TARGET Qt5::qmake)
set(KDEInstallDirsTest.qt_vars_defined_EXTRA_OPTIONS