Skip to content

Commit 24901dd

Browse files
committed
PrecompiledHeader.cmake: Fix setting SOURCE_CXX & SOURCE_C; recognize pch in subdirectories
1 parent fa917ae commit 24901dd

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

PrecompiledHeader.cmake

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,14 @@ function(export_all_flags _filename)
7676
endfunction()
7777

7878
function(add_precompiled_header _target _input)
79-
cmake_parse_arguments(_PCH "FORCEINCLUDE" "SOURCE_CXX:SOURCE_C" "" ${ARGN})
79+
cmake_parse_arguments(_PCH "FORCEINCLUDE" "SOURCE_CXX;SOURCE_C" "" ${ARGN})
8080

81+
get_filename_component(_input_dir ${_input} DIRECTORY)
8182
get_filename_component(_input_we ${_input} NAME_WE)
83+
if(_input_dir)
84+
set(_input_we "${_input_dir}/${_input_we}")
85+
endif()
86+
8287
if(NOT _PCH_SOURCE_CXX)
8388
set(_PCH_SOURCE_CXX "${_input_we}.cpp")
8489
endif()

0 commit comments

Comments
 (0)