Made it so that a dummy .cpp is actually created when compiling with VC++.
This commit is contained in:
@@ -272,12 +272,9 @@ ENDMACRO(ADD_PRECOMPILED_HEADER)
|
||||
MACRO(GET_NATIVE_PRECOMPILED_HEADER _targetName _input)
|
||||
|
||||
if(CMAKE_GENERATOR MATCHES "^Visual.*$")
|
||||
SET(_dummy_str "#include \"${_input}\"\n"
|
||||
"// This is required to suppress LNK4221. Very annoying.\n"
|
||||
"void *g_${_targetName}Dummy = 0\;\n")
|
||||
set(_dummy_str "#include \"${_input}\"\n")
|
||||
|
||||
# Use of cxx extension for generated files (as Qt does)
|
||||
SET(${_targetName}_pch ${CMAKE_CURRENT_BINARY_DIR}/${_targetName}_pch.cxx)
|
||||
set(${_targetName}_pch ${CMAKE_CURRENT_BINARY_DIR}/${_targetName}_pch.cpp)
|
||||
if(EXISTS ${${_targetName}_pch})
|
||||
# Check if contents is the same, if not rewrite
|
||||
# todo
|
||||
@@ -337,11 +334,7 @@ ENDMACRO(ADD_NATIVE_PRECOMPILED_HEADER)
|
||||
|
||||
macro(ocv_add_precompiled_header_to_target the_target pch_header)
|
||||
if(PCHSupport_FOUND AND ENABLE_PRECOMPILED_HEADERS AND EXISTS "${pch_header}")
|
||||
if(CMAKE_GENERATOR MATCHES Visual)
|
||||
string(REGEX REPLACE "hpp$" "cpp" ${the_target}_pch "${pch_header}")
|
||||
add_native_precompiled_header(${the_target} ${pch_header})
|
||||
unset(${the_target}_pch)
|
||||
elseif(CMAKE_GENERATOR MATCHES Xcode)
|
||||
if(CMAKE_GENERATOR MATCHES "^Visual" OR CMAKE_GENERATOR MATCHES Xcode)
|
||||
add_native_precompiled_header(${the_target} ${pch_header})
|
||||
elseif(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_GENERATOR MATCHES "Makefiles|Ninja")
|
||||
add_precompiled_header(${the_target} ${pch_header})
|
||||
|
||||
Reference in New Issue
Block a user