Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authortamasmeszaros <meszaros.q@gmail.com>2020-05-14 11:10:47 +0300
committertamasmeszaros <meszaros.q@gmail.com>2020-05-14 11:50:39 +0300
commit63c82ed8c60e0bd3694c48df2fdba4e2b3ef711e (patch)
tree732f27c74976ec200daffde963768f2025a2518b /cmake
parent2d3a218a07567c8378c8fa73424429d4e92b77ea (diff)
Modify PCH script to use builtin cmake function if possible.
Diffstat (limited to 'cmake')
-rw-r--r--cmake/modules/PrecompiledHeader.cmake15
1 files changed, 15 insertions, 0 deletions
diff --git a/cmake/modules/PrecompiledHeader.cmake b/cmake/modules/PrecompiledHeader.cmake
index 2f62a7dbe..e5f01af21 100644
--- a/cmake/modules/PrecompiledHeader.cmake
+++ b/cmake/modules/PrecompiledHeader.cmake
@@ -101,7 +101,14 @@ function(export_all_flags _filename)
file(GENERATE OUTPUT "${_filename}" CONTENT "${_compile_definitions}${_include_directories}${_compile_flags}${_compile_options}${_cxx_flags}\n")
endfunction()
+# Use the new builtin CMake function if possible or fall back to the old one.
+if (CMAKE_VERSION VERSION_LESS 3.16)
+
function(add_precompiled_header _target _input)
+
+ message(STATUS "Adding precompiled header ${_input} to target ${_target} with legacy method. "
+ "Update your cmake instance to use the native PCH functions.")
+
cmake_parse_arguments(_PCH "FORCEINCLUDE" "SOURCE_CXX;SOURCE_C" "" ${ARGN})
get_filename_component(_input_we ${_input} NAME_WE)
@@ -241,3 +248,11 @@ function(add_precompiled_header _target _input)
endforeach()
endif(CMAKE_COMPILER_IS_GNUCXX)
endfunction()
+
+else ()
+
+function(add_precompiled_header _target _input)
+ target_precompile_headers(${_target} PRIVATE ${_input})
+endfunction()
+
+endif (CMAKE_VERSION VERSION_LESS 3.16)