summaryrefslogtreecommitdiffstats
path: root/cmake/tests
diff options
context:
space:
mode:
authorTobias Hunger <tobias.hunger@qt.io>2018-11-08 22:29:27 +0100
committerTobias Hunger <tobias.hunger@qt.io>2018-11-22 10:38:04 +0000
commitbdb5e2a48ea206005eaa8305b7517b2843f2aba1 (patch)
tree0ff01ecba20c2b3b9f63f594347bdda1f045e5cf /cmake/tests
parentfac800ad1c5355e9002bf819ae06923a4edaf572 (diff)
CMake: Simplify qt_make_output_file
Simplify qt_make_output_file and add a simple test for it. Change-Id: I87694291cd877545ade5d9c42d1424d7b3b7b567 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Diffstat (limited to 'cmake/tests')
-rw-r--r--cmake/tests/CMakeLists.txt1
-rw-r--r--cmake/tests/qt_make_output_file/CMakeLists.txt24
2 files changed, 25 insertions, 0 deletions
diff --git a/cmake/tests/CMakeLists.txt b/cmake/tests/CMakeLists.txt
index 28568ce46f..c7f7baafe1 100644
--- a/cmake/tests/CMakeLists.txt
+++ b/cmake/tests/CMakeLists.txt
@@ -23,3 +23,4 @@ macro(add_test_macro NAME)
endmacro()
add_test_macro(features features)
+add_test_macro(qt_make_output_file qt_make_output_file)
diff --git a/cmake/tests/qt_make_output_file/CMakeLists.txt b/cmake/tests/qt_make_output_file/CMakeLists.txt
new file mode 100644
index 0000000000..d66579f514
--- /dev/null
+++ b/cmake/tests/qt_make_output_file/CMakeLists.txt
@@ -0,0 +1,24 @@
+cmake_minimum_required(VERSION 3.12.0)
+
+project(QtMakeOutputFileTest
+ VERSION 1.0.0
+ DESCRIPTION "qt_make_output_file test"
+ HOMEPAGE_URL "https://qt.io/"
+ LANGUAGES CXX C
+)
+
+## Add some paths to check for cmake modules:
+list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../;${CMAKE_CURRENT_SOURCE_DIR}/../../3rdparty/extra-cmake-modules/find-modules;${CMAKE_CURRENT_SOURCE_DIR}/../../3rdparty/kwin")
+
+include(QtBuild)
+
+qt_make_output_file("foo.cpp" "" ".mapped" "/tmp/foo" "/tmp/bar" outfile)
+assert(outfile STREQUAL "/tmp/bar/foo.mapped")
+
+qt_make_output_file("../foo.cpp" "prefix_" ".cpp" "/tmp/foo" "/tmp/bar" outfile)
+assert(outfile STREQUAL "/tmp/bar/__/prefix_foo.cpp")
+
+qt_make_output_file("/tmp/bar/foo.cpp" "prefix_" ".cpp" "/tmp/foo" "/tmp/bar" outfile)
+assert(outfile STREQUAL "/tmp/bar/prefix_foo.cpp")
+
+add_executable(qt_make_output_file ../main.cpp)