aboutsummaryrefslogtreecommitdiff
path: root/tests/KDEInstallDirsTest/not_cache_variable
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/KDEInstallDirsTest/not_cache_variable
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/KDEInstallDirsTest/not_cache_variable')
-rw-r--r--tests/KDEInstallDirsTest/not_cache_variable/CMakeLists.txt39
1 files changed, 37 insertions, 2 deletions
diff --git a/tests/KDEInstallDirsTest/not_cache_variable/CMakeLists.txt b/tests/KDEInstallDirsTest/not_cache_variable/CMakeLists.txt
index ea62d95b..8ddbb27a 100644
--- a/tests/KDEInstallDirsTest/not_cache_variable/CMakeLists.txt
+++ b/tests/KDEInstallDirsTest/not_cache_variable/CMakeLists.txt
@@ -4,9 +4,44 @@ cmake_minimum_required(VERSION 2.8)
set(ECM_KDE_MODULE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../../kde-modules)
set(ECM_MODULE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../../modules)
+set(CMAKE_MODULE_PATH "${ECM_KDE_MODULE_DIR}")
-set(CMAKE_INSTALL_LIBDIR "foo")
-include(${ECM_KDE_MODULE_DIR}/KDEInstallDirs.cmake)
+set(KDE_INSTALL_BINDIR "altbin")
+set(CMAKE_INSTALL_DATADIR "altdata")
+set(LIB_INSTALL_DIR "altlib")
+
+include(KDEInstallDirs)
+
+
+include(../var_list.cmake)
+include(../../test_helpers.cmake)
+
+message(STATUS "Checking result of setting KDE_INSTALL_BINDIR")
+assert_var_str_value(KDE_INSTALL_BINDIR "altbin")
+if(should_set_CMAKE_INSTALL_BINDIR)
+ assert_var_str_value(CMAKE_INSTALL_BINDIR "altbin")
+endif()
+if(NOT KDE_INSTALL_DIRS_NO_DEPRECATED)
+ assert_var_str_value(BIN_INSTALL_DIR "altbin")
+endif()
+
+if(should_set_CMAKE_INSTALL_DATADIR)
+ message(STATUS "Checking result of setting CMAKE_INSTALL_DATADIR")
+ assert_var_str_value(KDE_INSTALL_DATADIR "altdata")
+ assert_var_str_value(CMAKE_INSTALL_DATADIR "altdata")
+ if(NOT KDE_INSTALL_DIRS_NO_DEPRECATED)
+ assert_var_str_value(DATA_INSTALL_DIR "altdata")
+ endif()
+endif()
+
+if(NOT KDE_INSTALL_DIRS_NO_DEPRECATED)
+ message(STATUS "Checking result of setting LIB_INSTALL_DIR")
+ assert_var_str_value(KDE_INSTALL_LIBDIR "altlib")
+ if(should_set_CMAKE_INSTALL_LIBDIR)
+ assert_var_str_value(CMAKE_INSTALL_LIBDIR "altlib")
+ endif()
+ assert_var_str_value(LIB_INSTALL_DIR "altlib")
+endif()
add_executable(dummy main.c)
set_target_properties(dummy PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})