From 107f255620b6284de118aa1f358ab6cf99862ae9 Mon Sep 17 00:00:00 2001 From: Alex Merry Date: Wed, 17 Dec 2014 20:33:32 +0000 Subject: 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 --- .../not_cache_variable/CMakeLists.txt | 39 ++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) (limited to 'tests/KDEInstallDirsTest/not_cache_variable') 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}) -- cgit v1.2.1