2
3
mirror of https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git synced 2025-07-14 10:37:41 -04:00

Be smarter about Pch.[h|cpp] files

As pointed out in #225, Pch.cpp looks suspiciously like a garbage file
when precompiled headers are disabled in cmake. To solve that, I have
changed the precompiled header function to add the Pch source files only
when pch is enabled. This should prevent future accidents.
This commit is contained in:
2012-11-18 00:29:43 -05:00
parent bb4d36e69d
commit 3ea82ca589
2 changed files with 8 additions and 5 deletions

View File

@ -8,7 +8,7 @@ if(PCH_SUPPORTED)
option(PLASMA_USE_PCH "Enable precompiled headers?" ON)
endif(PCH_SUPPORTED)
macro(use_precompiled_header PrecompiledHeader PrecompiledSource)
function(use_precompiled_header PrecompiledHeader PrecompiledSource Headers Sources)
if(PLASMA_USE_PCH)
if(MSVC)
get_filename_component(PrecompiledBasename ${PrecompiledHeader} NAME_WE)
@ -19,5 +19,10 @@ macro(use_precompiled_header PrecompiledHeader PrecompiledSource)
add_definitions(/FI"${PrecompiledHeader}")
set_source_files_properties(${PrecompiledSource} PROPERTIES COMPILE_FLAGS "/Yc\"${PrecompiledHeader}\"")
endif(MSVC)
# Add the Pch.[h|cpp] to the appropriate sets
# OT: This has to be the oddest thing I've ever written =/
set(${Headers} ${${Headers}} ${PrecompiledHeader} PARENT_SCOPE)
set(${Sources} ${${Sources}} ${PrecompiledSource} PARENT_SCOPE)
endif(PLASMA_USE_PCH)
endmacro(use_precompiled_header)
endfunction(use_precompiled_header)