diff options
author | David Faure <faure@kde.org> | 2017-08-08 10:43:48 +0200 |
---|---|---|
committer | David Faure <faure@kde.org> | 2017-08-09 19:16:57 +0200 |
commit | 7af93dd23873d0b9cdbac192949e7e5114940aa6 (patch) | |
tree | a9f03da2275e79181547fe566af9012ca5d77519 /kde-modules/KDECMakeSettings.cmake | |
parent | e5301edf1daf06aa862eb5ccae5ede72d7717fe0 (diff) | |
download | extra-cmake-modules-7af93dd23873d0b9cdbac192949e7e5114940aa6.tar.gz extra-cmake-modules-7af93dd23873d0b9cdbac192949e7e5114940aa6.tar.bz2 |
Set CMAKE_*_OUTPUT_DIRECTORY to run tests without installing.
Summary:
For compatibility reasons, this is only enabled when projects
upgrade their find_package(ECM) line to request a version >= 5.38.
A little bit like cmake policies: just upgrading ECM is compatible,
while increasing the required version can change behaviour.
Test Plan:
Tested make test in all KF5 frameworks; I have patches
for some of them which I can't commit until this is in.
Reviewers: cgiboudeaux, kfunk
Reviewed By: cgiboudeaux, kfunk
Subscribers: kfunk, #frameworks, #build_system
Tags: #frameworks, #build_system
Differential Revision: https://phabricator.kde.org/D7198
Diffstat (limited to 'kde-modules/KDECMakeSettings.cmake')
-rw-r--r-- | kde-modules/KDECMakeSettings.cmake | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/kde-modules/KDECMakeSettings.cmake b/kde-modules/KDECMakeSettings.cmake index ac1212cc..9aa6b4f6 100644 --- a/kde-modules/KDECMakeSettings.cmake +++ b/kde-modules/KDECMakeSettings.cmake @@ -41,7 +41,10 @@ # ~~~~~~~~~~~~~~ # # Various CMake build defaults are altered, such as searching source and build -# directories for includes first and enabling automoc by default. +# directories for includes first, enabling automoc by default. +# +# When find_package(ECM 5.38) or higher is called, this also selects +# a layout for the build dir that helps running executables without installing. # # This section can be disabled by setting ``KDE_SKIP_BUILD_SETTINGS`` to TRUE # before including this module. @@ -244,10 +247,12 @@ if(NOT KDE_SKIP_BUILD_SETTINGS) # one common directory, and all static|import libraries and plugins # into another one. This way test executables can find their dlls # even without installation. - if(WIN32) - set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib") - set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") - set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") + + # We do the same under Unix to make it possible to run tests and apps without installing + if (WIN32 OR "${ECM_GLOBAL_FIND_VERSION}" VERSION_GREATER_EQUAL "5.38.0") + set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib") + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") endif() if (APPLE) |