Commit | Line | Data |
---|---|---|
e2546bb4 JS |
1 | From 8a3fde00bf53d99e9e4853e8ab97b0e1bcf74915 Mon Sep 17 00:00:00 2001 |
2 | From: Joerg Bornemann <joerg.bornemann@qt.io> | |
3 | Date: Wed, 29 Jan 2020 11:06:35 +0100 | |
4 | Subject: [PATCH] Fix qt5_make_output_file macro for paths containing dots | |
5 | ||
6 | Commit 89bd5a7e broke CMake projects that use dots in their build | |
7 | paths, because the used regular expression matches the directory part | |
8 | of the path as well. | |
9 | ||
10 | The regex wants to achieve the same as get_filename_component(... | |
11 | NAME_WLE) which is available since CMake 3.14. Re-implement the | |
12 | NAME_WLE functionality for older CMake versions by using multiple | |
13 | get_filename_component calls. | |
14 | ||
15 | Fixes: QTBUG-81715 | |
16 | Task-number: QTBUG-80295 | |
17 | Change-Id: I2ef053300948f6e1b2c0c5eafac35105f193d4e6 | |
18 | Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> | |
19 | --- | |
20 | ||
21 | diff --git a/src/corelib/Qt5CoreMacros.cmake b/src/corelib/Qt5CoreMacros.cmake | |
22 | index 7735e51..b3da640 100644 | |
23 | --- a/src/corelib/Qt5CoreMacros.cmake | |
24 | +++ b/src/corelib/Qt5CoreMacros.cmake | |
25 | @@ -59,7 +59,14 @@ | |
26 | set(_outfile "${CMAKE_CURRENT_BINARY_DIR}/${rel}") | |
27 | string(REPLACE ".." "__" _outfile ${_outfile}) | |
28 | get_filename_component(outpath ${_outfile} PATH) | |
29 | - string(REGEX REPLACE "\\.[^.]*$" "" _outfile ${_outfile}) | |
30 | + if(CMAKE_VERSION VERSION_LESS "3.14") | |
31 | + get_filename_component(_outfile_ext ${_outfile} EXT) | |
32 | + get_filename_component(_outfile_ext ${_outfile_ext} NAME_WE) | |
33 | + get_filename_component(_outfile ${_outfile} NAME_WE) | |
34 | + string(APPEND _outfile ${_outfile_ext}) | |
35 | + else() | |
36 | + get_filename_component(_outfile ${_outfile} NAME_WLE) | |
37 | + endif() | |
38 | file(MAKE_DIRECTORY ${outpath}) | |
39 | set(${outfile} ${outpath}/${prefix}${_outfile}.${ext}) | |
40 | endmacro() |